![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2001 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: objType.h,v $ $Revision: 1.11 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00009 #ifndef DtObjectType_H_ 00010 #define DtObjectType_H_ 00011 00012 #include <vlpi/entityType.h> 00013 00014 // class DtObjectType: 00015 // 00016 // Instances of DtObjectType are an extended form of DtEntityType objects. 00017 // They extend the DIS/RPR entity type by having an additional enumerated 00018 // field. The new field represents a super-set of object types, e.g. 00019 // individual, pseudo-aggregate, true-aggregate. The remaining fields 00020 // (kind, domain, country, category, subcateogy, specific, and extra) are 00021 // unchanged. In terms of comparisons and sorting, the most significant field 00022 // is the the new field (super type). The order of significance (in 00023 // descreasing order) is as follows: 00024 // 00025 // <super type, kind, domain, country, category, subcategory, specific, extra> 00026 // 00027 // The standard wildcard value (-1, indicating a match of any) applies to the 00028 // new field in the same way as for the fields in a standard entity type. 00029 // Enumerations for the super type are found in objTypeEnums.h. 00030 00031 #include <vrfExtProtocol/vrfExtProtocolDefines.h> 00032 class DT_DLL_vrfExtProtocol DtObjectType : public DtEntityType 00033 { 00034 public: 00035 00036 // default constructor 00037 DtObjectType(); 00038 00039 DtObjectType(int superType, int kind, int domain, int country, 00040 int category, int subCategory, int specific, int extra); 00041 00042 DtObjectType(int superType, const DtEntityType & entityType); 00043 00044 // destructor 00045 virtual ~DtObjectType(); 00046 00047 // copy constructor 00048 DtObjectType(const DtObjectType& orig); 00049 00050 // assignment operator 00051 DtObjectType& operator=(const DtObjectType& orig); 00052 00053 // set/get the super type field. Enumerations for this field are found 00054 // in objTypeEnums.h. 00055 virtual void setSuperType(int type); 00056 virtual int superType() const; 00057 00058 // Returns a string representation of the object type. 00059 virtual const char *string(char sep = ':') const; 00060 00061 // Returns 1 if object is prior to specified argument when in sorted 00062 // order; returns false otherwise. Sorting is on multiple keys -- 00063 // super type, kind, domain, country, category, subcategory, specific, and 00064 // extra, in that order.*/ 00065 virtual int operator <(const DtObjectType &type) const; 00066 00067 // Returns true if all fields either match exactly or with -1's. 00068 virtual bool matchPattern(const DtObjectType &pat) const; 00069 00070 // == returns 1 if all fields are exactly equal, 0 if they are not equal 00071 virtual int match(const DtObjectType &type) const; 00072 00073 // == returns 1 if all fields are exactly equal, 0 if they are not equal 00074 virtual int operator==(const DtObjectType &type) const; 00075 00076 // != returns 0 if they are equal, nonzero if they are not equal 00077 virtual int operator!=(const DtObjectType &type) const; 00078 00079 int& operator[](int); 00080 const int operator[](int) const; 00081 00083 bool hasWildCard() const; 00084 00085 public: 00086 00087 00088 // 00089 // Basic Types 00090 // 00091 00092 // Returns a type consisting of fields set all to zeros. 00093 static const DtObjectType & nullType(); 00094 00095 // Returns a type consisting of fields set all to -1s. 00096 static const DtObjectType & anyType(); 00097 00098 // Returns a type representing an generic individual object 00099 static const DtObjectType & individualType(); 00100 00101 // Returns a type representing an generic aggregate object 00102 static const DtObjectType & aggregateType(); 00103 00104 // Returns a type representing an generic pseudo-aggregate object 00105 static const DtObjectType & pseudoAggregateType(); 00106 00107 // Returns a type representing an generic individual lifeform object 00108 static const DtObjectType & individualLifeformType(); 00109 00110 // Returns a type representing an individual platform object 00111 static const DtObjectType & individualPlatformType(); 00112 00113 // Returns a type representing an individual cultural feature object 00114 static const DtObjectType & individualCulturalFeatureType(); 00115 00116 // Returns a type representing an individual munition object 00117 static const DtObjectType & individualMunitionType(); 00118 00119 00120 // 00121 // Graphic Object / Control Object Types 00122 // 00123 00124 // Returns a type representing a text object 00125 static const DtObjectType & textType(); 00126 00127 // Returns a type representing a marker object 00128 static const DtObjectType & markerType(); 00129 00130 // Returns a type representing an control point object 00131 static const DtObjectType & controlPointType(); 00132 00133 // Returns a type representing a route object 00134 static const DtObjectType & routeType(); 00135 00136 // Returns a type representing a control area object 00137 static const DtObjectType & controlAreaType(); 00138 00139 // Returns a type representing a obstacle object 00140 static const DtObjectType & obstacleType(); 00141 00142 // Returns a type representing a disaggregation area object 00143 static const DtObjectType & disaggregationAreaType(); 00144 00145 // Returns a type representing a phase line object 00146 static const DtObjectType & phaseLineType(); 00147 00148 protected: 00149 00150 int mySuperType; 00151 }; 00152 00153 00154 inline int& DtObjectType::operator[](int i) 00155 { 00156 switch (i) 00157 { 00158 case 0: 00159 return DtEntityKind; 00160 case 1: 00161 return DtDomain; 00162 case 2: 00163 return DtCountry; 00164 case 3: 00165 return DtCategory; 00166 case 4: 00167 return DtSubCategory; 00168 case 5: 00169 return DtSpecific; 00170 case 6: 00171 return DtExtra; 00172 case 7: 00173 return mySuperType; 00174 } 00175 00176 return mySuperType; 00177 } 00178 00179 inline bool DtObjectType::hasWildCard() const 00180 { 00181 for (int i = 0; i < 7; i++) 00182 { 00183 if ((*this)[i] == -1) 00184 { 00185 return true; 00186 } 00187 } 00188 00189 return false; 00190 } 00191 00192 inline const int DtObjectType::operator[](int i) const 00193 { 00194 switch (i) 00195 { 00196 case 0: 00197 return DtEntityKind; 00198 case 1: 00199 return DtDomain; 00200 case 2: 00201 return DtCountry; 00202 case 3: 00203 return DtCategory; 00204 case 4: 00205 return DtSubCategory; 00206 case 5: 00207 return DtSpecific; 00208 case 6: 00209 return DtExtra; 00210 case 7: 00211 return mySuperType; 00212 } 00213 00214 return mySuperType; 00215 } 00216 00217 #endif 00218