![]() |
MAK RTIspy API Documentation for HLA 1516
|
00001 /********************************************************************* 00002 ** Copyright (c) 2010 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: HLAvariableArrayImpl.h,v $ $Revision: 1.0 $ $State: Exp $ 00007 *********************************************************************/ 00010 #ifdef DtIFSPEC1516E 00011 00012 #ifdef WIN32 00013 #pragma warning( disable : 4290 ) 00014 #endif 00015 00016 #ifndef HLAvariableArrayImpl_H_ 00017 #define HLAvariableArrayImpl_H_ 00018 00019 #include <RTI/encoding/DataElement.h> 00020 #include <RTI/encoding/BasicDataElements.h> 00021 #include "encodingImplHelpers.h" 00022 #include <memory> 00023 00024 namespace rti1516e 00025 { 00026 class HLAvariableArrayImplementation 00027 { 00028 public: 00029 00032 HLAvariableArrayImplementation( const DataElement& dataElement ); 00033 00035 HLAvariableArrayImplementation(HLAvariableArrayImplementation const & rhs); 00036 00038 virtual ~HLAvariableArrayImplementation(); 00039 00042 virtual rti1516e::VariableLengthData encode() const; 00043 00046 virtual void encode(rti1516e::VariableLengthData& inData) const; 00047 00050 virtual void encodeInto( std::vector<Octet>& buffer ) const; 00051 00054 virtual void decode(rti1516e::VariableLengthData const & inData); 00055 00059 virtual size_t decodeFrom( std::vector<Octet> const & buffer, size_t index ); 00060 00063 virtual size_t getEncodedLength() const; 00064 00067 virtual unsigned int getOctetBoundary() const; 00068 00071 virtual size_t size() const; 00072 00074 virtual bool hasPrototypeSameTypeAs(DataElement const& dataElement ) const; 00075 00077 virtual bool hasPrototypeSameTypeAs(HLAvariableArrayImplementation const* inData ) const; 00078 00081 virtual void addElement(const DataElement& dataElement) 00082 throw (EncoderException); 00083 00087 virtual void addElementPointer(DataElement* dataElement, bool takeOwnership=false) 00088 throw (EncoderException); 00089 00092 virtual void set (size_t index, const DataElement& dataElement) 00093 throw (EncoderException); 00094 00098 virtual void setElementPointer (size_t index, DataElement* dataElement, bool takeOwnership=false) 00099 throw (EncoderException); 00100 00104 virtual const rti1516e::DataElement& get(size_t index) const; 00105 00109 virtual rti1516e::DataElement& get(size_t index); 00110 00112 virtual const rti1516e::DataElement& prototypeElement() const; 00113 00114 protected: 00115 00118 virtual size_t resetEncodedLength( ); 00119 00122 virtual void clear( ); 00123 00125 HLAvariableArrayImplementation* self() const; 00126 00127 private: 00128 00130 HLAvariableArrayImplementation(); 00131 00132 private: 00133 00135 HLAinteger32BE myLength; 00136 00138 std::auto_ptr<rti1516e::DataElement> myPrototypeElement; 00139 00141 mutable std::vector<rti1516e::DataElement*> myData; 00142 00144 mutable std::vector<bool> myDataOwnership; 00145 00147 bool myDirtyState; 00148 00150 size_t myOctetBoundary; 00151 00153 size_t myEncodedLength; 00154 }; 00155 } 00156 00157 #endif 00158 #endif // DtIFSPEC1516E 00159 00160 00161