VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
extendedAttributeEncoderHLA.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #if DtHLA
12 
13 #include <vlutil/vlString.h>
14 #include <vl/fom.h>
15 #include <vl/objClassDesc.h>
16 #include <vl/hlaStateEncoder.h>
18 
19 namespace makVrfVrlinkExtToolkit
20 {
21  template <typename StateRepType>
23  {
24  public:
25 
29  static void encodeExtendedAttribute(const StateRepType& rep,
30  RTI::AttributeHandleValuePairSet* attrs,
31  RTI::AttributeHandle attrHandle)
32  {
33  const StateRepType* extSR = static_cast<const StateRepType*>(&rep);
34  unsigned srLength = 0;
35  const char* srValue = extSR->getAttributeByHandle(attrHandle, srLength);
36  attrs->add(attrHandle, (char*)srValue, srLength);
37  }
38 
41  static bool needExtendedAttribute(const DtStateRepository& stateRep,
42  const DtStateRepository& asSeenByRemote,
43  RTI::AttributeHandle attrHandle)
44  {
45  const StateRepType* extSR = static_cast<const StateRepType*>(&stateRep);
46  const StateRepType* extASBR = static_cast<const StateRepType*>(&asSeenByRemote);
47 
48  unsigned srLength = 0;
49  unsigned asbrLength = 0;
50  const char* srValue = extSR->getAttributeByHandle(attrHandle, srLength);
51  const char* asbrValue = extASBR->getAttributeByHandle(attrHandle, asbrLength);
52 
53  return (srLength != asbrLength ||
54  memcmp(srValue, asbrValue, srLength) != 0);
55  }
56 
57  };
58 }
59 
60 
61 #endif

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)