VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
TestPdu Class Reference

Define the TestPdu class. More...

+ Inheritance diagram for TestPdu:
+ Collaboration diagram for TestPdu:

Public Member Functions

 TestPdu (DtBufferPtr buffer=DtUSE_INTERNAL_BUFFER)
 Blank constructor - constructs a blank TestPdu ready to be filled out and sent by application code. More...
 
 TestPdu (const NetTestPdu *initial, DtBufferPtr buffer=DtUSE_INTERNAL_BUFFER, DtPduFactory *pduFactory=0)
 From-network-representation constructor. More...
 
virtual ~TestPdu ()
 Destructor - Not required by VR-Link, but should clearly be written if this class has any dynamic data that needs to be cleaned up. More...
 
 TestPdu (const TestPdu &orig)
 Copy constructor. More...
 
TestPduoperator= (const TestPdu &orig)
 Assignment operator. More...
 
virtual void printData () const
 Virtual function override. More...
 
virtual void setA (int val)
 Inspector and mutator functions for the PDU class' data. More...
 
virtual int a () const
 
virtual void setB (int index, int val)
 Set/Get the index'th element of the "b" array. More...
 
virtual int b (int index) const
 
virtual void setC (float val)
 Set/Get the value of c. More...
 
virtual float c () const
 
virtual NetTestPdunetTestPdu ()
 Returns a pointer to the PDU's network representation by casting the value returned by the base class' packet() function to a NetTestPdu. More...
 
virtual const NetTestPdunetTestPdu () const
 
- Public Member Functions inherited from DtPdu
virtual ~DtPdu ()
 Destructor. More...
 
 DtPdu (const DtPdu &pdu, DtBufferPtr buffer=DtUSE_INTERNAL_BUFFER)
 Copy constructor. More...
 
DtPduoperator= (const DtPdu &pdu)
 Assignment operator. More...
 
virtual void * packet () const
 Older function that returns a pointer to the network representation. More...
 
virtual int status () const
 Get PDU status. More...
 
virtual void setVersion (int vers)
 Set/Get protocol version from PDU header. More...
 
virtual int protocolVersion () const
 
virtual void setExerciseId (int id)
 Set/Get exerciseID in PDU header. More...
 
virtual int exerciseId () const
 
virtual DtPduKind kind () const
 Returns PDU kind from PDU header. More...
 
virtual DtProtocolFamily protocolFamily () const
 Returns protocol family from PDU header. More...
 
virtual void setTimeStamp (DtTime time, DtTimeStampType type=DtTimeStampRelative)
 Set the PDU header's time stamp to reflect time and type. More...
 
virtual DtTime timeStamp () const
 Return the time (in seconds past an hour) encoded in the PDU header's time stamp. More...
 
virtual DtTimeStampType timeStampType () const
 Return the type of the time stamp, as indicated in PDU header. More...
 
virtual void setReceivedTime (DtTime t)
 absRealTime when PDU was received into buffer. More...
 
virtual DtTime receivedTime () const
 
virtual void setPduLength (unsigned int length)
 Set the PDU header's length. More...
 
virtual unsigned int pduLength () const
 Return the length of the PDU, as indicated in the PDU header. More...
 
virtual void setPduStatus (int)
 Set the PDU Status in the PDU header. More...
 
virtual int pduStatus () const
 Returns the PDU Status from the PDU header. More...
 
virtual void setTransferredEntityIndicator (bool difference)
 Set the Transferred Entity Indicator in the PDU header False is No Difference True is Difference. More...
 
virtual bool transferredEntityIndicator () const
 Returns the Transferred Entity Indicator from the PDU header False is No Difference True is Difference. More...
 
virtual void setLvcIndicator (DtPduStatusLVCIndicator lvcIndicator)
 Set the LVC Indicator in the PDU header. More...
 
virtual DtPduStatusLVCIndicator lvcIndicator () const
 Returns the LVC Indicator from the PDU header. More...
 
virtual void setCoupledExtensionIndicator (bool coupled)
 Set the Coupled Extension Indicator in the PDU Header False is Not Coupled True is Coupled. More...
 
virtual bool coupledExtensionIndicator () const
 Returns the Coupled Extension Indicator from the PDU Header False is Not Coupled True is Coupled. More...
 
virtual void setFireTypeIndicator (DtPduStatusFireTypeIndicator fireTypeIndicator)
 Set the Fire Type Indicator in the PDU header. More...
 
virtual
DtPduStatusFireTypeIndicator 
fireTypeIndicator () const
 Returns the Fire Type Indicator from the PDU header. More...
 
virtual void setDetonationTypeIndicator (DtPduStatusDetonationTypeIndicator detonationTypeIndicator)
 Set the Detonation Type Indicator in the PDU header. More...
 
virtual
DtPduStatusDetonationTypeIndicator 
detonationTypeIndicator () const
 Returns the Detonation Type Indicator from the PDU header. More...
 
virtual void setRadioAttachedIndicator (DtPduStatusRadioAttachedIndicator radioAttachedIndicator)
 Set the Radio Attached Indicator in the PDU header. More...
 
virtual
DtPduStatusRadioAttachedIndicator 
radioAttachedIndicator () const
 Returns the Radio Attached Indicator from the PDU header. More...
 
virtual void setIntercomAttachedIndicator (DtPduStatusIntercomAttachedIndicator intercomAttachedIndicator)
 Set the Intercom Attached Indicator in the PDU header. More...
 
virtual
DtPduStatusIntercomAttachedIndicator 
intercomAttachedIndicator () const
 Returns the Intercom Attached Indicator from the PDU header. More...
 
virtual void setIffSimulationMode (bool interactive)
 Set the IFF Simulation Mode in the PDU header. More...
 
virtual bool iffSimulationMode () const
 Returns the IFF Simulation Mode from the PDU header. More...
 
virtual void setActiveInterrogationIndicator (bool active)
 Set the Active Interrogation Indicator in the PDU header. More...
 
virtual bool activeInterrogationIndicator () const
 Returns the Active Interrogation Indicator from the PDU header. More...
 
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. More...
 
virtual DtNetPduHeadernetHeader () const
 Returns a pointer to the PDU's header. More...
 
virtual void print () const
 Print the contents of the PDU by calling printToStream(DtInfo). More...
 
virtual void printToStream (std::ostream &stream) const
 Print the contents of the PDU by calling printHeaderToStream and printDataToStream. More...
 
virtual void printHeader () const
 Print the PDU's header. This calls printHeaderToStream(DtInfo). More...
 
virtual void printHeaderToStream (std::ostream &stream) const
 Print the PDU's header to a stream. More...
 
virtual void printDataToStream (std::ostream &stream) const
 
virtual void printDataToString (DtString &str) const
 
virtual void printPduInHexToStream (std::ostream &stream, unsigned int numberOfColumns) const
 Prints the entire PDU's internal buffer to the stream in Hex. More...
 
virtual void encode ()
 Encode method. More...
 
virtual void decode (DtPduFactory *pduFactory)
 Decode method. More...
 
virtual bool isTransientPdu () const
 This method returns true if transient, false if state. More...
 
- Public Member Functions inherited from DtBaseMsg
virtual ~DtBaseMsg ()
 Destructor. More...
 
 DtBaseMsg (const DtBaseMsg &msg, DtBufferPtr buffer=DtUSE_INTERNAL_BUFFER)
 Copy constructor. More...
 
DtBaseMsgoperator= (const DtBaseMsg &msg)
 Assignment. More...
 
virtual const char * netRep () const
 Get network representation. More...
 
virtual int length () const
 Get size of message. More...
 
 DtBaseMsg ()
 Constructor Object is not fully constructed until initMsg is called. More...
 
void initMsg (int size, DtBufferPtr bufferPtr)
 
void initMsg (const void *initial, int size, DtBufferPtr bufferPtr)
 
virtual void changeSize (int size)
 Changes the size of the message. More...
 
virtual void changeBufferSize (int size)
 Changes the size of the message buffer, but not the message itself. More...
 
virtual void insertBytes (int offset, int numBytes)
 Inserts numBytes zeroed-out bytes at the indicated offset into the net rep. More...
 
virtual void insertBytes (void *address, int numBytes)
 Inserts numBytes zeroed-out bytes at the indicated address. More...
 
virtual void deleteBytes (int offset, int numBytes)
 Deletes numBytes bytes at the indicated offset in the net rep. More...
 
virtual void deleteBytes (void *address, int numBytes)
 Deletes numBytes bytes starting at the indicated address. More...
 
virtual void clearAll ()
 Zeros out all bytes in the network representation. More...
 
virtual void * newInternalBuffer (int size)
 Sets myInternalBuff to point to a malloc'ed buffer of size bytes. More...
 

Static Public Member Functions

static DtPducreate (const DtNetPacket *initial, DtBufferPtr buffer=DtUSE_INTERNAL_BUFFER, DtPduFactory *pduFactory=0)
 Create and return a new TestPdu. More...
 
static void addCallback (DtExerciseConn *conn, TestPduCb cb, void *usr)
 Wrappers around DtExerciseConn's add/removeCallback functions. More...
 
static void removeCallback (DtExerciseConn *conn, TestPduCb cb, void *usr)
 

Protected Member Functions

virtual DtPduKind internalGetPduKind () const
 Virtual function override. More...
 
- Protected Member Functions inherited from DtPdu
 DtPdu ()
 Constructor. More...
 
virtual void setStatus (int okStatus)
 Sets the PDU's status to okStatus. More...
 
virtual void initPdu (int size, DtBufferPtr buffer)
 Must be called after default ctor before PDU is completely constructed. More...
 
virtual void initPdu (const void *initial, DtBufferPtr buffer, DtPduFactory *pduFactory)
 Called by from-net-rep ctor. Initializes DtBaseMsg. More...
 
virtual DtProtocolFamily kindToFamily (DtPduKind kind) const
 Maps PDU kind to ProtocolFamily. More...
 
virtual void sizeChanged (int size)
 Called by changeSize. Sets the size in the header to size. More...
 
virtual void clearData ()
 zeros out all bytes after the PDU header. More...
 
virtual void initHeader (DtPduKind kind, int size)
 Initializes PDU header. Called by initPdu. More...
 
virtual bool isTEIApplicable () const
 Returns whether a PDU Status is applicable to this PDU (based on PDU Type) These methods are only relevant in DIS 7 and greater. More...
 
virtual bool isLVCApplicable () const
 
virtual bool isCEIApplicable () const
 
virtual bool isFTIApplicable () const
 
virtual bool isDTIApplicable () const
 
virtual bool isRAIApplicable () const
 
virtual bool isIAIApplicable () const
 
virtual bool isISMApplicable () const
 
virtual bool isAIIApplicable () const
 
virtual bool shouldAttributePduBeCoupled () const
 

Additional Inherited Members

- Protected Attributes inherited from DtPdu
DtPduEncodermyEncoder
 
DtPduDecodermyDecoder
 
int myOKStatus
 
DtTime myReceivedTime
 
- Protected Attributes inherited from DtBaseMsg
void * myNetMsg
 
void * myInternalBuff
 
int myIntBuffSize
 
int myMsgSize
 
int myNetworkMsgSize
 

Detailed Description

Define the TestPdu class.

Constructor & Destructor Documentation

TestPdu::TestPdu ( DtBufferPtr  buffer = DtUSE_INTERNAL_BUFFER)

Blank constructor - constructs a blank TestPdu ready to be filled out and sent by application code.

Required.

TestPdu::TestPdu ( const NetTestPdu initial,
DtBufferPtr  buffer = DtUSE_INTERNAL_BUFFER,
DtPduFactory pduFactory = 0 
)

From-network-representation constructor.

Constructs a PDU from an already-filled-out buffer containing the exact bytes that represent this type of PDU. This constructor is used by VR-Link (through the static create function) to create an instance of this class from PDU data received from the network. Required.

virtual TestPdu::~TestPdu ( )
virtual

Destructor - Not required by VR-Link, but should clearly be written if this class has any dynamic data that needs to be cleaned up.

TestPdu::TestPdu ( const TestPdu orig)

Copy constructor.

Not required by VR-Link, but needed if you will ever want to copy TestPdus.

Member Function Documentation

virtual int TestPdu::a ( ) const
virtual
static void TestPdu::addCallback ( DtExerciseConn conn,
TestPduCb  cb,
void *  usr 
)
static

Wrappers around DtExerciseConn's add/removeCallback functions.

Not required since the DtExerciseConn functions may be used instead, but strongly encouraged, so that the non-typesafe cast can be limited to this one place. In addition, within addCallback, we choose to register this class's create function with VR-Link, letting VR-Link know to create one of these to represent the right PDU kind. If this is not done within addCallback, it must be done explicitly by application code that uses this class.

virtual int TestPdu::b ( int  index) const
virtual
virtual float TestPdu::c ( ) const
virtual
static DtPdu* TestPdu::create ( const DtNetPacket initial,
DtBufferPtr  buffer = DtUSE_INTERNAL_BUFFER,
DtPduFactory pduFactory = 0 
)
static

Create and return a new TestPdu.

Basically a wrapper around the constructor. It is necessary because pointers to static functions like this can be registered with a DtPduFactory (which tells VR-Link how to construct an instance of a particular kind of PDU), but constructors can not. Required.

virtual DtPduKind TestPdu::internalGetPduKind ( ) const
protectedvirtual

Virtual function override.

Returns the PDU kind associated with this PDU class. This value goes in the header of all instances of this PDU class. Required.

Implements DtPdu.

virtual NetTestPdu* TestPdu::netTestPdu ( )
virtual

Returns a pointer to the PDU's network representation by casting the value returned by the base class' packet() function to a NetTestPdu.

We include both const and non-const versions. These functions are optional, but they make it easier to write inspectors and mutators.

virtual const NetTestPdu* TestPdu::netTestPdu ( ) const
virtual
TestPdu& TestPdu::operator= ( const TestPdu orig)

Assignment operator.

Not required by VR-Link, but needed if you will ever want to copy TestPdus.

virtual void TestPdu::printData ( ) const
virtual

Virtual function override.

Prints the data values in the PDU. Not strictly required, but encouraged, since otherwise calling print() on an instance of this class will merely print raw hex data.

Reimplemented from DtPdu.

static void TestPdu::removeCallback ( DtExerciseConn conn,
TestPduCb  cb,
void *  usr 
)
static
virtual void TestPdu::setA ( int  val)
virtual

Inspector and mutator functions for the PDU class' data.

These will look different for each DtPdu subclass. None are required by VR-Link, but the class will not be particularly useful without a way to get data in and out in a typesafe manner. Set/Get the value of a.

virtual void TestPdu::setB ( int  index,
int  val 
)
virtual

Set/Get the index'th element of the "b" array.

(Alternatively, we could have created setB() and b() functions that set or returned the whole array all at once.)

virtual void TestPdu::setC ( float  val)
virtual

Set/Get the value of c.


The documentation for this class was generated from the following file:

Document ID: Generated on Tue Feb 2 21:02:17 EST 2021 from SVN revision 223668
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)