![]() |
MAK RTIspy API Documentation for HLA Evolved
|
00001 /*********************************************************************** 00002 The IEEE hereby grants a general, royalty-free license to copy, distribute, 00003 display and make derivative works from this material, for all purposes, 00004 provided that any use of the material contains the following 00005 attribution: "Reprinted with permission from IEEE 1516.1(TM)-2010". 00006 Should you require additional information, contact the Manager, Standards 00007 Intellectual Property, IEEE Standards Association (stds-ipr@ieee.org). 00008 ***********************************************************************/ 00009 /*********************************************************************** 00010 IEEE 1516.1 High Level Architecture Interface Specification C++ API 00011 File: HLAvariableArray.h 00012 ***********************************************************************/ 00013 #ifndef RTI_HLAvariableArray_h_ 00014 #define RTI_HLAvariableArray_h_ 00015 00016 #include <RTI/encoding/DataElement.h> 00017 #include <RTI/encoding/EncodingConfig.h> 00018 #include <RTI/SpecificConfig.h> 00019 00020 namespace rti1516e 00021 { 00022 // Forward Declarations 00023 class VariableLengthData; 00024 class HLAvariableArrayImplementation; 00025 00026 // Interface for the HLAvariableArray complex data element 00027 class RTI_EXPORT HLAvariableArray : public rti1516e::DataElement 00028 { 00029 public: 00030 00031 // Constructor which accepts a prototype element 00032 // that specifies the type of elements to be stored in the array. 00033 // A clone of the given element works as a seed. 00034 explicit HLAvariableArray ( 00035 const DataElement& prototype ); 00036 00037 // Copy Constructor 00038 HLAvariableArray ( 00039 HLAvariableArray const & rhs); 00040 00041 // Destructor 00042 virtual ~HLAvariableArray (); 00043 00044 // Return a new copy of the DataElement 00045 virtual std::auto_ptr<DataElement> clone () const; 00046 00047 // Encode this element into a new VariableLengthData 00048 virtual VariableLengthData encode () const 00049 throw (EncoderException); 00050 00051 // Encode this element into an existing VariableLengthData 00052 virtual void encode ( 00053 VariableLengthData& inData) const 00054 throw (EncoderException); 00055 00056 // Encode this element and append it to a buffer 00057 virtual void encodeInto ( 00058 std::vector<Octet>& buffer) const 00059 throw (EncoderException); 00060 00061 // Decode this element from the RTI's VariableLengthData. 00062 virtual void decode ( 00063 VariableLengthData const & inData) 00064 throw (EncoderException); 00065 00066 // Decode this element starting at the index in the provided buffer 00067 virtual size_t decodeFrom ( 00068 std::vector<Octet> const & buffer, 00069 size_t index) 00070 throw (EncoderException); 00071 00072 // Return the size in bytes of this element's encoding. 00073 virtual size_t getEncodedLength () const 00074 throw (EncoderException); 00075 00076 // Return the octet boundary of this element. 00077 virtual unsigned int getOctetBoundary () const; 00078 00079 // Return the number of elements in this variable array. 00080 virtual size_t size () const; 00081 00082 // Return true if given element is same type as this; otherwise, false. 00083 virtual bool isSameTypeAs( 00084 DataElement const& inData ) const; 00085 00086 // Return true if given element matches prototype of array. 00087 virtual bool hasPrototypeSameTypeAs(DataElement const& dataElement ) const; 00088 00089 // Adds a copy of the given element instance to this array 00090 // Element must match prototype. 00091 virtual void addElement ( 00092 const DataElement& dataElement) 00093 throw (EncoderException); 00094 00095 // Adds the given element instance to this variable array 00096 // Element must match prototype. 00097 // Caller is responsible for ensuring that the external memory is 00098 // valid for the lifetime of this object or until the indexed element 00099 // acquires new memory through the set method. 00100 // Null pointer results in an exception. 00101 virtual void addElementPointer ( 00102 DataElement* dataElement) 00103 throw (EncoderException); 00104 00105 // Sets the indexed element to a copy of the given element instance. 00106 // Element must match prototype. 00107 // If indexed element uses external memory, the memory will be modified. 00108 virtual void set ( 00109 size_t index, 00110 const DataElement& dataElement) 00111 throw (EncoderException); 00112 00113 // Sets the indexed element to the given element instance. 00114 // Element must match prototype. 00115 // Null pointer results in an exception. 00116 // Caller is responsible for ensuring that the external memory is 00117 // valid for the lifetime of this object or until the indexed element 00118 // acquires new memory through this call. 00119 virtual void setElementPointer ( 00120 size_t index, 00121 DataElement* dataElement) 00122 throw (EncoderException); 00123 00124 // Return a const reference to the element instance at the specified index. 00125 // Must use set to change element. 00126 virtual const DataElement& get ( 00127 size_t index) const 00128 throw (EncoderException); 00129 00130 // Return a const reference to the element instance at the specified index. 00131 // Must use set to change element. 00132 DataElement const& operator [](size_t index) const 00133 throw (EncoderException); 00134 private: 00135 00136 // Default Constructor not allowed 00137 HLAvariableArray (); 00138 00139 // Assignment Operator not allowed 00140 HLAvariableArray& operator=( 00141 HLAvariableArray const & rhs); 00142 00143 protected: 00144 00145 HLAvariableArrayImplementation* _impl; 00146 }; 00147 } 00148 00149 #endif // RTI_HLAvariableArray_h_ 00150