VR-Engage  2.2
Loading...
Searching...
No Matches
cigiObjectBase.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2024 MAK Technologies, Inc.
3** All rights reserved.
4*******************************************************************************/
5#pragma once
6
9
10#include "vreUtil/baseClass.h"
11
12#include <CigiTypes.h>
13#include <CigiBasePacket.h>
14
15#include <memory>
16
17namespace makVre
18{
19class DtCigiSession;
20
21
22class CIGIHOST_DLL DtCigiObjectBase : public DtSpSubClass<DtCigiObjectBase>
23{
24public:
25 using Cigi = CigiBasePacket;
27 using CigiBasePtr = std::shared_ptr<DtCigiDataBase>;
28
30 virtual ~DtCigiObjectBase() override;
31
32 //! @brief Get pointer to CIGI packet data managed by this object.
34 CigiData* const cigi() const;
35
36 //! @brief Get the ID of the CigiData type.
37 //! @return cigi()->GetPacketID()
38 virtual Cigi_uint16 cigiType();
39
40 //! @brief Get/Set reference to the CigiSession to which this object belongs.
42 virtual DtCigiSession& session() const;
43
44 virtual bool init();
45
46 //! @brief Get CIGI protocol major version number for this Session.
47 virtual unsigned int sessionVersion() const;
48
49 //! @brief Dirty flag indicates whether this CIGI data has changed in this frame.
50 //!
51 //! Used by Publishers to determine when to write and send data to the IG.
52 virtual void markDirty();
53 virtual void markClean();
54 virtual bool isDirty() const;
55
56protected:
57 virtual DtCigiDataBase* createCigi() = 0;
58
60 DtCigiDataBase* const cigiBase() const;
61
62 //! Utility function to update value from source and note
63 //! if the value changed.
64 template <typename VALUE_T>
65 bool updateValue(VALUE_T* value, VALUE_T source)
66 {
67 if (*value != source)
68 {
69 *value = source;
70 markDirty();
71 return true;
72 }
73 return false;
74 }
75
76protected:
78
80 bool myDirty;
81};
82
83} // namespace makVre
Provides base classes for shared pointer managed objects with factory creation support.
CigiData classes are used by CigiObjectBase classes to manage their CIGI packet class instances.
Base CigiData class used by DtCigiDataTemplate.
Definition cigiData.h:25
Template used to compose a CigiData class for a specific CIGI type.
Definition cigiData.h:53
std::shared_ptr< DtCigiDataBase > CigiBasePtr
Definition cigiObjectBase.h:27
DtCigiSession * mySession
Definition cigiObjectBase.h:79
virtual DtCigiDataBase * createCigi()=0
virtual ~DtCigiObjectBase() override
CigiData *const cigi() const
bool myDirty
Definition cigiObjectBase.h:80
virtual DtCigiSession & session() const
virtual void markDirty()
Dirty flag indicates whether this CIGI data has changed in this frame.
CigiData * cigi()
Get pointer to CIGI packet data managed by this object.
virtual unsigned int sessionVersion() const
Get CIGI protocol major version number for this Session.
DtCigiDataBase *const cigiBase() const
bool updateValue(VALUE_T *value, VALUE_T source)
Utility function to update value from source and note if the value changed.
Definition cigiObjectBase.h:65
virtual bool isDirty() const
CigiBasePtr myCigiData
Definition cigiObjectBase.h:77
DtCigiDataBase * cigiBase()
virtual void markClean()
virtual Cigi_uint16 cigiType()
Get the ID of the CigiData type.
DtCigiDataTemplate< CigiBasePacket, DtCigiObjectBase > CigiData
Definition cigiObjectBase.h:26
CigiBasePacket Cigi
Definition cigiObjectBase.h:25
virtual Sptr setSession(DtCigiSession &session)
Get/Set reference to the CigiSession to which this object belongs.
Definition cigiSession.h:38
DtSpSubClass()
Definition baseClass.h:190
std::shared_ptr< DtCigiObjectBase > Sptr
Definition baseClass.h:184
Contains the DLL export macro.
#define CIGIHOST_DLL
Definition export.h:20
Include export definitions for this library.
Definition glsVreMessageUtil.h:49