![]() |
VR-Link API Documentation for HLA 1516
|
DtPdu is the base class for all PDU's in VR-Link. More...
Inheritance diagram for DtPdu:
Collaboration diagram for DtPdu:Public Member Functions | |
| virtual | ~DtPdu () |
| Destructor. | |
| DtPdu (const DtPdu &pdu, DtBufferPtr buffer=DtUSE_INTERNAL_BUFFER) | |
| Copy constructor. | |
| DtPdu & | operator= (const DtPdu &pdu) |
| Assignment operator. | |
| virtual void * | packet () const |
| Older function that returns a pointer to the network representation. | |
| virtual int | status () const |
| Get PDU status. | |
| virtual void | setVersion (int vers) |
| Set/Get protocol version from PDU header. | |
| virtual int | protocolVersion () const |
| virtual void | setExerciseId (int id) |
| Set/Get exerciseID in PDU header. | |
| virtual int | exerciseId () const |
| virtual DtPduKind | kind () const |
| Returns PDU kind from PDU header. | |
| virtual DtProtocolFamily | protocolFamily () const |
| Returns protocol family from PDU header. | |
| virtual void | setTimeStamp (DtTime time, DtTimeStampType type=DtTimeStampRelative) |
| Set the PDU header's time stamp to reflect time and type. | |
| virtual DtTime | timeStamp () const |
| Return the time (in seconds past an hour) encoded in the PDU header's time stamp. | |
| virtual DtTimeStampType | timeStampType () const |
| Return the type of the time stamp, as indicated in PDU header. | |
| virtual DtTime | guessTimeValid (DtTime referenceTime) const |
| Since timestamp only represents number of seconds past the hour, guessTimeValid chooses the hour that would make the timestamp closest to reference time, and returns a time that is timestamp seconds past that hour. | |
| virtual DtNetPduHeader * | netHeader () const |
| Returns a pointer to the PDU's header. | |
| virtual void | print () const |
| Print the contents of the PDU by calling printToStream(DtInfo). | |
| virtual void | printToStream (std::ostream &stream) const |
| Print the contents of the PDU by calling printHeaderToStream and printDataToStream. | |
| virtual void | printHeader () const |
| Print the PDU's header. This calls printHeaderToStream(DtInfo). | |
| virtual void | printHeaderToStream (std::ostream &stream) const |
| Print the PDU's header to a stream. | |
| virtual void | printData () const |
| Print the PDU's data (not including header). | |
| virtual void | printDataToStream (std::ostream &stream) const |
| virtual void | printDataToString (DtString &str) const |
Protected Member Functions | |
| DtPdu () | |
| Constructor. | |
| virtual void | setStatus (int okStatus) |
| Sets the PDU's status to okStatus. | |
| virtual void | initPdu (int size, DtBufferPtr buffer) |
| Must be called after default ctor before PDU is completely constructed. | |
| virtual void | initPdu (const void *initial, DtBufferPtr buffer) |
| Called by from-net-rep ctor. Initializes DtBaseMsg. | |
| virtual DtPduKind | internalGetPduKind () const =0 |
| Returns the PDU kind associated with the derived PDU class. | |
| virtual DtProtocolFamily | kindToFamily (DtPduKind kind) const |
| Maps PDU kind to ProtocolFamily. | |
| virtual void | sizeChanged (int size) |
| Called by changeSize. Sets the size in the header to size. | |
| virtual void | clearData () |
| zeros out all bytes after the PDU header. | |
| virtual void | initHeader (DtPduKind kind, int size) |
| Initializes PDU header. Called by initPdu. | |
Protected Attributes | |
| int | myOKStatus |
DtPdu is the base class for all PDU's in VR-Link.
| virtual DtPdu::~DtPdu | ( | ) | [virtual] |
Destructor.
| DtPdu::DtPdu | ( | const DtPdu & | pdu, |
| DtBufferPtr | buffer = DtUSE_INTERNAL_BUFFER |
||
| ) |
Copy constructor.
| DtPdu::DtPdu | ( | ) | [protected] |
Constructor.
PDU is not fully constructed until initPdu is called.
| virtual void DtPdu::clearData | ( | ) | [protected, virtual] |
zeros out all bytes after the PDU header.
| int DtPdu::exerciseId | ( | ) | const [inline, virtual] |
References DtNetPduHeader::DtExercise, and netHeader().
| virtual DtTime DtPdu::guessTimeValid | ( | DtTime | referenceTime | ) | const [virtual] |
Since timestamp only represents number of seconds past the hour, guessTimeValid chooses the hour that would make the timestamp closest to reference time, and returns a time that is timestamp seconds past that hour.
| virtual void DtPdu::initHeader | ( | DtPduKind | kind, |
| int | size | ||
| ) | [protected, virtual] |
Initializes PDU header. Called by initPdu.
| virtual void DtPdu::initPdu | ( | int | size, |
| DtBufferPtr | buffer | ||
| ) | [protected, virtual] |
Must be called after default ctor before PDU is completely constructed.
Fills in PDU header, and initializes DtBaseMsg.
| virtual void DtPdu::initPdu | ( | const void * | initial, |
| DtBufferPtr | buffer | ||
| ) | [protected, virtual] |
Called by from-net-rep ctor. Initializes DtBaseMsg.
| virtual DtPduKind DtPdu::internalGetPduKind | ( | ) | const [protected, pure virtual] |
Returns the PDU kind associated with the derived PDU class.
Implemented in DtGriddedDataPdu, and DtEnvironmentalProcessPdu.
| DtPduKind DtPdu::kind | ( | ) | const [inline, virtual] |
Returns PDU kind from PDU header.
References netHeader().
| virtual DtProtocolFamily DtPdu::kindToFamily | ( | DtPduKind | kind | ) | const [protected, virtual] |
Maps PDU kind to ProtocolFamily.
| DtNetPduHeader * DtPdu::netHeader | ( | ) | const [inline, virtual] |
Returns a pointer to the PDU's header.
References DtBaseMsg::netRep().
Referenced by exerciseId(), kind(), protocolFamily(), protocolVersion(), setExerciseId(), setTimeStamp(), setVersion(), timeStamp(), and timeStampType().
| void * DtPdu::packet | ( | ) | const [inline, virtual] |
Older function that returns a pointer to the network representation.
The newer DtBaseMsg::netRep should generally be used instead.
References DtBaseMsg::netRep().
| virtual void DtPdu::print | ( | ) | const [virtual] |
Print the contents of the PDU by calling printToStream(DtInfo).
| virtual void DtPdu::printData | ( | ) | const [virtual] |
Print the PDU's data (not including header).
Base DtPdu version just prints hex. Use the printDataToString to put the data into a DtString instead of simply sending the output to stdout. printData() calls printDataToStream(DtInfo).
Reimplemented in DtGriddedDataPdu, and DtEnvironmentalProcessPdu.
| virtual void DtPdu::printDataToStream | ( | std::ostream & | stream | ) | const [virtual] |
Reimplemented in DtGriddedDataPdu, and DtEnvironmentalProcessPdu.
| virtual void DtPdu::printDataToString | ( | DtString & | str | ) | const [virtual] |
| virtual void DtPdu::printHeader | ( | ) | const [virtual] |
Print the PDU's header. This calls printHeaderToStream(DtInfo).
| virtual void DtPdu::printHeaderToStream | ( | std::ostream & | stream | ) | const [virtual] |
Print the PDU's header to a stream.
| virtual void DtPdu::printToStream | ( | std::ostream & | stream | ) | const [virtual] |
Print the contents of the PDU by calling printHeaderToStream and printDataToStream.
| DtProtocolFamily DtPdu::protocolFamily | ( | ) | const [inline, virtual] |
Returns protocol family from PDU header.
References netHeader().
| int DtPdu::protocolVersion | ( | ) | const [inline, virtual] |
References netHeader(), and DtNetPduHeader::version.
| void DtPdu::setExerciseId | ( | int | id | ) | [inline, virtual] |
Set/Get exerciseID in PDU header.
References DtNetPduHeader::DtExercise, and netHeader().
| void DtPdu::setStatus | ( | int | okStatus | ) | [inline, protected, virtual] |
Sets the PDU's status to okStatus.
References myOKStatus.
| void DtPdu::setTimeStamp | ( | DtTime | time, |
| DtTimeStampType | type = DtTimeStampRelative |
||
| ) | [inline, virtual] |
Set the PDU header's time stamp to reflect time and type.
Time is in seconds, but only the time modulo an hour actually gets into the time stamp.
References DtNetPduHeader::DtTime, and netHeader().
| void DtPdu::setVersion | ( | int | vers | ) | [inline, virtual] |
Set/Get protocol version from PDU header.
References netHeader(), and DtNetPduHeader::version.
| virtual void DtPdu::sizeChanged | ( | int | size | ) | [protected, virtual] |
Called by changeSize. Sets the size in the header to size.
Implements DtBaseMsg.
| int DtPdu::status | ( | ) | const [inline, virtual] |
Get PDU status.
DtSTATUS_OK means it's good. Other values indicate a bad PDU. Return codes are derived PDU-dependent.
References myOKStatus.
| DtTime DtPdu::timeStamp | ( | ) | const [inline, virtual] |
Return the time (in seconds past an hour) encoded in the PDU header's time stamp.
References DtNetPduHeader::DtTime, netHeader(), and DtNetTimeStamp::time().
| DtTimeStampType DtPdu::timeStampType | ( | ) | const [inline, virtual] |
Return the type of the time stamp, as indicated in PDU header.
References DtNetPduHeader::DtTime, netHeader(), and DtNetTimeStamp::type().
int DtPdu::myOKStatus [protected] |
Referenced by setStatus(), and status().