MAK Data Logger API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
ExtendPdu Class Reference

Define the ExtendPdu class. More...

+ Inheritance diagram for ExtendPdu:
+ Collaboration diagram for ExtendPdu:

Public Member Functions

 ExtendPdu (DtBufferPtr buffer=DtUSE_INTERNAL_BUFFER)
 Blank constructor - constructs a blank ExtendPdu ready to be filled out and sent by application code. More...
 
 ExtendPdu (const NetTestPdu *initial, DtBufferPtr buffer=DtUSE_INTERNAL_BUFFER, DtPduFactory *pduFactory=0)
 From-network-representation constructor. More...
 
virtual ~ExtendPdu ()
 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...
 
 ExtendPdu (const ExtendPdu &orig)
 Copy constructor. More...
 
ExtendPdu & operator= (const ExtendPdu &orig)
 Assignment operator. More...
 
virtual void printDataToStream (std::ostream &stream) 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 NetTestPdu * netTestPdu ()
 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 NetTestPdu * netTestPdu () const
 

Static Public Member Functions

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

Protected Member Functions

virtual DtPduKind internalGetPduKind () const
 Virtual function override. More...
 

Detailed Description

Define the ExtendPdu class.

Constructor & Destructor Documentation

ExtendPdu::ExtendPdu ( DtBufferPtr  buffer = DtUSE_INTERNAL_BUFFER)

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

Required.

ExtendPdu::ExtendPdu ( 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 ExtendPdu::~ExtendPdu ( )
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.

ExtendPdu::ExtendPdu ( const ExtendPdu &  orig)

Copy constructor.

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

Member Function Documentation

virtual int ExtendPdu::a ( ) const
virtual
static void ExtendPdu::addCallback ( DtExerciseConn *  conn,
ExtendPduCb  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 for TestPduKind (200), 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 ExtendPdu::b ( int  index) const
virtual
virtual float ExtendPdu::c ( ) const
virtual
static DtPdu* ExtendPdu::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 ExtendPdu::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.

virtual NetTestPdu* ExtendPdu::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* ExtendPdu::netTestPdu ( ) const
virtual
ExtendPdu& ExtendPdu::operator= ( const ExtendPdu &  orig)

Assignment operator.

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

virtual void ExtendPdu::printDataToStream ( std::ostream &  stream) 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.

static void ExtendPdu::removeCallback ( DtExerciseConn *  conn,
ExtendPduCb  cb,
void *  usr 
)
static
virtual void ExtendPdu::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 ExtendPdu::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 ExtendPdu::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 Nov 17 15:25:07 EST 2026 from SVN revision 298446
Copyright © 2026 MAK Technologies. All Rights Reserved (www.mak.com)