VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
localExtendedPropertiesNetInterface.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 
15 #include <vrfobjcore/vrfObject.h>
17 #include <vrfcore/simManager.h>
22 #include <vl/exerciseConn.h>
23 #include <vl/fom.h>
24 
25 #ifdef DtHLA
28 #else
30 #endif
31 
34 template <typename BaseNetInterface, typename StateRepository>
36 {
37 protected:
38 
42  , myIsUninitialized(true)
43  {
44  }
45 
46 public:
47 
50  DtVrfObject* vrfObject,
51  DtReaderWriterRegistry* parentRegistry = 0,
52  bool publishObject = true)
53  : BaseNetInterface(name, vrfObject, parentRegistry, publishObject)
54  , myIsUninitialized(true)
55  {
56  }
57 
61  DtReaderWriterRegistry * parentRegistry = 0)
62  : BaseNetInterface(orig)
63  , myIsUninitialized(true)
64  {
65  }
66 
68  const DtLocalExtendedPropertiesNetInterface & operator=(const
70  {
71  return static_cast<const DtLocalExtendedPropertiesNetInterface&>(
72  BaseNetInterface::operator=(orig));
73  }
74 
77  {
78  }
79 
81  virtual bool initExtendedProperties()
82  {
83  bool result = true;
84 
85  StateRepository* netWithProps = dynamic_cast<StateRepository*>(this->myNetworkState);
86 
87  DtVrfObjectStateRepository* localState = this->mySimObject->vrfState();
88 
89  if (netWithProps && localState)
90  {
91 #ifdef DtDIS
92  netWithProps->setSendVrfObjectDataRecord(false);
93 #else
94 
95 
96  RTI::ObjectClassHandle hdl = this->objectClassHandle();
97  netWithProps->setObjectClassHandle(hdl);
98 
100  this->mySimManager->exerciseConn()))
101  {
102  netWithProps->setSendVrfObjectDataRecord(false);
103  }
104  else
105  {
106  DtWarn << "Unable to publish VrfExtendedAttributes, using VRF object data messages instead." << std::endl;
107  }
108 #endif
109  }
110 
111  myIsUninitialized = false;
112 
113  return result;
114  }
115 
116 #if DtHLA
117 
118  virtual void onTick()
119  {
120  BaseNetInterface::onTick();
121  }
122 #endif
123 
126  virtual void updatePublisher()
127  {
128  if (myIsUninitialized)
129  {
130  initExtendedProperties();
131  }
132 
133  BaseNetInterface::updatePublisher();
134  }
135 
136  virtual void updateUuid()
137  {
138  DtVrfObjectStateRepository* localState = this->mySimObject->vrfState();
139  StateRepository* netWithProps = dynamic_cast<StateRepository*>(this->myNetworkState);
140 
141  if (localState && netWithProps && !netWithProps->shouldSendVrfObjectDataRecord())
142  {
143  netWithProps->setUuidString(this->vrfObject()->uuid().uuidString());
144  }
145  else
146  {
147  BaseNetInterface::updateUuid();
148  }
149  }
150 
151  static DtSimObjectNetInterface * creator(const DtString & name,
152  DtVrfObject* vrfObject,
153  DtReaderWriterRegistry* parentRegistry,
154  bool publishObject)
155  {
157  parentRegistry, publishObject);
158  }
159 
160 
161 protected:
162 
164 
165 };
166 

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)