MAK RTIspy API Documentation for HLA 1516
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Friends
DtAssistantTemplateMsg Class Reference

DtAssistantTemplateMsg defines a base class which can be subclassed to quickly produce a new Assistant messages based on templates and macros. More...

+ Inheritance diagram for DtAssistantTemplateMsg:
+ Collaboration diagram for DtAssistantTemplateMsg:

Public Member Functions

virtual ~DtAssistantTemplateMsg ()
 Destructor.
unsigned addParameter (DtRtiBaseMsgParam *param)
 Adds a new parameter to this message.
virtual void printData () const
 Print the data section. Message parameters must be created first.
- Public Member Functions inherited from DtAssistantMsg
virtual ~DtAssistantMsg ()
 Destructor.
virtual DtAssistantMsgclone (bool copy=true) const =0
 Return a copy/empty object of the same type as this.
virtual DtNetAssistantMsgHeadernetHeader () const
 Get header of network representation.
virtual int version () const
 Return the message version.
virtual bool isValidVersion () const
 Returns bool: message version is valid?
virtual DtAssistantMsgKind msgKind () const
 Get the message kind.
virtual void print () const
 Printing functions.
virtual void printHeader () const
virtual bool isOk () const
 Message is good?
bool isAssistantToAssistantMessage () const
 Returns whether or not this message contains source/destination information included in messages sent between assistants.
virtual MAKRti::DtInetAddr sourceAddr () const
 Get/Set the IP address of the source of this message.
virtual void setSourceAddr (const MAKRti::DtInetAddr &addr)
virtual int sourceId () const
 Get/Set the ID of the source of this message.
virtual void setSourceId (int id)
virtual MAKRti::DtString sourceHost () const
 Get/Set the host name of the source of this message.
virtual void setSourceHost (const MAKRti::DtString &addr)
virtual MAKRti::DtInetAddr destAddr () const
 Get/Set the IP address of the destination of this message.
virtual void setDestAddr (const MAKRti::DtInetAddr &addr)
virtual int destId () const
 Get/Set the ID of the destination of this message.
virtual void setDestId (int id)
virtual int compId () const
 Get/Set the related component's connection ID.
virtual void setCompId (int compId)

Protected Member Functions

 DtAssistantTemplateMsg (DtAssistantMsgKind msgKind)
 Constructor.
virtual DtAssistantMsgKind internalMsgKind ()
 Returns the kind of this message.
virtual int minSize () const
 Returns minimum size of a message, including header.
- Protected Member Functions inherited from DtAssistantMsg
 DtAssistantMsg ()
 Constructor.
virtual void sizeChanged (int size)
 Called whenever size is changed using changeSize, or insert/deleteBytes.
void initAssistantMsg (int size, DtAssistantMsgKind msgKindVal, DtBufferPtr buffer)
 Called by ctor, so not virtual.
void initAssistantMsg (const void *initial, int size, DtBufferPtr buffer)
void initAssistantMsg (const DtNetAssistantMsgHeader *header, DtBufferPtr buffer)
virtual void adjustBytes (int offset, int numBytes)
 Adjust numBytes bytes at the indicated offset in the net rep.
virtual void adjustBytes (void *address, int numBytes)
 Adjust the numBytes starting at the indicated address.
virtual void resizeForSrcDestInfo ()
 Allocates memory at the end of the message for source/destination information needed when sending messages between assistants.
virtual const
DtNetAssistantSrcDestInfo
srcDestInfoPtr () const
 Return pointer to source/destination information in the message.
virtual DtNetAssistantSrcDestInfosrcDestInfoPtr ()
virtual void setSourceHostSize (unsigned long size)
 Set/Get source host name text size.
virtual unsigned long sourceHostSize () const
virtual const char * sourceHostPtr () const
 Return pointer to source host name in message.
virtual char * sourceHostPtr ()

Protected Attributes

DtNetAssistantMsgHeaderParammyHeaderParam
 The parameter which points to the message header.
std::vector< DtRtiBaseMsgParam * > myMsgParams
 The list of other message parameters.
DtAssistantMsgKind myMsgKind
 The message kind.
int myMinSize
 The minimum size needed for this message.

Friends

class DtNetAssistantMsgHeaderParam

Additional Inherited Members

- Static Public Member Functions inherited from DtAssistantMsg
static const char * kindToString (DtAssistantMsgKind kind)
 Returns the name of the message, by kind enumeration.

Detailed Description

DtAssistantTemplateMsg defines a base class which can be subclassed to quickly produce a new Assistant messages based on templates and macros.

To produce a new message class: 1) Declare your class a subclass of DtRtiTemplateMsg. 2) In your class definition use DtASTNT_DECLARE_STANDARD_MSG_METHODS. 3) In your class definition use at least one of the DtASTNT_DECLARE_*_CALLBACK_METHODS macros. 4) In your class definition use the parameter declaration macros defined in rtiTemplateMsgParams.h or any of the other template param files to declare your template parameters. 5) In your .cxx file use DtDEFINE_STANDARD_MSG_METHODS. 6) In your .cxx file use use at least one of the DtASTNT_DEFINE_*_CALLBACK_METHODS macros. 7) In your .cxx file, define a method of your class void addAllParameters() which contains calls to the macro ADD_PARAMETER (or any of the other type-specific versions) for each of your parameters. Make sure to add them in the proper order for byte alignment. The could will assert if you do not have a correct alignment. 8) In your .cxx file, use the parameter method definition macros defined in rtiTemplateMsgParams.h or any of the other template param files to define your get and set methods for each of your parameters. The unit tests for this class have several example messages. Check out testAssistantTemplateMsg.h and testAssistantTemplateMsg.cxx.

Constructor & Destructor Documentation

DtAssistantTemplateMsg::~DtAssistantTemplateMsg ( )
virtual

Destructor.

References myHeaderParam.

DtAssistantTemplateMsg::DtAssistantTemplateMsg ( DtAssistantMsgKind  msgKind)
protected

Member Function Documentation

unsigned DtAssistantTemplateMsg::addParameter ( DtRtiBaseMsgParam param)

Adds a new parameter to this message.

Returns the index of the new item in the parameter array. Parameters must be added in order. Take care to ensure proper alignment.

References DtRtiBaseMsgParam::minSize(), myHeaderParam, myMinSize, myMsgParams, and DtRtiBaseMsgParam::setPrevParam().

DtAssistantMsgKind DtAssistantTemplateMsg::internalMsgKind ( )
protectedvirtual

Returns the kind of this message.

Implements DtAssistantMsg.

References myMsgKind.

int DtAssistantTemplateMsg::minSize ( ) const
protectedvirtual

Returns minimum size of a message, including header.

Message parameters must be created first.

References myMinSize.

void DtAssistantTemplateMsg::printData ( ) const
virtual

Print the data section. Message parameters must be created first.

Reimplemented from DtAssistantMsg.

References myMsgParams.

Friends And Related Function Documentation

friend class DtNetAssistantMsgHeaderParam
friend

Referenced by DtAssistantTemplateMsg().

Member Data Documentation

DtNetAssistantMsgHeaderParam* DtAssistantTemplateMsg::myHeaderParam
protected

The parameter which points to the message header.

Referenced by addParameter(), DtAssistantTemplateMsg(), and ~DtAssistantTemplateMsg().

int DtAssistantTemplateMsg::myMinSize
protected

The minimum size needed for this message.

Referenced by addParameter(), DtAssistantTemplateMsg(), and minSize().

DtAssistantMsgKind DtAssistantTemplateMsg::myMsgKind
protected

The message kind.

Referenced by internalMsgKind().

std::vector<DtRtiBaseMsgParam*> DtAssistantTemplateMsg::myMsgParams
protected

The list of other message parameters.

Referenced by addParameter(), DtAssistantTemplateMsg(), and printData().


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

Document ID: Generated on Tue May 7 16:26:47 EDT 2013 from SVN revision 126903
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)