# SecurityLevel.hh

Go to the documentation of this file.

    00001 // ----------------------------------------------------------------------------
    00002 // CERTI - HLA RunTime Infrastructure
    00003 // Copyright (C) 2002, 2003  ONERA
    00004 //
    00005 // This file is part of CERTI-libCERTI
    00006 //
    00007 // CERTI-libCERTI is free software ; you can redistribute it and/or
    00008 // modify it under the terms of the GNU Lesser General Public License
    00009 // as published by the Free Software Foundation ; either version 2 of
    00010 // the License, or (at your option) any later version.
    00011 //
    00012 // CERTI-libCERTI is distributed in the hope that it will be useful, but
    00013 // WITHOUT ANY WARRANTY ; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    00015 // Lesser General Public License for more details.
    00016 //
    00017 // You should have received a copy of the GNU Lesser General Public
    00018 // License along with this program ; if not, write to the Free Software
    00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
    00020 // USA
    00021 //
    00022 // $Id: SecurityLevel.hh,v 3.11 2008/12/07 20:16:15 gotthardp Exp $
    00023 // ----------------------------------------------------------------------------
    00024
    00025 #ifndef _CERTI_SECURITY_LEVEL_HH
    00026 #define _CERTI_SECURITY_LEVEL_HH
    00027
    00028 #include "certi.hh"
    00029 #include "Exception.hh"
    00030
    00031 #include <stdlib.h>
    00032 #include <string.h>
    00033
    00034 #define MAX_SECURITYLEVELNAME 500
    00035
    00036 typedef char *SecurityLevelName ;
    00037 typedef unsigned short SecurityLevelID ;
    00038
    00039 #define PublicLevelID 0
    00040 #define PublicLevelName "Public"
    00041
    00042 namespace certi {
    00043
    00044 class SecurityLevel
    00045 {
    00046 public:
    00047     SecurityLevelName Name ;
    00048     SecurityLevelID LevelID ;
    00049
    00050     SecurityLevel(const char *InitName,
    00051                   SecurityLevelID InitLevelID)
    00052     {
    00053 /*#ifdef _WIN32
    00054     if((InitName == NULL) ||(strlen(InitName) > MAX_SECURITYLEVELNAME))
    00055 #else
    00056     if((InitName == NULL) ||(std::strlen(InitName) > MAX_SECURITYLEVELNAME))
    00057 #endif*/
    00058
    00059        if ((InitName == NULL) || (strlen(InitName) > MAX_SECURITYLEVELNAME))
    00060             throw RTIinternalError("Bad Security Level Name.");
    00061         Name = strdup(InitName);
    00062         LevelID = InitLevelID ;
    00063     }
    00064
    00065     ~SecurityLevel() { if (Name != NULL) free(Name); };
    00066 };
    00067
    00068 }
    00069
    00070 #endif // _CERTI_SECURITY_LEVEL_HH
    00071
    00072 // $Id: SecurityLevel.hh,v 3.11 2008/12/07 20:16:15 gotthardp Exp $