VR-Forces 4.1 Class Documentation
objType.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2001 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: objType.h,v $ $Revision: 1.11 $ $State: Exp $
7 *******************************************************************************/
8 
9 #ifndef DtObjectType_H_
10 #define DtObjectType_H_
11 
12 #include <vlpi/entityType.h>
13 
14 // class DtObjectType:
15 //
16 // Instances of DtObjectType are an extended form of DtEntityType objects.
17 // They extend the DIS/RPR entity type by having an additional enumerated
18 // field. The new field represents a super-set of object types, e.g.
19 // individual, pseudo-aggregate, true-aggregate. The remaining fields
20 // (kind, domain, country, category, subcateogy, specific, and extra) are
21 // unchanged. In terms of comparisons and sorting, the most significant field
22 // is the the new field (super type). The order of significance (in
23 // descreasing order) is as follows:
24 //
25 // <super type, kind, domain, country, category, subcategory, specific, extra>
26 //
27 // The standard wildcard value (-1, indicating a match of any) applies to the
28 // new field in the same way as for the fields in a standard entity type.
29 // Enumerations for the super type are found in objTypeEnums.h.
30 
32 class DT_DLL_vrfExtProtocol DtObjectType : public DtEntityType
33 {
34 public:
35 
36  // default constructor
37  DtObjectType();
38 
39  DtObjectType(int superType, int kind, int domain, int country,
40  int category, int subCategory, int specific, int extra);
41 
42  DtObjectType(int superType, const DtEntityType & entityType);
43 
44  // destructor
45  virtual ~DtObjectType();
46 
47  // copy constructor
48  DtObjectType(const DtObjectType& orig);
49 
50  // assignment operator
51  DtObjectType& operator=(const DtObjectType& orig);
52 
53  // set/get the super type field. Enumerations for this field are found
54  // in objTypeEnums.h.
55  virtual void setSuperType(int type);
56  virtual int superType() const;
57 
58  // Returns a string representation of the object type.
59  virtual const char *string(char sep = ':') const;
60 
61  // Returns 1 if object is prior to specified argument when in sorted
62  // order; returns false otherwise. Sorting is on multiple keys --
63  // super type, kind, domain, country, category, subcategory, specific, and
64  // extra, in that order.*/
65  virtual int operator <(const DtObjectType &type) const;
66 
67  // Returns true if all fields either match exactly or with -1's.
68  virtual bool matchPattern(const DtObjectType &pat) const;
69 
70  // == returns 1 if all fields are exactly equal, 0 if they are not equal
71  virtual int match(const DtObjectType &type) const;
72 
73  // == returns 1 if all fields are exactly equal, 0 if they are not equal
74  virtual int operator==(const DtObjectType &type) const;
75 
76  // != returns 0 if they are equal, nonzero if they are not equal
77  virtual int operator!=(const DtObjectType &type) const;
78 
79  int& operator[](int);
80  const int operator[](int) const;
81 
83  bool hasWildCard() const;
84 
85 public:
86 
87 
88  //
89  // Basic Types
90  //
91 
92  // Returns a type consisting of fields set all to zeros.
93  static const DtObjectType & nullType();
94 
95  // Returns a type consisting of fields set all to -1s.
96  static const DtObjectType & anyType();
97 
98  // Returns a type representing an generic individual object
99  static const DtObjectType & individualType();
100 
101  // Returns a type representing an generic aggregate object
102  static const DtObjectType & aggregateType();
103 
104  // Returns a type representing an generic pseudo-aggregate object
105  static const DtObjectType & pseudoAggregateType();
106 
107  // Returns a type representing an generic individual lifeform object
108  static const DtObjectType & individualLifeformType();
109 
110  // Returns a type representing an individual platform object
111  static const DtObjectType & individualPlatformType();
112 
113  // Returns a type representing an individual cultural feature object
114  static const DtObjectType & individualCulturalFeatureType();
115 
116  // Returns a type representing an individual munition object
117  static const DtObjectType & individualMunitionType();
118 
119 
120  //
121  // Graphic Object / Control Object Types
122  //
123 
124  // Returns a type representing a text object
125  static const DtObjectType & textType();
126 
127  // Returns a type representing a marker object
128  static const DtObjectType & markerType();
129 
130  // Returns a type representing an control point object
131  static const DtObjectType & controlPointType();
132 
133  // Returns a type representing a route object
134  static const DtObjectType & routeType();
135 
136  // Returns a type representing a control area object
137  static const DtObjectType & controlAreaType();
138 
139  // Returns a type representing a obstacle object
140  static const DtObjectType & obstacleType();
141 
142  // Returns a type representing a disaggregation area object
143  static const DtObjectType & disaggregationAreaType();
144 
145  // Returns a type representing a phase line object
146  static const DtObjectType & phaseLineType();
147 
148 protected:
149 
151 };
152 
153 
154 inline int& DtObjectType::operator[](int i)
155 {
156  switch (i)
157  {
158  case 0:
159  return DtEntityKind;
160  case 1:
161  return DtDomain;
162  case 2:
163  return DtCountry;
164  case 3:
165  return DtCategory;
166  case 4:
167  return DtSubCategory;
168  case 5:
169  return DtSpecific;
170  case 6:
171  return DtExtra;
172  case 7:
173  return mySuperType;
174  }
175 
176  return mySuperType;
177 }
178 
179 inline bool DtObjectType::hasWildCard() const
180 {
181  for (int i = 0; i < 7; i++)
182  {
183  if ((*this)[i] == -1)
184  {
185  return true;
186  }
187  }
188 
189  return false;
190 }
191 
192 inline const int DtObjectType::operator[](int i) const
193 {
194  switch (i)
195  {
196  case 0:
197  return DtEntityKind;
198  case 1:
199  return DtDomain;
200  case 2:
201  return DtCountry;
202  case 3:
203  return DtCategory;
204  case 4:
205  return DtSubCategory;
206  case 5:
207  return DtSpecific;
208  case 6:
209  return DtExtra;
210  case 7:
211  return mySuperType;
212  }
213 
214  return mySuperType;
215 }
216 
217 #endif
218 

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)