VR-Engage  2.2
Loading...
Searching...
No Matches
cigiData.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
7//! @file cigiData.h
8//!
9//! CigiData classes are used by CigiObjectBase classes to manage their CIGI
10//! packet class instances.
11
12#include "vreCigiHost/export.h"
13
14#include "vreUtil/baseClass.h"
15
16namespace makVre
17{
19
20
21//! @brief Base CigiData class used by DtCigiDataTemplate.
22//!
23//! This base class does not itself contain any CIGI packet type.
24class CIGIHOST_DLL DtCigiDataBase : public DtSpSubClass<DtCigiDataBase>
25{
26public:
28 : myFrame(0)
29 {
30 }
31 virtual ~DtCigiDataBase() override {}
32
33 virtual unsigned int frame() const;
34 virtual void setFrame(unsigned int frame);
35
37
38protected:
39 unsigned int myFrame;
40};
41
42//! @brief Template used to compose a CigiData class for a specific CIGI type.
43//!
44//! DtCigiDataTemplate does not generally need to be used directly by developers
45//! writing CigiPublisher-derived classes, as this is handled automatically
46//! by DtCigiPublisherTemplate and DtCigiListenerTemplate.
47//!
48//! @tparam CIGI_T should be a specific CIGI packet class type from the CIGI SDK.
49//! @tparam FRIEND_T should be the CigiPublisher or CigiListener-derived class which
50//! will manage this CigiData object.
51template <class CIGI_T, class FRIEND_T>
52class DtCigiDataTemplate : public DtSpSubClass<DtCigiDataTemplate<CIGI_T, FRIEND_T>, DtCigiDataBase>, public CIGI_T
53{
54public:
56 virtual ~DtCigiDataTemplate() override {}
57
58 friend FRIEND_T;
59};
60
61//! @brief Stub base class used as default DATA_CREATOR_T in
62//! DtCigiPublisherTemplate and DtCigiListenerTemplate.
63//!
64//! This base CigiDataCreator does not instantiate a CigiData object.
65//! This is needed to allow the declaration of Publisher and Listener
66//! base classes which use CigiData objects of base CIGI types which
67//! are pure-virutal and cannot be instantiated.
68//!
69//! Example: DtCigiEntityPublisherBase, which uses a CIGI type of
70//! CigiBaseEntityCtrl, which is a pure-virtual abstract class.
72
73 template <class BASE_T, class CREATE_T>
74 BASE_T *
75 create(){return nullptr;
76} // namespace makVre
77}
78;
79
80//! @brief CigiDataCreator class used by concrete Publisher and
81//! Listener classes for which their CigiData CIGI types can be
82//! instantiated.
83//!
84//! DtCigiDataCreator must be used as the final type argument to a
85//! Publisher or Listener template to override the default Stub.
87{
88public:
90 virtual ~DtCigiDataCreator() override {}
91
92 template <class BASE_T, class CREATE_T>
93 BASE_T* create()
94 {
95 static DtCreator<BASE_T, CREATE_T> creator;
96 return creator.create();
97 }
98};
99
100} // namespace makVre
Provides base classes for shared pointer managed objects with factory creation support.
virtual ~DtCigiDataBase() override
Definition cigiData.h:31
friend DtCigiObjectBase
Definition cigiData.h:36
DtCigiDataBase()
Definition cigiData.h:27
virtual void setFrame(unsigned int frame)
virtual unsigned int frame() const
unsigned int myFrame
Definition cigiData.h:39
virtual ~DtCigiDataCreator() override
Definition cigiData.h:90
DtCigiDataCreator()
Definition cigiData.h:89
BASE_T * create()
Definition cigiData.h:93
BASE_T * create()
Definition cigiData.h:75
DtCigiDataCreatorStub()
Definition cigiData.h:71
friend FRIEND_T
Definition cigiData.h:58
DtCigiDataTemplate()
Definition cigiData.h:55
virtual ~DtCigiDataTemplate() override
Definition cigiData.h:56
Definition cigiObjectBase.h:23
Concrete creator class for objects with a default constructor.
Definition factory.h:53
virtual CREATE_T * create() override
Creates a new instance of CREATE_T.
Definition factory.h:64
DtSpSubClass()
Definition baseClass.h:190
Contains the DLL export macro.
#define CIGIHOST_DLL
Definition export.h:20
Include export definitions for this library.
Definition glsVreMessageUtil.h:49