VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vrfEntityPublisher.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2017 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
14 #include <vl/dataInteraction.h>
15 #include <vl/entityPublisher.h>
16 
17 #ifdef DtDIS
18 # include <vl/diGuyCustomPduEncoder.h>
19 #endif
20 
21 #ifdef DtDIS
22 typedef DtEntityStateEncoder DtEntPublisherEncoder;
23 typedef DtEntityStateDecoder DtEntPublisherDecoder;
24 #elif DtHLA
27 #endif
28 
30 class DtEntityType;
31 class DtBaseEntityStateRepository;
32 class DtSimulationAddress;
34 
50 {
51 
52 public:
60  const DtEntityType& type,
61  DtExerciseConn* conn,
62 #if DtHLA
63  const DtGlobalObjectDesignator& glId = DtGlobalObjectDesignator::nullId(),
64 #endif
65  const DtEntityIdentifier& entId = DtEntityIdentifier::nullId());
66 
68  virtual ~DtVrfEntityPublisher();
69 
70 public:
79  virtual void tick();
80 
83  virtual DtExtEntityStateRepository* entityProcessStateRep();
84  virtual DtExtEntityStateRepository* entityStateRep();
85 
87  virtual DtExtEntityStateRepository* ensr();
88 
89 #ifdef DtHLA
90 
91 
92 
93  virtual DtEntPublisherDecoder* decoder();
94 
97  virtual DtEntPublisherEncoder* encoder();
98 #endif
99 
100  virtual void setPublishesDiGuyInfo(bool has);
101  virtual bool publishesDiGuyInfo();
102 
103 #ifdef DtDIS
104 
105  virtual void setSendDiGuyPdus(bool yesNo);
106 
108  virtual bool sendDiGuyPdus() const;
109 
111  virtual void createAndSendDiGuyPdus();
112 #endif
113 
116  {
117  return myPublisher->sr();
118  }
119 
120 #if DtHLA
121  const DtString& name() const
122  {
123  return myPublisher->name();
124  }
125 #endif
126 
128  virtual const DtObjectId& id() const;
129 
131  virtual const DtObjectId& localId() const;
132 
134  virtual const DtGlobalObjectDesignator& globalId() const;
135 
138  virtual void forceUpdate();
139 
141  virtual bool sendVrfObjectData();
142 
144  virtual DtEntityPublisher* entityPublisher();
145 
148  virtual void setSendVrfObjectDataRecord(bool shouldSend);
149 
150 public:
151  // Sets the time to update the vrf data message. The message will
152  // be sent on this time (default is five seconds) or if the data
153  // as seen by remote is different that the current time. If time
154  // is set to be -1, it will only be sent if the data is different
155  static void setVrfDataTimeThreshold(DtTime time);
156  static DtTime vrfDataTimeThreshold();
157 
158 private:
161  DtVrfEntityPublisher& operator=(const DtVrfEntityPublisher&);
162 
163 protected:
164 
170 
172  void initialize(const DtEntityType& type, DtExerciseConn* conn,
173 #if DtHLA
174  const DtGlobalObjectDesignator& glId,
175 #endif
176  const DtEntityIdentifier& entId);
177 
179  virtual bool sendVrfDataUpdate();
180 
184  virtual bool needsVrfObjectDataUpdate();
185 
190  virtual bool sendMessage(const DtSimulationAddress& receiver,
191  DtSimInterfaceContent* message);
193  virtual bool setContentForNet(DtDataInteraction* dataInter,
194  DtSimInterfaceContent* content) const;
196  virtual void sendMessageInteraction(const DtSimulationAddress& receiver,
197  DtDataInteraction& data);
198 
199 protected:
200 
203  static void dataInteractionCallback(DtDataInteraction* i, void* usr);
204 
207  virtual void processSendVrfObjectDataMessage(DtDataInteraction* interaction);
208 
209 public:
210 
212  virtual void processDataInteraction(DtDataInteraction* i);
213 
214 protected:
215 
216  DtEntityPublisher* myPublisher;
217 
218  // For heartbeating for DtIfVrfObjectData messages
221  bool myPublishesDIGuyInfo; // true if there is DI-Guy info to be published
222 
223  static bool myDiGuyEncodersSetup;
224 
225 };

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)