VR-Forces 5.0.1 Developer's Guide
 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 = dynamic_cast<const StateRepType*>(&rep);
34 
35  if (!extSR)
36  {
37  return;
38  }
39 
40  unsigned srLength = 0;
41  const char* srValue = extSR->getAttributeByHandle(attrHandle, srLength);
42 
43  if (srLength > 0)
44  {
45  attrs->add(attrHandle, (char*)srValue, srLength);
46  }
47  }
48 
51  static bool needExtendedAttribute(const DtStateRepository& stateRep,
52  const DtStateRepository& asSeenByRemote,
53  RTI::AttributeHandle attrHandle)
54  {
55  const StateRepType* extSR = dynamic_cast<const StateRepType*>(&stateRep);
56  const StateRepType* extASBR = dynamic_cast<const StateRepType*>(&asSeenByRemote);
57 
58  if (!extSR || !extASBR)
59  {
60  return false;
61  }
62 
63  unsigned srLength = 0;
64  unsigned asbrLength = 0;
65  const char* srValue = extSR->getAttributeByHandle(attrHandle, srLength);
66  const char* asbrValue = extASBR->getAttributeByHandle(attrHandle, asbrLength);
67 
68  return (srLength != asbrLength ||
69  memcmp(srValue, asbrValue, srLength) != 0);
70  }
71 
72  };
73 }
74 
75 
76 #endif
Contains the DtSensorFieldOfViewPublisher class declaration.

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)