![]() |
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: HLAfixedArray.h 00012 ***********************************************************************/ 00013 #ifndef RTI_HLAfixedArray_h_ 00014 #define RTI_HLAfixedArray_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 HLAfixedArrayImplementation; 00025 00026 // Interface for the HLAfixedArray complex data element 00027 class RTI_EXPORT HLAfixedArray : public rti1516e::DataElement 00028 { 00029 public: 00030 // Constructor which accepts a prototype element and size 00031 // that specifies the type and number of elements to be stored in the array. 00032 // A clone of the given element works as a prototype. 00033 explicit HLAfixedArray ( 00034 const DataElement& protoType, 00035 size_t length ); 00036 00037 // Copy Constructor 00038 // Copied elements use internal memory 00039 HLAfixedArray ( 00040 HLAfixedArray const & rhs); 00041 00042 // Destructor 00043 virtual ~HLAfixedArray(); 00044 00045 // Return a new copy of the array 00046 virtual std::auto_ptr<DataElement> clone () const; 00047 00048 // Encode this element into a new VariableLengthData 00049 virtual VariableLengthData encode () const 00050 throw (EncoderException); 00051 00052 // Encode this element into an existing VariableLengthData 00053 virtual void encode ( 00054 VariableLengthData& inData) const 00055 throw (EncoderException); 00056 00057 // Encode this element and append it to a buffer 00058 virtual void encodeInto ( 00059 std::vector<Octet>& buffer) const 00060 throw (EncoderException); 00061 00062 // Decode this element from the RTI's VariableLengthData. 00063 virtual void decode ( 00064 VariableLengthData const & inData) 00065 throw (EncoderException); 00066 00067 // Decode this element starting at the index in the provided buffer 00068 virtual size_t decodeFrom ( 00069 std::vector<Octet> const & buffer, 00070 size_t index) 00071 throw (EncoderException); 00072 00073 // Return the size in bytes of this element's encoding. 00074 virtual size_t getEncodedLength () const 00075 throw (EncoderException); 00076 00077 // Return the octet boundary of this element. 00078 virtual unsigned int getOctetBoundary () const; 00079 00080 // Return true if given element is same type as this; otherwise, false. 00081 virtual bool isSameTypeAs( 00082 DataElement const& inData ) const; 00083 00084 // Return true if given element matches prototype of this array. 00085 virtual bool hasPrototypeSameTypeAs(DataElement const& dataElement ) const; 00086 00087 // Return the number of elements in this fixed array. 00088 virtual size_t size () const; 00089 00090 // Sets the element at the given index to a copy of the given element instance 00091 // Element must match prototype. 00092 // If indexed element uses external memory, the memory will be modified. 00093 virtual void set (size_t index, 00094 const DataElement& dataElement) 00095 throw (EncoderException); 00096 00097 // Sets the element at the given index to the given element instance 00098 // Element must match prototype. 00099 // Null pointer results in an exception. 00100 // Caller is responsible for ensuring that the external memory is 00101 // valid for the lifetime of this object or until the indexed element 00102 // acquires new memory through this call. 00103 virtual void setElementPointer (size_t index, 00104 DataElement* dataElement) 00105 throw (EncoderException); 00106 00107 // Return a reference to the element instance at the specified index. 00108 // Access of indexed element that has not been set will set that index 00109 // with a clone of prototype and return it. 00110 // Must use set to change element. 00111 virtual const DataElement& get ( 00112 size_t index) const 00113 throw (EncoderException); 00114 00115 // Return a const reference to the element instance at the specified index. 00116 // Access of indexed element that has not been set will set that index 00117 // with a clone of prototype and return it. 00118 // Must use set to change element. 00119 DataElement const& operator [](size_t index) const 00120 throw (EncoderException); 00121 00122 private: 00123 00124 // Default Constructor not allowed 00125 HLAfixedArray (); 00126 00127 // Assignment Operator not allowed 00128 HLAfixedArray& operator=( 00129 HLAfixedArray const & rhs); 00130 00131 protected: 00132 00133 HLAfixedArrayImplementation* _impl; 00134 }; 00135 } 00136 00137 #endif // RTI_HLAfixedArray_h_ 00138