open-dis-cpp
VariableDatum.h
1 #pragma once
2 
3 #include <dis6/utils/DataStream.h>
4 #include <dis6/opendis6_export.h>
5 #include <vector>
6 
7 // length in bytes for the variable data. This should be a dynamically allocated array.
8 #define STATIC_ARRAY_LENGTH 128
9 
10 namespace DIS
11 {
12 // Section 5.2.32. Variable Datum Record
13 
14 // Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved.
15 //
16 // @author DMcG, jkg
17 
18 class OPENDIS6_EXPORT VariableDatum
19 {
20 protected:
22  unsigned int _variableDatumID;
23 
25  unsigned int _variableDatumLength;
26 
28  std::vector<char> _variableDatums;
29  unsigned int _arrayLength;
30 
31 
32  public:
33  VariableDatum();
34  virtual ~VariableDatum();
35 
36  virtual void marshal(DataStream& dataStream) const;
37  virtual void unmarshal(DataStream& dataStream);
38 
39  unsigned int getVariableDatumID() const;
40  void setVariableDatumID(unsigned int pX);
41 
42  unsigned int getVariableDatumLength() const;
43  void setVariableDatumLength(unsigned int pX);
44 
45  char* getVariableDatums();
46  const char* getVariableDatums() const;
47  void setVariableDatums(const char* pX, const unsigned int length);
48 
49 
50 virtual unsigned int getMarshalledSize() const;
51 
52  bool operator ==(const VariableDatum& rhs) const;
53 };
54 }
55 
56 // Copyright (c) 1995-2009 held by the author(s). All rights reserved.
57 // Redistribution and use in source and binary forms, with or without
58 // modification, are permitted provided that the following conditions
59 // are met:
60 //
61 // * Redistributions of source code must retain the above copyright
62 // notice, this list of conditions and the following disclaimer.
63 // * Redistributions in binary form must reproduce the above copyright
64 // notice, this list of conditions and the following disclaimer
65 // in the documentation and/or other materials provided with the
66 // distribution.
67 // * Neither the names of the Naval Postgraduate School (NPS)
68 // Modeling Virtual Environments and Simulation (MOVES) Institute
69 // (http://www.nps.edu and http://www.MovesInstitute.org)
70 // nor the names of its contributors may be used to endorse or
71 // promote products derived from this software without specific
72 // prior written permission.
73 //
74 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
75 // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
76 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
77 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
78 // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
79 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
80 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
81 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
82 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
83 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
84 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
85 // POSSIBILITY OF SUCH DAMAGE.
Symbolic names as defined in 5.1.4.
Definition: AcknowledgePdu.h:8
a class to support managing a network buffer.
Definition: DataStream.h:28
Definition: VariableDatum.h:18
std::vector< char > _variableDatums
The variable datum data.
Definition: VariableDatum.h:28
unsigned int _variableDatumID
ID of the variable datum.
Definition: VariableDatum.h:22
unsigned int _variableDatumLength
length of the variable datums
Definition: VariableDatum.h:25