VR-Link API Documentation for DIS
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:

List of all members.

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.
 TestPdu (const NetTestPdu *initial, DtBufferPtr buffer=DtUSE_INTERNAL_BUFFER)
 From-network-representation constructor.
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.
 TestPdu (const TestPdu &orig)
 Copy constructor.
TestPduoperator= (const TestPdu &orig)
 Assignment operator.
virtual void printData () const
 Virtual function override.
virtual void setA (int val)
 Inspector and mutator functions for the PDU class' data.
virtual int a () const
virtual void setB (int index, int val)
 Set/Get the index'th element of the "b" array.
virtual int b (int index) const
virtual void setC (float val)
 Set/Get the value of c.
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.
virtual const NetTestPdunetTestPdu () const

Static Public Member Functions

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

Protected Member Functions

virtual DtPduKind internalGetPduKind () const
 Virtual function override.

Detailed Description

Define the TestPdu class.


Constructor & Destructor Documentation

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 
)

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 
) [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 [protected, virtual]

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 Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)