MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HLAvariableArrayImpl.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2010 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: HLAvariableArrayImpl.h,v $ $Revision: 1.0 $ $State: Exp $
7 *********************************************************************/
10 #if !defined(DtIFSPEC13) && !defined(DtIFSPEC1516)
11 
12 #ifdef WIN32
13 #pragma warning( disable : 4290 )
14 #endif
15 
16 #ifndef HLAvariableArrayImpl_H_
17 #define HLAvariableArrayImpl_H_
18 
19 #include <RTI/encoding/DataElement.h>
20 #include <RTI/encoding/BasicDataElements.h>
21 #include <encodingImplHelpers.h>
22 #include <rtiApiTypes.h>
23 
24 #include <memory>
25 
26 namespace RTI_API
27 {
29  {
30  public:
31 
34  HLAvariableArrayImplementation( const DataElement& dataElement );
35 
38 
41 
44  virtual VariableLengthData encode() const;
45 
48  virtual void encode(VariableLengthData& inData) const;
49 
52  virtual void encodeInto( std::vector<Octet>& buffer ) const;
53 
56  virtual void decode(VariableLengthData const & inData);
57 
61  virtual size_t decodeFrom( std::vector<Octet> const & buffer, size_t index );
62 
65  virtual size_t getEncodedLength() const;
66 
69  virtual unsigned int getOctetBoundary() const;
70 
73  virtual size_t size() const;
74 
76  virtual bool hasPrototypeSameTypeAs(DataElement const& dataElement ) const;
77 
79  virtual bool hasPrototypeSameTypeAs(HLAvariableArrayImplementation const* inData ) const;
80 
83  virtual void addElement(const DataElement& dataElement)
84  throw (EncoderException);
85 
89  virtual void addElementPointer(DataElement* dataElement, bool takeOwnership=false)
90  throw (EncoderException);
91 
94  virtual void set (size_t index, const DataElement& dataElement)
95  throw (EncoderException);
96 
100  virtual void setElementPointer (size_t index, DataElement* dataElement, bool takeOwnership=false)
101  throw (EncoderException);
102 
106  virtual const DataElement& get(size_t index) const;
107 
111  virtual DataElement& get(size_t index);
112 
114  virtual const DataElement& prototypeElement() const;
115 
116  protected:
117 
120  virtual size_t resetEncodedLength( );
121 
124  virtual void clear( );
125 
127  HLAvariableArrayImplementation* self() const;
128 
129  private:
130 
133 
134  private:
135 
137  HLAinteger32BE myLength;
138 
140  DtRtiApiUniquePtr<DataElement> myPrototypeElement;
141 
143  mutable std::vector<DataElement*> myData;
144 
146  mutable std::vector<bool> myDataOwnership;
147 
150 
153 
156  };
157 }
158 
159 #endif
160 #endif
161 
162 
163 
HLAinteger32BE myLength
Length of the array.
Definition: HLAvariableArrayImpl.h:137
virtual ~HLAvariableArrayImplementation()
Destructor.
virtual void setElementPointer(size_t index, DataElement *dataElement, bool takeOwnership=false)
Set the indexed element to the given dataElement instance all array elements must have same type Null...
virtual size_t decodeFrom(std::vector< Octet > const &buffer, size_t index)
Decode this element starting at the index in the provided buffer.
size_t myEncodedLength
size of the encoded length
Definition: HLAvariableArrayImpl.h:155
Definition: HLAvariableArrayImpl.h:28
size_t myOctetBoundary
size of the octet boundary
Definition: HLAvariableArrayImpl.h:152
virtual void encodeInto(std::vector< Octet > &buffer) const
Encode this element and append it to a buffer.
virtual size_t size() const
Return the number of elements in this variable array.
virtual void addElementPointer(DataElement *dataElement, bool takeOwnership=false)
Adds the given element instance to this variable array all array elements must have same type Null po...
virtual unsigned int getOctetBoundary() const
Return the octet boundary of this element.
DtRtiApiUniquePtr< DataElement > myPrototypeElement
prototype
Definition: HLAvariableArrayImpl.h:140
HLAvariableArrayImplementation()
Default constructor not allowed.
virtual void clear()
Empty and delete memory for existing elements.
virtual void decode(VariableLengthData const &inData)
Decode this element from the VariableLengthData.
virtual void set(size_t index, const DataElement &dataElement)
Set the indexed element to a copy of the given dataElement instance all array elements must have same...
bool myDirtyState
flag for checking dirty state
Definition: HLAvariableArrayImpl.h:149
virtual size_t getEncodedLength() const
Return the size in bytes of this element&#39;s encoding.
std::vector< DataElement * > myData
mutable array of data element pointers
Definition: HLAvariableArrayImpl.h:143
std::vector< bool > myDataOwnership
array of ownership, for deleting objects properly
Definition: HLAvariableArrayImpl.h:146
virtual VariableLengthData encode() const
Encode this element into a new VariableLengthData.
virtual void addElement(const DataElement &dataElement)
Adds a copy of the given element instance to this array all array elements must have same type...
virtual bool hasPrototypeSameTypeAs(DataElement const &dataElement) const
Return true if given element matches prototype of array.
virtual size_t resetEncodedLength()
Reset the cached length if it has changed.
virtual const DataElement & prototypeElement() const
Return the prototype element.

Document ID: Generated on Wed Jul 8 16:20:32 EDT 2026 from SVN revision 291616
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)