VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
linearObjectEncoderHLA.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 1992-2026 MAK Technologies, Inc
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #if DtHLA
13 
16 
17 #include <vector>
18 
22 class DT_DLL_VL DtLinearObjectEncoder : public DtEnvironmentObjectEncoder
23 {
24 public:
25 
27  DtLinearObjectEncoder(DtExerciseConn* exConn, DtObjClassDesc* classDesc);
28 
31 
33  virtual ~DtLinearObjectEncoder();
34 
36  DtLinearObjectEncoder& operator = (const DtLinearObjectEncoder& orig);
37 
38 protected:
39 
40  template <typename SegmentRecordType>
41  static bool needSegmentRecords(const DtLinearObjectRepository& stateRep, const DtLinearObjectRepository& asSeenByRemote);
42 
43  template <typename SegmentRecordType, typename SegmentRecordNetType>
44  static void encodeSegmentRecords(const DtLinearObjectRepository& stateRep,
45  RTI::AttributeHandleValuePairSet* attrs, RTI::AttributeHandle attrHandle);
46 };
47 
48 template <typename SegmentRecordType>
49 bool DtLinearObjectEncoder::needSegmentRecords(
50  const DtLinearObjectRepository& stateRep, const DtLinearObjectRepository& asSeenByRemote)
51 {
52  if (stateRep.numSegments() != asSeenByRemote.numSegments())
53  {
54  return true;
55  }
56 
57  for (int count = 0; count < stateRep.numSegments(); ++count)
58  {
59  SegmentRecordType localSegment;
60  stateRep.segment(count, localSegment);
61  SegmentRecordType remoteSegment;
62  asSeenByRemote.segment(count, remoteSegment);
63  if (localSegment != remoteSegment)
64  {
65  return true;
66  }
67  }
68 
69  return false;
70 }
71 
72 template <typename SegmentRecordType, typename SegmentRecordNetType>
73 void DtLinearObjectEncoder::encodeSegmentRecords(const DtLinearObjectRepository& stateRep,
74  RTI::AttributeHandleValuePairSet* attrs, RTI::AttributeHandle attrHandle)
75 {
76  int num = stateRep.numSegments();
77  std::vector<SegmentRecordNetType> netVals(num);
78 
79  for (int count = 0; count < num; ++count)
80  {
81  SegmentRecordType localSegment;
82  stateRep.segment(count, localSegment);
83  localSegment.loadNetRecord(netVals[count]);
84  }
85 
86  attrs->add(attrHandle, (char*) netVals.data(), num * sizeof(SegmentRecordNetType));
87 }
88 
89 #endif // DtHLA
Contains the DtLinearObjectRepository class declaration.
Instances of DtExerciseConn are used to provide an application&#39;s interface or connection to the netwo...
Definition: exerciseConnDIS.h:63
#define DT_DLL_VL
Definition: vlMachineTypes.h:120
virtual bool segment(int index, DtLinearSegmentRecord &record) const
Provides encoding logic for the DtLinearObjectStatePdu class.
Definition: linearObjectEncoderDIS.h:20
virtual int numSegments() const
Instances of DtLinearObjectRepository are used to maintain state information needed by linear object ...
Definition: linearObjectRepository.h:50

Document ID: Generated on Mon Sep 28 00:09:32 EDT 2026 from SVN revision 295353
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)