VR-Link API Documentation for HLA Evolved
dEntityPub.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *********************************************************************/
00005 #pragma once
00006 
00009 #if DtDIS
00010 
00011 
00012 #include "dObjPub.h"
00013 #include "entitySR.h"
00014 #include "dEntityEnc.h"
00015 #include "dEntityDec.h"
00016 #include "objectId.h"
00017 
00023 class DT_DLL_VL DtEntityPublisher : public DtObjectPublisher
00024 {        
00025 public:
00026 
00027    //g++ forces us to define this function before we define
00028    //our constructors
00029    static const DtEntityType& guiseSameAsType();
00030 
00031 public:
00032 
00034    typedef DtEntityStateRepository* (*DtStateRepCreator)();
00035 
00036 public:
00037 
00038 
00047    DtEntityPublisher(
00048       DtEntityStateRepository *stateRepToUse,
00049       DtExerciseConn* conn,
00050       const DtObjectId& id = DtObjectId::defaultId());
00051 
00060    DtEntityPublisher(
00061       DtExerciseConn* conn,
00062       const DtObjectId& id = DtObjectId::defaultId());
00063 
00072    DtEntityPublisher(
00073       const DtEntityType& type,
00074       DtExerciseConn* conn,
00075       const DtObjectId& id = DtObjectId::defaultId());
00076 
00085    DtEntityPublisher(
00086       const DtEntityType& type,
00087       DtExerciseConn* conn,
00088       DtDeadReckonTypes algorithm,
00089       DtForceType forceId,
00090       const DtEntityType& guise = guiseSameAsType(),
00091       const DtObjectId& id = DtObjectId::defaultId());
00092 
00094    virtual ~DtEntityPublisher();
00095 
00096 private:
00097 
00099    DtEntityPublisher(const DtEntityPublisher& orig);
00100 
00102    DtEntityPublisher& operator=(const DtEntityPublisher& orig);
00103 
00104 public:
00108    virtual void tick();
00109 
00112    virtual DtEntityStateRepository* entityStateRep();
00113 
00115    virtual DtEntityStateRepository* esr();
00116 
00120    virtual DtEntityStateDecoder* decoder();
00121 
00124    virtual DtEntityStateEncoder* encoder();
00125 
00127    virtual const DtObjectId& id() const;
00128 
00130    virtual const DtObjectId& localId() const;
00131    
00133    virtual const DtGlobalObjectDesignator& globalId() const;
00134 
00138    virtual void sendFinalPduOnDestruction(bool on);
00139 
00142    virtual void forceUpdate();
00143 
00145    virtual void setSendDiGuyPdus(bool yesNo);
00146 
00148    virtual bool sendDiGuyPdus() const;
00149 
00151    virtual void setSendSeesPdus(bool yesNo);
00152 
00154    virtual bool sendSeesPdus() const;
00155 
00157    virtual void setSeesTimeThreshold(DtTime time);
00158 
00160    virtual DtTime seesTimeThreshold() const;
00161 
00162 
00163 public:
00164 
00166    static void setStateRepCreator(DtStateRepCreator creator);
00167    static DtStateRepCreator stateRepCreator(void);
00168 
00169    static void setClassDfltTimeThreshold(DtTime threshold);
00170    
00172 
00173    static void setDfltRotationThreshold(double r);
00174    static double dfltRotationThreshold();
00175    static void setDfltTranslationThreshold(double t);
00176    static double dfltTranslationThreshold();
00178 
00179 protected:
00180    
00182    void sendFinalPdu();
00183 
00185    virtual void createAndSendDiGuyPdus();
00186 
00188    virtual void createAndSendSeesPdu();
00189 
00190    virtual bool sendSeesNeeded() const;
00191 
00193    void init( const DtObjectId& vehId);
00194 
00195 protected:
00196    DtObjectId            myId;
00197    DtEntityStateDecoder* myEntityDecoder;
00198    DtEntityStateEncoder* myEntityEncoder;
00199    bool                  mySendFinalInDtor;
00200    bool                  mySendDiGuyPdus;
00201    bool                  mySendSeesPdus;
00202    DtTime                mySeesPdusTimeThreshold;
00203    DtTime                myLastSeesPdusUpdate;
00204 
00205 protected:
00206    static DtStateRepCreator theStateRepCreator;
00207    static DtTime            theClassDfltTimeThreshold;
00208    static bool              theClassDfltIsSetFlag;
00209 };
00210 
00211 inline DtEntityStateRepository* DtEntityPublisher::entityStateRep()
00212 {
00213    return esr();
00214 }
00215 
00216 inline DtEntityStateRepository* DtEntityPublisher::esr()
00217 {
00218    return (DtEntityStateRepository*) stateRep();
00219 }
00220 
00221 inline DtEntityStateEncoder* DtEntityPublisher::encoder()
00222 {
00223    return myEntityEncoder;
00224 }
00225 
00226 inline DtEntityStateDecoder* DtEntityPublisher::decoder()
00227 {
00228    return myEntityDecoder;
00229 }
00230 
00231 inline void DtEntityPublisher::sendFinalPduOnDestruction(bool onOff)
00232 {
00233    mySendFinalInDtor = onOff;
00234 }
00235 
00236 inline const DtObjectId& DtEntityPublisher::id() const
00237 {
00238    return myId;
00239 }
00240 
00241 inline double DtEntityPublisher::dfltRotationThreshold()
00242 {
00243    return DtThresholder::dfltRotationThreshold();
00244 }
00245 
00246 inline double DtEntityPublisher::dfltTranslationThreshold()
00247 {
00248    return DtThresholder::dfltTranslationThreshold();
00249 }
00250 
00251 inline void DtEntityPublisher::setDfltTranslationThreshold(double t)
00252 {   
00253    DtThresholder::setDfltTranslationThreshold(t);
00254 }
00255 
00256 inline void DtEntityPublisher::setDfltRotationThreshold(double r)
00257 {
00258    DtThresholder::setDfltRotationThreshold(r);
00259 }
00260 
00261 inline const DtObjectId& DtEntityPublisher::localId() const
00262 {
00263    return id();
00264 }
00265 
00266 
00267 
00268 #endif //! DtDIS
00269 
00270 

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)