![]() |
MAK RTIspy API Documentation for HLA 1.3
|
00001 /********************************************************************* 00002 ** Copyright (c) 1998 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: fomMgr.h,v $ $Revision: 1.47 $ $State: Exp $ 00007 *********************************************************************/ 00008 00011 00012 #ifndef DtFomClassMgr_H_ 00013 #define DtFomClassMgr_H_ 00014 00015 #include <vlutil/vlFedTarget.h> 00016 #include "attrInfo.h" 00017 #include "spaceInfo.h" 00018 #include "objClassInfo.h" 00019 #include "intClassInfo.h" 00020 #include "fedTargetHelper.h" 00021 #include "attrInfo.h" 00022 #include "RIDparams.h" 00023 #include <set> 00024 #include <map> 00025 #include <mtl/xmlFedReader.h> 00026 #include <vector> 00027 00028 00031 00032 class DtFomClassMgr; 00033 class DtAttrInfo; 00034 typedef std::vector<DtAttrInfo> DtAttrVector; 00035 typedef DtFomClassMgr* (*DtFomClassMgrCreator)(DtRIDParameters* p); 00037 typedef std::vector<DtObjectClassInfo*> DtObjectClassVector; 00038 typedef std::vector<DtInteractionClassInfo*> DtInteractionClassVector; 00039 00040 00041 00042 #ifdef DDM 00043 typedef std::vector<DtSpaceInfo> DtSpaceVector; 00044 #endif 00045 00046 class DT_DLL_LRC DtFomClassMgr : public MAKRti::DtFedTarget 00047 { 00048 protected: 00049 00051 DtFomClassMgr(DtRIDParameters* params); 00052 00054 DtFomClassMgr(); 00055 00057 DtFomClassMgr& operator=(const DtFomClassMgr& orig); 00058 00059 public: 00060 00062 DtFomClassMgr(const DtFomClassMgr& orig); 00063 00065 virtual ~DtFomClassMgr(); 00066 00067 //------------------------------------------------------------------------- 00069 //------------------------------------------------------------------------- 00070 00071 00073 virtual void addSpace(const char* name); 00074 00077 virtual void addDimension(const char* spaceName, const char* dimName); 00078 00080 virtual void addDimension(const char* dimName, unsigned long upperBound, 00081 unsigned long defaultLowerBound, unsigned long defaultUpperBound, 00082 bool excluded); 00083 00086 virtual bool addInteractionDimension(const char* interactionName, 00087 const char* dimension); 00088 00090 virtual void addInterClass(const char* name, const char* baseName, 00091 MAKRti::DtTransportType transport, MAKRti::DtOrderType order, 00092 DtSharingType sharing, const MAKRti::DtString& semantics, 00093 const char* space=NULL); 00094 00095 void addInterClass(const char* name, const char* baseName, 00096 MAKRti::DtTransportType transport, MAKRti::DtOrderType order, 00097 const char* spaceName = NULL ); 00098 00099 void addObjClass( const char* name, const char* baseName, 00100 DtSharingType sharing, const MAKRti::DtString& semantics ); 00101 00103 virtual void addObjClass(const char* name, const char* baseName); 00104 00105 virtual void addParameter(const char* className, const char* paramName ); 00106 00109 virtual void addParameter(const char* className, 00110 const char* paramName, 00111 const char* semantics ); 00112 00115 virtual bool addAttributeDimension(const char* className, 00116 const char* attrName, const char* dimName); 00117 00120 virtual void addAttribute(const char* className, const char* attrName, 00121 MAKRti::DtTransportType transport, MAKRti::DtOrderType order, DtSharingType sharing, 00122 DtFomUpdateType updateType, const MAKRti::DtString& updateCondition, 00123 DtOwnershipType ownershipType, const MAKRti::DtString& semantics, 00124 const char* spaceName=NULL ); 00125 00126 virtual void addAttribute(const char* className, const char* attrName, 00127 MAKRti::DtTransportType transport, MAKRti::DtOrderType order, const char* spaceName=NULL ); 00128 00129 virtual void initUpdateRates(DtRIDParameters* params) ; 00130 00131 00133 const MAKRti::DtUpdateRateSetT & getUpdateRates() const; 00134 00136 float updateRateByName(const char * name); 00137 00140 int positionOfRate(float rate) const; 00141 00143 bool knownUpdateRate(const MAKRti::DtString& rateName) const; 00144 00145 00147 virtual DtMergeFomStatus mergeObjectClasses( DtFedTarget const& module ); 00148 00150 virtual DtMergeFomStatus mergeObjectInfo( DtObjectClassInfo const& classInfo ); 00151 00153 virtual void mergeAttributes( DtObjectClassInfo const& classInfo, 00154 DtFomClassMgr const& module ); 00155 00157 virtual DtMergeFomStatus mergeInteractionClasses( DtFedTarget const& module ); 00158 00160 virtual DtMergeFomStatus mergeInteractionInfo( DtInteractionClassInfo const & interInfo, 00161 const char* spaceName = 0); 00162 00164 virtual void mergeParameters( DtInteractionClassInfo const& interInfo ); 00165 00167 virtual DtMergeFomStatus mergeSpaces( DtFedTarget const& module ); 00168 00170 virtual DtMergeFomStatus mergeDimensions( DtSpaceInfo const& spaceInfo ); 00171 00173 virtual DtMergeFomStatus mergeSwitches( DtFedTarget const& module ); 00174 00175 //------------------------------------------------------------------------- 00177 //------------------------------------------------------------------------- 00178 00179 //------------------------------------------- Object classes and attributes 00180 00182 virtual DtObjectClassHandle classHandle ( 00183 const char* theName, 00184 bool throwException=true); 00185 00188 virtual const char* className ( 00189 DtObjectClassHandle theHandle, 00190 bool throwException=true); 00191 00193 virtual DtAttributeHandle attrHandle ( 00194 const char* theName, 00195 DtObjectClassHandle whichClass, 00196 bool throwException=true); 00197 00200 virtual const char* attrName ( 00201 DtAttributeHandle theHandle, 00202 DtObjectClassHandle whichClass, 00203 bool throwException=true); 00204 00206 virtual DtObjectClassInfo* classByName(const char *name) const; 00207 00209 virtual DtObjectClassInfo* classByHandle( 00210 DtObjectClassHandle handle) const; 00211 00213 virtual DtObjectClassInfo* objectRootClass() const; 00214 00216 virtual DtObjectClassHandle objectRootHandle() const; 00217 00219 virtual int numClasses() const; 00220 00221 //------------------------------------------- Regions and spaces 00222 #ifdef DDM 00223 00224 virtual DtSpaceHandle spaceHandle ( 00225 const char* theName, 00226 bool throwException=true) const; 00227 00230 virtual const char* spaceName ( 00231 DtSpaceHandle theHandle, 00232 bool throwException=true) const; 00233 00235 virtual DtDimensionHandle dimHandle ( 00236 const char* theName, 00237 DtSpaceHandle whichSpace, 00238 bool throwException=true) const; 00239 00242 virtual const char* dimName ( 00243 DtDimensionHandle theHandle, 00244 DtSpaceHandle whichSpace, 00245 bool throwException=true) const; 00246 00248 virtual unsigned long dimUpperBound( 00249 DtDimensionHandle theHandle, 00250 DtSpaceHandle whichSpace, 00251 bool throwException=true); 00252 00254 virtual DtDimensionHandleSet const & getAvailableDimensionsForClassAttribute( 00255 DtObjectClassHandle passedInClassHandle, DtAttributeHandle attrHandle); 00256 00258 virtual DtDimensionHandleSet const & 00259 getAvailableDimensionsForInteractionClass( 00260 DtInteractionClassHandle passedInClassHandle); 00261 00263 virtual DtSpaceInfo* spaceByName(const char *name); 00264 virtual const DtSpaceInfo* spaceByName(const char *name) const; 00265 00267 virtual DtSpaceInfo* spaceByHandle(DtSpaceHandle handle); 00268 virtual const DtSpaceInfo* spaceByHandle(DtSpaceHandle handle) const; 00269 00271 virtual int numSpaces() const; 00272 #endif 00273 00274 //------------------------------------------- Interactions and parameters 00275 00277 virtual DtInteractionClassInfo* interactionByName(const char *name) const; 00278 00280 virtual DtInteractionClassInfo* interactionByHandle( 00281 DtInteractionClassHandle handle) const; 00282 00284 virtual DtInteractionClassInfo* interactionRootClass() const; 00285 00287 virtual DtInteractionClassHandle interactionRootHandle() const; 00288 00290 virtual DtInteractionClassHandle interactionHandle ( 00291 const char* theName, 00292 bool throwException=true); 00293 00296 virtual const char* interactionName ( 00297 DtInteractionClassHandle theHandle, 00298 bool throwException=true); 00299 00301 virtual DtParameterHandle paramHandle ( 00302 const char* theName, 00303 DtInteractionClassHandle whichClass, 00304 bool throwException=true); 00305 00308 virtual const char* paramName ( 00309 DtParameterHandle theHandle, 00310 DtInteractionClassHandle whichClass, 00311 bool throwException=true); 00312 00314 virtual int numInteractions() const; 00315 00316 //------------------------------------------------------------------------- 00318 //------------------------------------------------------------------------- 00319 00320 virtual void initDMFilteringParameters(const DtRIDParameters* params); 00321 virtual void printDMSubscriptions(); 00322 00323 //------------------------------------------------------------------------- 00325 //------------------------------------------------------------------------- 00326 00328 virtual bool save(DtRtiSaveFile& file); 00329 00331 virtual void prepareToRestore(); 00332 00334 virtual bool restore( DtRtiSaveFile& file ); 00335 00337 virtual void setExtend13and1516interop(bool enable); 00338 virtual bool extend13and1516interop() const; 00339 00341 virtual void print() const; 00342 00344 virtual DtFomClassMgr* clone(); 00345 00346 00347 //------------------------------------------------------------------------- 00349 //------------------------------------------------------------------------- 00350 00353 virtual void setConveyRegionDesignatorSets(bool value); 00354 00355 00359 // TODO make this into a method getter/setter thingie 00360 unsigned long myCrc; 00361 00362 public: 00363 00365 static DtFomClassMgr* create(DtRIDParameters* p); 00366 00370 static void setCreatorFunction(DtFomClassMgrCreator fn); 00371 00372 protected: 00373 00374 void init(); 00375 00376 #ifdef DDM 00377 00378 virtual void addSpaceSorted( const char* nameValue ); 00379 virtual void addSpaceUnsorted( const char* nameValue ); 00380 #endif 00381 00383 virtual void addInterClassSorted( const char* name, 00384 const char* baseName, MAKRti::DtTransportType transport, MAKRti::DtOrderType order, 00385 DtSpaceHandle spaceH, DtInteractionClassInfo* baseClass, 00386 DtSharingType sharing, 00387 const MAKRti::DtString& semantics ); 00388 virtual void addInterClassUnsorted( const char* name, 00389 const char* baseName, MAKRti::DtTransportType transport, MAKRti::DtOrderType order, 00390 DtSpaceHandle spaceH, DtInteractionClassInfo* baseClass, 00391 DtSharingType sharing, const MAKRti::DtString& semantics ); 00392 00394 void addObjClassSorted( const char* name, 00395 const char* baseName, DtSharingType sharing, 00396 const MAKRti::DtString& semantics, DtObjectClassInfo* baseClass ); 00397 void addObjClassUnsorted( const char* name, 00398 const char* baseName, DtSharingType sharing, 00399 const MAKRti::DtString& semantics, DtObjectClassInfo* baseClass ); 00400 00403 bool objectClassPresent(const char* name, 00404 unsigned int startIndex = 0, 00405 unsigned int endIndex = 0 ) const; 00406 00407 bool attrPresent( const char *name, 00408 DtObjectClassInfo* classInfo, 00409 unsigned int startIndex = 0, 00410 unsigned int endIndex = 0 ) const; 00411 00412 bool interactionClassPresent(const char* name, 00413 unsigned int startIndex = 0, 00414 unsigned int endIndex = 0 ) const; 00415 00417 unsigned int objectClassPosition( const char* name, 00418 unsigned int startIndex = 0, 00419 unsigned int endIndex = 0 ) const; 00420 00421 unsigned int interactionClassPosition( const char* name, 00422 unsigned int startIndex = 0, 00423 unsigned int endIndex = 0 ) const; 00424 00425 bool resolveAttributeDimensions(MAKRti::DtString & errorString); 00426 bool resolveObjectClasses(MAKRti::DtString & errorString); 00427 bool resolveInteractionClasses(MAKRti::DtString & errorString); 00428 bool resolveAttributes(MAKRti::DtString & errorString); 00429 bool resolveParameters(MAKRti::DtString & errorString); 00430 bool resolveDimensions(MAKRti::DtString & errorString); 00431 00432 protected: 00433 00435 DtObjectClassVector myClasses; 00436 00438 int myFirstMomObjectHandle; 00439 00441 DtInteractionClassVector myInteractions; 00442 00444 int myFirstMomInteractionHandle; 00445 00446 #ifdef DDM 00447 00448 DtSpaceVector mySpaces; 00449 00451 DtSpaceHandle myFirstSpaceHandle; 00452 #endif 00453 00455 bool my13and1516interop; 00456 00458 bool myEnableFomBackwardsCompatibility; 00459 00460 // //! Indicates a FOM module merge is taking place 00461 // bool myMergingFomModule; 00462 00463 00465 bool myOverrideConveyRegions; 00466 00469 mutable DtObjectClassHandle myMutableLastObjClassLookup; 00470 00473 mutable DtInteractionClassHandle myMutableLastInterClassLookup; 00474 00475 protected: 00476 00478 static DtFomClassMgrCreator theCreator; 00479 }; 00480 00481 #endif 00482 00483 00484