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

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)