VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
remoteExtendedPropertiesNetInterface.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 #ifdef DtHLA
14 
16 #include "vrfobjcore/vrfObject.h"
21 #include <vrfutil/readerWriter.h>
23 
26 template <typename BaseNetInterface, typename BaseStateRepository>
28 {
29 protected:
30 
33 
34 public:
35 
37 
40  DtVrfObject * simObject,
41  DtReaderWriterRegistry * parentRegistry = 0,
42  bool publishObject = true) : BaseNetInterface(name, simObject, parentRegistry, publishObject) {}
43 
47  DtReaderWriterRegistry * parentRegistry = 0) : BaseNetInterface(orig, parentRegistry) {}
48 
50  const DtRemoteExtendedPropertiesNetInterface & operator=(const
52  {
53  return static_cast<const DtRemoteExtendedPropertiesNetInterface &>(
54  BaseNetInterface::operator=(orig));
55  }
56 
59 
63  virtual void updateFromReflectedObject()
64  {
65  BaseNetInterface::updateFromReflectedObject();
66 
67  updatePropertyAttributesFromNet();
68  }
69 
71  virtual bool updatePropertyAttributesFromNet()
72  {
73 #ifdef DtHLA
74  DtVrfObjectStateRepository* localState = this->vrfObject()->vrfState();
76  dynamic_cast<DtExtendedPropertiesStateRepository*>(this->myNetworkState);
77 
78  if(localState && netWithProps)
79  {
80  std::vector<DtReaderWriterRegistryData *>::const_iterator iter =
81  localState->stateProperties().registry().registryData().begin();
82  std::vector<DtReaderWriterRegistryData *>::const_iterator endIter =
83  localState->stateProperties().registry().registryData().end();
84  for(; iter != endIter; ++iter)
85  {
86  unsigned size = 0;
87  const char* buffer = netWithProps->getAttributeByNameIfUpdated(
88  (*iter)->keyword().c_str(), size);
89  if(buffer && size > 0)
90  {
91  DtPropertyInterface* pFace = dynamic_cast<DtPropertyInterface*>((*iter)->readerWriter());
92 
93  if (pFace)
94  {
95  pFace->decode(buffer);
96  }
97  }
98  }
99 
100  iter = localState->parameterProperties().registry().registryData().begin();
101  endIter = localState->parameterProperties().registry().registryData().end();
102  for(; iter != endIter; ++iter)
103  {
104  unsigned size = 0;
105  const char* buffer = netWithProps->getAttributeByNameIfUpdated(
106  (*iter)->keyword().c_str(), size);
107  if(buffer && size > 0)
108  {
109  DtPropertyInterface* pFace = dynamic_cast<DtPropertyInterface*>((*iter)->readerWriter());
110 
111  if (pFace)
112  {
113  pFace->decode(buffer);
114  }
115  }
116  }
117  }
118 
119 #endif
120  return true;
121  }
122 
123  static DtSimObjectNetInterface * creator(const DtString & name,
124  DtVrfObject * simObject,
125  DtReaderWriterRegistry * parentRegistry,
126  bool publishObject)
127  {
128  return new
130  name, simObject, parentRegistry, publishObject);
131  }
132 
133 };
134 
135 #endif
136 

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)