VR-Link API Documentation for HLA 1.3
hInteraction.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *********************************************************************/
00005 
00006 #ifndef hInteraction_H_
00007 #define hInteraction_H_
00008 
00009 
00010 
00011 #if DtHLA 
00012 
00013 
00014 
00015 #include "recIntrCbInfo.h"
00016 #include "region.h"
00017 
00018 #include <vlutil/vlTimeStampType.h>
00019 #include <vlutil/vlTime.h>
00020 #include <vlutil/vlString.h>
00021 
00022 
00023 class DT_DLL_VL DtInterClassDesc;
00024 class DT_DLL_VL DtExerciseConn;
00025 class DT_DLL_VL DtList;
00026 
00033 class DT_DLL_VL DtInteraction
00034 {
00035 public:
00036 
00038    DtInteraction();
00039 
00041    virtual ~DtInteraction();
00042 
00044    DtInteraction(const DtInteraction& orig);
00045 
00047    DtInteraction& operator=(const DtInteraction& orig);
00048 
00049 #if DtHLA_1516
00050 
00051    virtual const RTI::ParameterHandleValueMap& phvm() const = 0;
00052 #else
00053 
00054    virtual const RTI::ParameterHandleValuePairSet& phvps() const = 0;
00055 #endif
00056 
00057 #if DtHLA_1516
00058 
00059    virtual void setFromPhvm(const RTI::ParameterHandleValueMap& pvList)=0;
00060 #else
00061 
00062    virtual void setFromPhvps(const RTI::ParameterHandleValuePairSet& pvList)=0;
00063 #endif
00064 
00073    virtual void setExConn(DtExerciseConn* exConn, 
00074                           DtInterClassDesc* classDesc = 0);
00075 
00077    virtual RTI::InteractionClassHandle interactionClassHandle() const;
00078 
00080    virtual char* interactionClassName() const;
00081 
00083    virtual int numParameters() const;
00084 
00087    virtual bool neededByFederation() const;
00088 
00090    virtual void print() const;
00091 
00093    virtual void printToStream(std::ostream& stream) const;
00094 
00096    virtual void printHeader() const;
00097 
00099    virtual void printHeaderToStream(std::ostream& stream) const;
00100 
00102    virtual void printData() const;
00103 
00105    virtual void printDataToString(DtString& buff) const;
00106 
00108    virtual void printDataToStream(std::ostream& stream) const;
00109 
00111    virtual void printParams(bool withHex) const;
00112 
00114    virtual void printParamsToStream(std::ostream& stream, bool withHex) const;
00115 
00117    virtual const char* name() const = 0;
00118 
00120    virtual DtExerciseConn* exerciseConn() const;
00121 
00124    virtual DtInterClassDesc* classDesc() const;
00125 
00127    virtual bool customTagSet() const;
00128 
00129 
00130 #if DtHLA_1516
00131 
00132    virtual void setCustomTag(const RTI::VariableLengthData& a_tag);
00134    virtual void setTag(const RTI::VariableLengthData& tag);
00136    virtual const RTI::VariableLengthData &tag() const;  
00137 #else
00138 
00139    virtual void setCustomTag(const DtString& a_tag);
00141    virtual void setTag(const DtString& tag);
00143    virtual const DtString& tag() const;  
00144 #endif
00145 
00146 
00147 #if DtHLA_1516
00148    virtual const std::set<DtDDMRegion>* region() const;
00149    virtual void setRegion(const std::set<DtDDMRegion>& region);
00150 #else
00151    virtual const DtDDMRegion* region() const;
00152    virtual DtDDMRegion* region();
00153    virtual void setRegion(const DtDDMRegion& region);
00154 #endif
00155 
00156 #if DtHLA_1516_EVOLVED
00157    virtual const DtString& producingFederate() const;
00158    virtual void setProducingFederate(const DtString& fedName);
00159 #endif
00160 
00161 
00165    virtual void setTimeStamp(DtTime time, 
00166                              DtTimeStampType type = DtTimeStampRelative);
00167 
00170    virtual DtTime timeStamp() const;    
00171 
00173    virtual DtTimeStampType timeStampType() const;
00174 
00179    virtual DtTime guessTimeValid(DtTime referenceTime) const;
00180 
00185 #if DtHLA_1516
00186    virtual void setFedTime(const RTI::LogicalTime &ft);
00187 #else
00188    virtual void setFedTime(const RTI::FedTime &ft);
00189 #endif
00190 
00194 #if DtHLA_1516
00195    virtual const RTI::LogicalTime *fedTime() const;
00196 #else
00197    virtual const RTI::FedTime *fedTime() const;
00198 #endif
00199 
00200 #if DtHLA_1516
00201 
00202 
00203    virtual void setMessageRetractionHandle(const RTI::MessageRetractionHandle &handle);
00204 
00206    virtual RTI::MessageRetractionHandle messageRetractionHandle() const;
00207   
00208 #else
00209 
00210 
00211    virtual void setEventRetractionHandle(const RTI::EventRetractionHandle &handle);
00212 
00214    virtual RTI::EventRetractionHandle eventRetractionHandle() const;
00215 #endif
00216 
00217 
00218 public:
00219 
00223    static void setTagIsAsciiTime(bool val);
00224    static bool tagIsAsciiTime();
00225   
00228    static void addCallback(DtExerciseConn* conn,
00229       const DtList* classes, DtReceiveInteractionCb cb, void* usr,
00230       DtDDMRegionSP region = DtDDMRegionSP());
00231    static void removeCallback(DtExerciseConn* conn,
00232       const DtList* classes, DtReceiveInteractionCb cb, void* usr,
00233       DtDDMRegionSP region = DtDDMRegionSP());
00234 
00236    static void addCallback(DtExerciseConn* conn,
00237       const char* className, DtReceiveInteractionCb cb, void* usr,
00238       DtDDMRegionSP region = DtDDMRegionSP());
00239    static void removeCallback(DtExerciseConn* conn,
00240       const char* className, DtReceiveInteractionCb cb, void* usr,
00241       DtDDMRegionSP region = DtDDMRegionSP());
00242 
00243 protected:
00244 
00247    virtual char* interactionClassToUse(
00248       DtExerciseConn* exConn) const;
00249 
00253 #if DtHLA_1516
00254    virtual RTI::ParameterHandleValueMap &privPvList() const;
00255 #else
00256    virtual RTI::ParameterHandleValuePairSet* privPvList() const;
00257 #endif
00258 
00266    DtInteraction* self() const;
00267 
00268 protected:
00269 
00270    DtInterClassDesc* myClassDesc;
00271    DtExerciseConn* myExConn;
00272    DtTime myTime;
00273    DtTimeStampType myTimeType;
00274 
00275 #if DtHLA_1516
00276    RTI::LogicalTime *myFedTime;
00277    RTI::ParameterHandleValueMap myPvList;
00278    RTI::MessageRetractionHandle  myRetractionHandle;
00279    RTI::VariableLengthData myTag;
00280    std::set<DtDDMRegion>* myRegion;
00281    #if DtHLA_1516_EVOLVED
00282       DtString myProducingFederate;
00283    #endif
00284 #else
00285    DtString myTag;
00286    RTI::ParameterHandleValuePairSet* myPvList;
00287    int myPvListMaxSize;
00288    RTI::FedTime *myFedTime;
00289    RTI::EventRetractionHandle myRetractionHandle;
00290    DtDDMRegion* myRegion;
00291 #endif
00292 
00293    bool myCustomTagSet;
00294 
00295 
00296 protected:
00297 
00298    static bool theTagIsAsciiTime;
00299 };
00300 
00301 DT_DLL_VL std::ostream & operator << (std::ostream &str, const DtInteraction &inter);
00302 
00303 #include "intClassDesc.h"
00304 
00305 inline RTI::InteractionClassHandle
00306    DtInteraction::interactionClassHandle() const
00307 {
00308    return myClassDesc->handle();
00309 }
00310 
00311 inline char* DtInteraction::interactionClassName() const
00312 {
00313    return (char*) (myClassDesc ? myClassDesc->name() : 0);
00314 }
00315 
00316 inline int DtInteraction::numParameters() const
00317 {
00318    return myClassDesc ? myClassDesc->numParameters() : 0;
00319 }
00320 
00321 inline DtInteraction* DtInteraction::self() const
00322 {
00323    return (DtInteraction*) this;
00324 }
00325 
00326 inline DtExerciseConn* DtInteraction::exerciseConn() const
00327 {
00328    return myExConn;
00329 }
00330 
00331 inline DtInterClassDesc* DtInteraction::classDesc() const
00332 {
00333    return myClassDesc;
00334 }
00335 
00336 inline void DtInteraction::printData() const
00337 {
00338 }
00339 
00340 inline void DtInteraction::printDataToString(DtString& buff) const
00341 {
00342 }
00343 
00344 inline void DtInteraction::printDataToStream(std::ostream& stream) const
00345 {
00346 }
00347 
00348 #if DtHLA_1516
00349 inline void DtInteraction::setMessageRetractionHandle(
00350    const RTI::MessageRetractionHandle &handle)
00351 {
00352    myRetractionHandle = handle;
00353 }
00354 
00355 inline RTI::MessageRetractionHandle DtInteraction::messageRetractionHandle() const
00356 {
00357    return myRetractionHandle;
00358 }
00359 
00360 #else
00361 inline void DtInteraction::setEventRetractionHandle(
00362    const RTI::EventRetractionHandle &handle)
00363 {
00364    myRetractionHandle = handle;
00365 }
00366 
00367 inline RTI::EventRetractionHandle DtInteraction::eventRetractionHandle() const
00368 {
00369    return myRetractionHandle;
00370 }
00371 #endif
00372 
00373 #endif
00374 #endif
00375  
00376 

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)