MAK RTIspy API Documentation for HLA 1.3
HLAopaqueData.h
Go to the documentation of this file.
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: HLAopaqueData.h
00012 ***********************************************************************/
00013 #ifndef RTI_HLAopaqueData_h_
00014 #define RTI_HLAopaqueData_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 HLAopaqueDataImplementation;
00025 
00026    // Interface for the HLAopaqueData basic data element
00027    class RTI_EXPORT HLAopaqueData : public rti1516e::DataElement
00028    {
00029    public:
00030 
00031       // Constructor: Default
00032       // Uses internal memory
00033       HLAopaqueData ();
00034 
00035       // Constructor: Initial Value
00036       // Uses internal memory
00037       HLAopaqueData (
00038          const Octet* inData,
00039          size_t dataSize);
00040 
00041       // Constructor: Use external memory with buffer and data of given lengths.
00042       // This instance changes or reflects changes to contents of external memory.
00043       // Changes to external memory are reflected in subsequent encodings.
00044       // Changes to encoder (i.e., set or decode) are reflected in external memory.
00045       // Caller is responsible for ensuring that the external memory is
00046       // valid for the lifetime of this object or until this object acquires
00047       // new memory through setDataPointer.
00048       // Buffer length indicates size of memory; data length indicates size of
00049       // data stored in memory.
00050       // Exception is thrown for null memory or zero buffer size.
00051       HLAopaqueData (
00052          Octet** inData,
00053          size_t bufferSize,
00054          size_t dataSize)
00055          throw (EncoderException);
00056 
00057       // Constructor: Copy
00058       // Uses internal memory
00059       HLAopaqueData (
00060          HLAopaqueData const & rhs);
00061 
00062       // Caller is free to delete rhs.
00063       virtual ~HLAopaqueData();
00064 
00065       // Return a new copy of the DataElement
00066       virtual std::auto_ptr<DataElement> clone () const;
00067 
00068       // Return the encoding of this element in a VariableLengthData
00069       virtual VariableLengthData encode () const
00070          throw (EncoderException);
00071 
00072       // Encode this element into an existing VariableLengthData
00073       virtual void encode (
00074          VariableLengthData& inData) const
00075          throw (EncoderException);
00076 
00077       // Encode this element and append it to a buffer.
00078       virtual void encodeInto (
00079          std::vector<Octet>& buffer) const
00080          throw (EncoderException);
00081 
00082       // Decode this element from the RTI's VariableLengthData.
00083       virtual void decode (
00084          VariableLengthData const & inData)
00085          throw (EncoderException);
00086 
00087       // Decode this element starting at the index in the provided buffer
00088       virtual size_t decodeFrom (
00089          std::vector<Octet> const & buffer,
00090          size_t index)
00091          throw (EncoderException);
00092 
00093       // Return the size in bytes of this element's encoding.
00094       virtual size_t getEncodedLength () const
00095          throw (EncoderException);
00096 
00097       // Return the octet boundary of this element.
00098       virtual unsigned int getOctetBoundary () const;
00099 
00100       // Return the length of the contained buffer
00101       virtual size_t bufferLength () const;
00102 
00103       // Return the length of the data stored in the buffer
00104       virtual size_t dataLength () const;
00105 
00106       // Change memory to use given external memory
00107       // Changes to this instance will be reflected in external memory
00108       // Caller is responsible for ensuring that the data that is
00109       // pointed to is valid for the lifetime of this object, or past
00110       // the next time this object is given new data.
00111       // Buffer length indicates size of memory; data length indicates size of
00112       // data stored in memory.
00113       // Exception is thrown for null memory or zero buffer size.
00114       virtual void setDataPointer (
00115          Octet** inData,
00116          size_t bufferSize,
00117          size_t dataSize)
00118          throw (EncoderException);
00119 
00120       // Set the data to be encoded.
00121       virtual void set(
00122          const Octet* inData,
00123          size_t dataSize);
00124 
00125       // Return a reference to the contained array
00126       virtual const Octet* get () const;
00127 
00128       // Conversion operator to std::vector<Octet>
00129       // Value returned is from encoded data.
00130       operator const Octet*() const;
00131 
00132    private:
00133 
00134       // Assignment Operator not allowed
00135       HLAopaqueData& operator=(
00136          HLAopaqueData const & rhs);
00137 
00138    protected:
00139 
00140       HLAopaqueDataImplementation* _impl;
00141    };
00142 }
00143 
00144 #endif // RTI_HLAopaqueData_h_
00145 

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)