VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
linearObjectDecoderHLA.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 
20 class DT_DLL_VL DtLinearObjectDecoder : public DtEnvironmentObjectDecoder
21 {
22 public:
23 
25  DtLinearObjectDecoder(DtExerciseConn* exConn, DtObjClassDesc* classDesc);
26 
29 
31  virtual ~DtLinearObjectDecoder();
32 
34  DtLinearObjectDecoder& operator = (const DtLinearObjectDecoder& orig);
35 
36 protected:
37 
38  template <typename SegmentRecordType, typename SegmentRecordNetType>
39  static void decodeSegmentRecords(DtLinearObjectRepository* stateRep,
40  const RTI::AttributeHandleValuePairSet& attrs, int pairSetIndex);
41 };
42 
43 template <typename SegmentRecordType, typename SegmentRecordNetType>
44 void DtLinearObjectDecoder::decodeSegmentRecords(DtLinearObjectRepository* stateRep,
45  const RTI::AttributeHandleValuePairSet& attrs, int pairSetIndex)
46 {
47  RTI::ULong length = 0;
48  char* buffer = attributeData(attrs, pairSetIndex, length);
49 
50  if (length == 0)
51  {
52  stateRep->setNumSegments(0);
53  return;
54  }
55 
56  if (length % sizeof(SegmentRecordNetType) != 0)
57  {
58  DtWarn("Can't decode SegmentRecords : Size %d not a multiple of the size of a parameter (%d).\n",
59  length, sizeof(SegmentRecordNetType));
60 
61  stateRep->setNumSegments(0);
62  return;
63  }
64 
65  int numSegs = length / sizeof(SegmentRecordNetType);
66  stateRep->setNumSegments(numSegs);
67 
68  for (int segCount = 0; segCount < numSegs; ++segCount)
69  {
70  SegmentRecordNetType* netSegPtr = (SegmentRecordNetType*) buffer;
71  SegmentRecordType rec;
72 
73  rec = *netSegPtr;
74  stateRep->setSegment(segCount, rec);
75  buffer += sizeof(SegmentRecordNetType);
76  }
77 }
78 
79 #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
Provides decoding logic for the DtLinearObjectStatePdu class.
Definition: linearObjectDecoderDIS.h:20
DtOutputStream DtWarn
These DtOutputStream instances are used for all print messaging in VR-Link.
virtual bool setSegment(int index, const DtLinearSegmentRecord &record)
Instances of DtLinearObjectRepository are used to maintain state information needed by linear object ...
Definition: linearObjectRepository.h:50
virtual bool setNumSegments(int newNumber)

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)