VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtCigiPublisherBase Class Referenceabstract

Detailed Description

Publishers manage updating CIGI data, tracking dirty state, and writing to CigiOutgoingMsg when values have changed. Publishers can be parented to other Publishers, and parent Publishers init, tick, and publish their children.

#include <cigiPublisherBase.h>

Inheritance diagram for makVre::DtCigiPublisherBase:
[legend]

Public Member Functions

 DtCigiPublisherBase ()
 
virtual ~DtCigiPublisherBase () override
 
DtCigiDataBaseshared ()
 
DtCigiDataBase *const shared () const
 
virtual bool init () override
 
virtual void setEnabled (bool enabled)
 
virtual bool enabled () const
 
virtual void tick (double dt)
 
template<class CHILD_T>
std::shared_ptr< CHILD_T > addNewChild (const std::string &name="")
 
virtual bool addChild (Sptr child) override
 
virtual void publish (CigiOutgoingMsg &out)
 
virtual void setNeedsReceiptConfirmation (bool needs)
 
virtual bool needsReceiptConfirmation () const
 
virtual void receiptConfirmed ()
 
virtual double lastSent ()
 
virtual void markDirty (bool childrenToo=false)
 
virtual void markClean (bool childrenToo=false)
 
- Public Member Functions inherited from makVre::DtSpSubClass< DtCigiPublisherBase, DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase > >
 DtSpSubClass ()
 
virtual ~DtSpSubClass ()
 
Sptr self ()
 
std::string type () const override
 
- Public Member Functions inherited from makVre::DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase >
 DtTreeClass ()
 
virtual ~DtTreeClass () override
 
virtual void setOwnsChildren (bool owns)
 
virtual bool ownsChildren ()
 
virtual bool removeChild (Sptr child)
 
virtual void removeAllChildren ()
 
virtual bool forEachChild (ForChildFn fn)
 
virtual Sptr findChild (FindChildFn fn)
 
virtual Sptr findChild (const std::string &name)
 
virtual bool isChild (Sptr child)
 
virtual unsigned int numChildren ()
 
virtual bool hasChildren ()
 
virtual Sptr parent ()
 
- Public Member Functions inherited from makVre::DtSpSubClass< DtCigiPublisherBase, DtCigiObjectBase >
 DtSpSubClass ()
 
Sptr self ()
 
- Public Member Functions inherited from makVre::DtCigiObjectBase
 DtCigiObjectBase ()
 
virtual ~DtCigiObjectBase () override
 
CigiDatacigi ()
 
CigiData *const cigi () const
 
virtual Cigi_uint16 cigiType ()
 
virtual Sptr setSession (DtCigiSession &session)
 
virtual DtCigiSessionsession () const
 
virtual unsigned int sessionVersion () const
 
virtual void markDirty ()
 
virtual void markClean ()
 
virtual bool isDirty () const
 
- Public Member Functions inherited from makVre::DtSpSubClass< DtCigiObjectBase >
 DtSpSubClass ()
 
Sptr self ()
 
- Public Member Functions inherited from makVre::DtSpObject
 DtSpObject ()
 
virtual ~DtSpObject ()
 
Sptr self ()
 
virtual void setName (const std::string &name)
 
virtual std::string name () const
 

Protected Member Functions

virtual std::string sharedKey ()
 
virtual void setupShared ()
 
virtual bool verifySharedType ()=0
 
virtual void initShared ()
 
virtual void initCigi ()
 
virtual void updateShared ()
 
virtual void updateCigi ()
 
virtual void write (CigiOutgoingMsg &out)
 
virtual void createChildren ()
 
virtual void tickChildren (double dt)
 
virtual void publishChildren (CigiOutgoingMsg &out)
 
- Protected Member Functions inherited from makVre::DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase >
virtual void setParent (Sptr parent)
 
virtual void pruneChildren ()
 
- Protected Member Functions inherited from makVre::DtCigiObjectBase
virtual DtCigiDataBasecreateCigi ()=0
 
DtCigiDataBasecigiBase ()
 
DtCigiDataBase *const cigiBase () const
 
template<typename VALUE_T>
bool updateValue (VALUE_T *value, VALUE_T source)
 

Protected Attributes

CigiBasePtr mySharedData
 
bool myEnabled
 
bool myNeedsConfirmation
 
double myLastSentToIg
 
- Protected Attributes inherited from makVre::DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase >
OwnedChildList myOwnedChildren
 
UnownedChildList myUnownedChildren
 
ChildNameMap myChildrenByName
 
bool myOwnsChildren
 
Wptr myParent
 
- Protected Attributes inherited from makVre::DtCigiObjectBase
CigiBasePtr myCigiData
 
DtCigiSessionmySession
 
bool myDirty
 
- Protected Attributes inherited from makVre::DtSpObject
std::string myName
 

Additional Inherited Members

- Public Types inherited from makVre::DtSpSubClass< DtCigiPublisherBase, DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase > >
using Super
 
using Ptr
 
using Sptr
 
using Wptr
 
- Public Types inherited from makVre::DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase >
using Sptr
 
using ForChildFn
 
using FindChildFn
 
- Public Types inherited from makVre::DtSpSubClass< DtCigiPublisherBase, DtCigiObjectBase >
using Super
 
using Ptr
 
using Sptr
 
using Wptr
 
- Public Types inherited from makVre::DtCigiObjectBase
using Cigi = CigiBasePacket
 
using CigiData = DtCigiDataTemplate<CigiBasePacket, DtCigiObjectBase>
 
using CigiBasePtr = std::shared_ptr<DtCigiDataBase>
 
- Public Types inherited from makVre::DtSpSubClass< DtCigiObjectBase >
using Super
 
using Ptr
 
using Sptr
 
using Wptr
 
- Public Types inherited from makVre::DtSpObject
using Ptr = DtSpObject*
 
using Sptr = std::shared_ptr<DtSpObject>
 
using Wptr = std::weak_ptr<DtSpObject>
 
- Static Public Member Functions inherited from makVre::DtSpSubClass< DtCigiPublisherBase, DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase > >
static std::string Type ()
 
static std::shared_ptr< DtCigiPublisherBasecreate ()
 
static void registerCreator ()
 
static std::shared_ptr< DtCigiPublisherBasecreateVersion (unsigned int version)
 
static void registerCreatorVersion (unsigned int version)
 
- Static Public Member Functions inherited from makVre::DtSpSubClass< DtCigiPublisherBase, DtCigiObjectBase >
static std::string Type ()
 
static std::shared_ptr< DtCigiPublisherBasecreate ()
 
static void registerCreator ()
 
static std::shared_ptr< DtCigiPublisherBasecreateVersion (unsigned int version)
 
static void registerCreatorVersion (unsigned int version)
 
- Static Public Member Functions inherited from makVre::DtSpSubClass< DtCigiObjectBase >
static std::string Type ()
 
static std::shared_ptr< DtCigiObjectBasecreate ()
 
static void registerCreator ()
 
static std::shared_ptr< DtCigiObjectBasecreateVersion (unsigned int version)
 
static void registerCreatorVersion (unsigned int version)
 
- Static Public Member Functions inherited from makVre::DtSpObject
template<class AS_T>
static std::shared_ptr< AS_T > cast (Sptr p)
 
template<class AS_T>
static std::shared_ptr< AS_T > unsafe_cast (Sptr p)
 
- Protected Types inherited from makVre::DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase >
using Wptr
 
using OwnedChildList
 
using UnownedChildList
 
using ChildNameMap
 
- Static Protected Member Functions inherited from makVre::DtSpSubClass< DtCigiPublisherBase, DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase > >
static std::shared_ptr< DtBaseCreator< DtCigiPublisherBase > > & creator ()
 
static std::shared_ptr< DtBaseCreator< DtCigiPublisherBase > > & creatorVersion (unsigned int version)
 
- Static Protected Member Functions inherited from makVre::DtSpSubClass< DtCigiPublisherBase, DtCigiObjectBase >
static std::shared_ptr< DtBaseCreator< DtCigiPublisherBase > > & creator ()
 
static std::shared_ptr< DtBaseCreator< DtCigiPublisherBase > > & creatorVersion (unsigned int version)
 
- Static Protected Member Functions inherited from makVre::DtSpSubClass< DtCigiObjectBase >
static std::shared_ptr< DtBaseCreator< DtCigiObjectBase > > & creator ()
 
static std::shared_ptr< DtBaseCreator< DtCigiObjectBase > > & creatorVersion (unsigned int version)
 

Constructor & Destructor Documentation

◆ DtCigiPublisherBase()

makVre::DtCigiPublisherBase::DtCigiPublisherBase ( )

◆ ~DtCigiPublisherBase()

virtual makVre::DtCigiPublisherBase::~DtCigiPublisherBase ( )
inlineoverridevirtual

Member Function Documentation

◆ shared() [1/2]

DtCigiDataBase * makVre::DtCigiPublisherBase::shared ( )

Get pointer to shared CIGI packet data object.

Shared data allows Publishers in different Sessions publishing data for the same Sim entity to share common data which only needs to be updated once per Sim frame.

◆ shared() [2/2]

DtCigiDataBase *const makVre::DtCigiPublisherBase::shared ( ) const

◆ init()

◆ setEnabled()

virtual void makVre::DtCigiPublisherBase::setEnabled ( bool enabled)
virtual

Enable or disable this Publisher.

Tick and publish are suppressed when disabled.

References enabled().

◆ enabled()

virtual bool makVre::DtCigiPublisherBase::enabled ( ) const
virtual

Referenced by setEnabled().

◆ tick()

virtual void makVre::DtCigiPublisherBase::tick ( double dt)
virtual

◆ addNewChild()

template<class CHILD_T>
std::shared_ptr< CHILD_T > makVre::DtCigiPublisherBase::addNewChild ( const std::string & name = "")
inline

Convenience wrapper for creating, naming, and adding a child Publisher instance of type CHILD_T.

Returns
Shared pointer to new child Publisher object.

References addChild(), makVre::DtSpObject::name(), and makVre::DtCigiObjectBase::sessionVersion().

◆ addChild()

virtual bool makVre::DtCigiPublisherBase::addChild ( Sptr child)
overridevirtual

Adds publisher as child of this Publisher.

Child will be re-parented to this. Publishers may have only one parent.

Parameters
childPointer to Publisher to add as child.
Returns
Bool indicating success.

Reimplemented from makVre::DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase >.

Referenced by addNewChild().

◆ publish()

virtual void makVre::DtCigiPublisherBase::publish ( CigiOutgoingMsg & out)
virtual

Causes this Publisher to write CIGI packet data to out.

Invokes updateCigi() to make sure data is fresh and determine dirty state if not already dirty, then invokes write() to write data to CigiOutoingMsg if state is dirty.

Parameters
outCigiOutgoingMsg to write CIGI packet data into.

◆ setNeedsReceiptConfirmation()

virtual void makVre::DtCigiPublisherBase::setNeedsReceiptConfirmation ( bool needs)
virtual

Set/get whether this Publisher should get confirmation that IG has received the last frame where this Publisher wrote data during publish().

Set true when this publisher writes information that does not change often but should be delivered reliably. Publisher will be marked as dirty to force re-sending data if the frame containing the last write is not confimed to have been received by the IG.

◆ needsReceiptConfirmation()

virtual bool makVre::DtCigiPublisherBase::needsReceiptConfirmation ( ) const
virtual

◆ receiptConfirmed()

virtual void makVre::DtCigiPublisherBase::receiptConfirmed ( )
inlinevirtual

Called when the IG reports receiving the last frame in which this Pulisher wrote data during publish().

This function is only called if needsReceiptConfirmation() is true.

Reimplemented in makVre::DtCigiEntityUnpublisher, and makVre::DtCigiFxPublisher.

◆ lastSent()

virtual double makVre::DtCigiPublisherBase::lastSent ( )
virtual

Returns the time that last update was sent during publish(). (as cgf->simulationServices()->elapsedRealTime())

◆ markDirty()

virtual void makVre::DtCigiPublisherBase::markDirty ( bool childrenToo = false)
virtual

Explictly mark this publisher as dirty so that the data is guaranteed to be written during the next publish() call.

◆ markClean()

virtual void makVre::DtCigiPublisherBase::markClean ( bool childrenToo = false)
virtual

Clear the dirty flag.

Note that this does not suppress the normal update mechanism. If the data has changed since the last publish() call, then this Publisher will again be marked as dirty the next time the publish() invokes updateCigi().

◆ sharedKey()

virtual std::string makVre::DtCigiPublisherBase::sharedKey ( )
inlineprotectedvirtual

Key to uniquely idenfity the shared data instance associated with the Sim object represented by this Publisher.

No shared data will be created if sharedKey returns an empty string, which is the default behavior if not overridden by the derived Publisher class. Derived Publishers should override this function and return a suitable key if they will be using shared data.

Reimplemented in makVre::DtCigiSimEntityArtPartPublisher, makVre::DtCigiSimEntityComponentPublisherBase, and makVre::DtCigiSimObjectPublisherBase.

◆ setupShared()

virtual void makVre::DtCigiPublisherBase::setupShared ( )
protectedvirtual

◆ verifySharedType()

virtual bool makVre::DtCigiPublisherBase::verifySharedType ( )
protectedpure virtual

Implemented in makVre::DtCigiPublisherGroup, makVre::DtCigiPublisherTemplate< CIGI_T, SELF_T, SUPER_T, DATA_CREATOR_T >, makVre::DtCigiPublisherTemplate< CigiArtPartCtrlV4, DtCigiSimEntityArtPartPublisherV4, DtCigiSimEntityArtPartPublisher, DtCigiDataCreator >, makVre::DtCigiPublisherTemplate< CigiBaseArtPartCtrl, DtCigiSimEntityArtPartPublisher, DtCigiSimEntityComponentPublisherBase >, makVre::DtCigiPublisherTemplate< CigiBaseEntityCtrl, DtCigiEntityPublisherBase >, makVre::DtCigiPublisherTemplate< CigiBaseEntityCtrl, DtCigiEntityUnpublisher >, makVre::DtCigiPublisherTemplate< CigiBaseEntityCtrl, DtCigiFxPublisher, DtCigiEntityPublisherBase >, makVre::DtCigiPublisherTemplate< CigiBaseEntityCtrl, DtCigiSimEntityPublisher, DtCigiSimObjectPublisherBase >, makVre::DtCigiPublisherTemplate< CigiBaseEntityPositionCtrl, DtCigiFxPositionPublisher >, makVre::DtCigiPublisherTemplate< CigiBaseEntityPositionCtrl, DtCigiSimEntityPositionPublisher, DtCigiSimEntityComponentPublisherBase >, makVre::DtCigiPublisherTemplate< CigiBaseEnvCtrl, DtCigiTimePublisher, DtCigiPublisherBase >, makVre::DtCigiPublisherTemplate< CigiBaseIGCtrl, DtCigiIgControlPublisher >, makVre::DtCigiPublisherTemplate< CigiBaseRateCtrl, DtCigiFxVelocityPublisher >, makVre::DtCigiPublisherTemplate< CigiBaseRateCtrl, DtCigiSimEntityVelocityPublisher, DtCigiSimEntityComponentPublisherBase >, makVre::DtCigiPublisherTemplate< CigiBaseViewCtrl, DtCigiViewControlPublisher >, makVre::DtCigiPublisherTemplate< CigiBaseViewDef, DtCigiViewDefinitionPublisher >, makVre::DtCigiPublisherTemplate< CigiCelestialCtrlV4, DtCigiTimePublisherV4, DtCigiTimePublisher, DtCigiDataCreator >, makVre::DtCigiPublisherTemplate< CigiEntityCtrlV4, DtCigiEntityUnpublisherV4, DtCigiEntityUnpublisher, DtCigiDataCreator >, makVre::DtCigiPublisherTemplate< CigiEntityCtrlV4, DtCigiFxPublisherV4, DtCigiFxPublisher, DtCigiDataCreator >, makVre::DtCigiPublisherTemplate< CigiEntityCtrlV4, DtCigiSimEntityPublisherV4, DtCigiSimEntityPublisher, DtCigiDataCreator >, makVre::DtCigiPublisherTemplate< CigiEntityPositionCtrlV4, DtCigiFxPositionPublisherV4, DtCigiFxPositionPublisher, DtCigiDataCreator >, makVre::DtCigiPublisherTemplate< CigiEntityPositionCtrlV4, DtCigiSimEntityPositionPublisherV4, DtCigiSimEntityPositionPublisher, DtCigiDataCreator >, makVre::DtCigiPublisherTemplate< CigiIGCtrlV4, DtCigiIgControlPublisherV4, DtCigiIgControlPublisher, DtCigiDataCreator >, makVre::DtCigiPublisherTemplate< CigiVelocityCtrlV4, DtCigiFxVelocityPublisherV4, DtCigiFxVelocityPublisher, DtCigiDataCreator >, makVre::DtCigiPublisherTemplate< CigiVelocityCtrlV4, DtCigiSimEntityVelocityPublisherV4, DtCigiSimEntityVelocityPublisher, DtCigiDataCreator >, makVre::DtCigiPublisherTemplate< CigiViewCtrlV4, DtCigiViewControlPublisherV4, DtCigiViewControlPublisher, DtCigiDataCreator >, and makVre::DtCigiPublisherTemplate< CigiViewDefV4, DtCigiViewDefinitionPublisherV4, DtCigiViewDefinitionPublisher, DtCigiDataCreator >.

◆ initShared()

virtual void makVre::DtCigiPublisherBase::initShared ( )
inlineprotectedvirtual

Derived Publisher classes should override initShared() to set inital values in the shared CIGI data object.

Reimplemented in makVre::DtCigiSimEntityArtPartPublisher, makVre::DtCigiSimEntityPublisherV4, and makVre::DtCigiSimEntityVelocityPublisherV4.

◆ initCigi()

◆ updateShared()

virtual void makVre::DtCigiPublisherBase::updateShared ( )
inlineprotectedvirtual

Derived Publisher classes should override updateShared() to update values in the shared CIGI data object.

updateShared() is called only by the first Publisher for each shared data instance to publish() during each Host frame.

Reimplemented in makVre::DtCigiSimEntityArtPartPublisher, makVre::DtCigiSimEntityPositionPublisher, makVre::DtCigiSimEntityPublisherV4, and makVre::DtCigiSimEntityVelocityPublisher.

◆ updateCigi()

virtual void makVre::DtCigiPublisherBase::updateCigi ( )
inlineprotectedvirtual

Derived Publisher classes should override updateCigi() to update values in the CIGI data.

If shared data is used, the expected pattern is to copy values from shared data into CIGI data at this point. updateShared() is called, if necessary, before updateCigi() so that shared data contains the most recent object state.

updateCigi() is called during publish(), before write(). updateCigi() is expected to set the dirty flag true if there are changes to the CIGI data. write() will be called only if this Publisher is marked dirty.

Reimplemented in makVre::DtCigiIgControlPublisher, makVre::DtCigiIgControlPublisherV4, makVre::DtCigiSimEntityArtPartPublisher, makVre::DtCigiSimEntityPositionPublisher, makVre::DtCigiSimEntityPublisherV4, makVre::DtCigiSimEntityVelocityPublisher, makVre::DtCigiTimePublisher, and makVre::DtCigiViewControlPublisher.

◆ write()

virtual void makVre::DtCigiPublisherBase::write ( CigiOutgoingMsg & out)
protectedvirtual

Internal class function invoked from publish if state is dirty. Packs CIGI data into CigiOutgoingMsg.

Reimplemented in makVre::DtCigiPublisherGroup.

◆ createChildren()

virtual void makVre::DtCigiPublisherBase::createChildren ( )
inlineprotectedvirtual

Derived Publisher classes should override createChildre() to create child Publishers, if necessary.

createChildren() is called during init().

Reimplemented in makVre::DtCigiFxPublisher, makVre::DtCigiIgControlPublisher, and makVre::DtCigiSimEntityPublisher.

◆ tickChildren()

virtual void makVre::DtCigiPublisherBase::tickChildren ( double dt)
protectedvirtual

◆ publishChildren()

virtual void makVre::DtCigiPublisherBase::publishChildren ( CigiOutgoingMsg & out)
protectedvirtual

Member Data Documentation

◆ mySharedData

◆ myEnabled

bool makVre::DtCigiPublisherBase::myEnabled
protected

◆ myNeedsConfirmation

bool makVre::DtCigiPublisherBase::myNeedsConfirmation
protected

◆ myLastSentToIg

double makVre::DtCigiPublisherBase::myLastSentToIg
protected

The documentation for this class was generated from the following file: