MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HLAvariableArray.h
Go to the documentation of this file.
1 /***********************************************************************
2  The IEEE hereby grants a general, royalty-free license to copy, distribute,
3  display and make derivative works from this material, for all purposes,
4  provided that any use of the material contains the following
5  attribution: "Reprinted with permission from IEEE 1516.1(TM)-2010".
6  Should you require additional information, contact the Manager, Standards
7  Intellectual Property, IEEE Standards Association (stds-ipr@ieee.org).
8 ***********************************************************************/
9 /***********************************************************************
10  IEEE 1516.1 High Level Architecture Interface Specification C++ API
11  File: HLAvariableArray.h
12 ***********************************************************************/
13 #ifndef RTI_HLAvariableArray_h_
14 #define RTI_HLAvariableArray_h_
15 
18 #include <RTI/SpecificConfig.h>
19 
20 namespace rti1516e
21 {
22  // Forward Declarations
23  class VariableLengthData;
24  class HLAvariableArrayImplementation;
25 
26  // Interface for the HLAvariableArray complex data element
28  {
29  public:
30 
31  // Constructor which accepts a prototype element
32  // that specifies the type of elements to be stored in the array.
33  // A clone of the given element works as a seed.
34  explicit HLAvariableArray (
35  const DataElement& prototype );
36 
37  // Copy Constructor
39  HLAvariableArray const & rhs);
40 
41  // Destructor
42  virtual ~HLAvariableArray ();
43 
44  // Return a new copy of the DataElement
45  virtual std::auto_ptr<DataElement> clone () const;
46 
47  // Encode this element into a new VariableLengthData
48  virtual VariableLengthData encode () const
49  throw (EncoderException);
50 
51  // Encode this element into an existing VariableLengthData
52  virtual void encode (
53  VariableLengthData& inData) const
54  throw (EncoderException);
55 
56  // Encode this element and append it to a buffer
57  virtual void encodeInto (
58  std::vector<Octet>& buffer) const
59  throw (EncoderException);
60 
61  // Decode this element from the RTI's VariableLengthData.
62  virtual void decode (
63  VariableLengthData const & inData)
64  throw (EncoderException);
65 
66  // Decode this element starting at the index in the provided buffer
67  virtual size_t decodeFrom (
68  std::vector<Octet> const & buffer,
69  size_t index)
70  throw (EncoderException);
71 
72  // Return the size in bytes of this element's encoding.
73  virtual size_t getEncodedLength () const
74  throw (EncoderException);
75 
76  // Return the octet boundary of this element.
77  virtual unsigned int getOctetBoundary () const;
78 
79  // Return the number of elements in this variable array.
80  virtual size_t size () const;
81 
82  // Return true if given element is same type as this; otherwise, false.
83  virtual bool isSameTypeAs(
84  DataElement const& inData ) const;
85 
86  // Return true if given element matches prototype of array.
87  virtual bool hasPrototypeSameTypeAs(DataElement const& dataElement ) const;
88 
89  // Adds a copy of the given element instance to this array
90  // Element must match prototype.
91  virtual void addElement (
92  const DataElement& dataElement)
93  throw (EncoderException);
94 
95  // Adds the given element instance to this variable array
96  // Element must match prototype.
97  // Caller is responsible for ensuring that the external memory is
98  // valid for the lifetime of this object or until the indexed element
99  // acquires new memory through the set method.
100  // Null pointer results in an exception.
101  virtual void addElementPointer (
102  DataElement* dataElement)
103  throw (EncoderException);
104 
105  // Sets the indexed element to a copy of the given element instance.
106  // Element must match prototype.
107  // If indexed element uses external memory, the memory will be modified.
108  virtual void set (
109  size_t index,
110  const DataElement& dataElement)
111  throw (EncoderException);
112 
113  // Sets the indexed element to the given element instance.
114  // Element must match prototype.
115  // Null pointer results in an exception.
116  // Caller is responsible for ensuring that the external memory is
117  // valid for the lifetime of this object or until the indexed element
118  // acquires new memory through this call.
119  virtual void setElementPointer (
120  size_t index,
121  DataElement* dataElement)
122  throw (EncoderException);
123 
124  // Return a const reference to the element instance at the specified index.
125  // Must use set to change element.
126  virtual const DataElement& get (
127  size_t index) const
128  throw (EncoderException);
129 
130  // Return a const reference to the element instance at the specified index.
131  // Must use set to change element.
132  DataElement const& operator [](size_t index) const
133  throw (EncoderException);
134  private:
135 
136  // Default Constructor not allowed
137  HLAvariableArray ();
138 
139  // Assignment Operator not allowed
140  HLAvariableArray& operator=(
141  HLAvariableArray const & rhs);
142 
143  protected:
144 
145  HLAvariableArrayImplementation* _impl;
146  };
147 }
148 
149 #endif // RTI_HLAvariableArray_h_
150 

Document ID: Generated on Wed Mar 11 20:26:49 EDT 2015 from SVN revision 150939
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (www.mak.com)