MAK RTIspy API Documentation for HLA 1516
Classes | Macros | Enumerations
rtiTemplateMsgArrayParams.h File Reference

This file defines the DtRtiArrayMsgParam template which can be used to create a message parameter which is a variable length array of elements for template based message classes. More...

Go to the source code of this file.

Classes

class  DtRtiArraySizeMsgParam< ParamType, NetParamType >
 The template for an RTI message parameter which is actually the size of an array. More...
class  DtRtiArrayMsgParam< ParamType, ConvParamType, NetParamType, AllocatedMsgParamType >
 The template for an RTI message parameter which is actually an array of items of the same type. More...
class  DtRtiArrayMsgParam< char, char, char, AllocatedMsgParamType >
 Template specialization for a string RTI message parameter. More...

Macros

#define DtDECLARE_ARRAY_SIZE_PARAMETER_METHODS(ParamName, BitSize)
#define DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS(ParamName, CtrType)
#define DtDECLARE_ARRAY_PARAMETER_POINTER_METHODS(ParamName, ParamType)
#define DtDECLARE_ARRAY_PARAMETER_METHODS(ParamName, ParamType)
#define DtDECLARE_UNSIGNED_ARRAY_PARAMETER_METHODS(ParamName, BitSize, CountBitSize)
#define DtDECLARE_INT_ARRAY_PARAMETER_METHODS(ParamName, BitSize, CountBitSize)
#define DtDECLARE_BOOL_ARRAY_PARAMETER_METHODS(ParamName, CountBitSize)
#define DtDECLARE_ENUMERATION_ARRAY_PARAMETER_METHODS(ParamName, EnumType, BitSize, CountBitSize)
#define DtDECLARE_FLOAT_ARRAY_PARAMETER_METHODS(ParamName, BitSize, CountBitSize)
#define DtDECLARE_STRING_PARAMETER_METHODS(ParamName, LengthBitSize)
#define DtDECLARE_STRING_ARRAY_PARAMETER_METHODS(ParamName, LengthBitSize)
#define DtDEFINE_ARRAY_SIZE_PARAMETER_METHODS(ClassName, ParamName, BitSize)
#define DtDEFINE_ARRAY_PARAMETER_CONTAINER_METHODS(ClassName, ParamName, ParamType, BitSize, CtrType)
#define DtDEFINE_ARRAY_PARAMETER_POINTER_METHODS(ClassName, ParamName, ParamType, BitSize)
#define DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, ParamType, BitSize)
#define DtDEFINE_UNSIGNED_ARRAY_PARAMETER_METHODS(ClassName, ParamName, BitSize)   DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, MAKRti::DtU##BitSize, BitSize)
#define DtDEFINE_INT_ARRAY_PARAMETER_METHODS(ClassName, ParamName, BitSize)   DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, MAKRti::DtInt##BitSize, BitSize)
#define DtDEFINE_ENUMERATION_ARRAY_PARAMETER_METHODS(ClassName, ParamName, EnumType, BitSize)   DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, EnumType, BitSize)
#define DtDEFINE_BOOL_ARRAY_PARAMETER_METHODS(ClassName, ParamName)   DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, bool, 8)
#define DtDEFINE_FLOAT_ARRAY_PARAMETER_METHODS(ClassName, ParamName, BitSize)   DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, MAKRti::DtFloat##BitSize, BitSize)
#define DtDEFINE_STRING_PARAMETER_METHODS(ClassName, ParamName)
#define DtDEFINE_STRING_ARRAY_PARAMETER_CONTAINER_METHODS(ClassName, ParamName, CtrType)
#define DtDEFINE_STRING_ARRAY_PARAMETER_METHODS(ClassName, ParamName)
#define DtADD_ARRAY_PARAMETER(ParamName, SizeParamName)   addParameter(my##ParamName = new ParamName##Type(ParamName##Name, my##SizeParamName));

Enumerations

enum  DtResizeArrayFlag { DtDoNotResize, DtResizeIfNeeded }

Detailed Description

This file defines the DtRtiArrayMsgParam template which can be used to create a message parameter which is a variable length array of elements for template based message classes.

It also defines easy macros to make creating a new message simpler. See rtiTemplateMsgParams.h for the template and macros for simple types.

Macro Definition Documentation

#define DtADD_ARRAY_PARAMETER (   ParamName,
  SizeParamName 
)    addParameter(my##ParamName = new ParamName##Type(ParamName##Name, my##SizeParamName));
#define DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS (   ParamName,
  CtrType 
)
Value:
public: \
void set##ParamName(const CtrType& val, \
void get##ParamName(CtrType&) const;
#define DtDECLARE_ARRAY_PARAMETER_METHODS (   ParamName,
  ParamType 
)
Value:
public: \
static const char* ParamName##Name; \
DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS(ParamName, std::set<ParamType>) \
DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS(ParamName, std::vector<ParamType>) \
DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS(ParamName, std::deque<ParamType>) \
DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS(ParamName, std::list<ParamType>) \
DtDECLARE_ARRAY_PARAMETER_POINTER_METHODS(ParamName, ParamType)
#define DtDECLARE_ARRAY_PARAMETER_POINTER_METHODS (   ParamName,
  ParamType 
)
Value:
public: \
void set##ParamName(const ParamType* inputBuff, unsigned numItems, \
unsigned get##ParamName(ParamType* outputBuff) const; /*returns num items*/
#define DtDECLARE_ARRAY_SIZE_PARAMETER_METHODS (   ParamName,
  BitSize 
)
Value:
DtDECLARE_PARAMETER_METHODS(ParamName, MAKRti::DtU##BitSize) \
protected: \
ParamName##Type* my##ParamName; \
public: \
void reserveSpaceFor##ParamName(unsigned num);
#define DtDECLARE_BOOL_ARRAY_PARAMETER_METHODS (   ParamName,
  CountBitSize 
)
Value:
protected: \
typedef DtRtiArrayMsgParam<bool, MAKRti::DtU8, MAKRti::DtNetU8, \
ParamName##Type* my##ParamName;
#define DtDECLARE_ENUMERATION_ARRAY_PARAMETER_METHODS (   ParamName,
  EnumType,
  BitSize,
  CountBitSize 
)
Value:
DtDECLARE_ARRAY_PARAMETER_METHODS(ParamName, EnumType) \
protected: \
typedef DtRtiArrayMsgParam<EnumType, MAKRti::DtU##BitSize, MAKRti::DtNetU##BitSize, \
ParamName##Type* my##ParamName;
#define DtDECLARE_FLOAT_ARRAY_PARAMETER_METHODS (   ParamName,
  BitSize,
  CountBitSize 
)
Value:
DtDECLARE_ARRAY_PARAMETER_METHODS(ParamName, MAKRti::DtFloat##BitSize) \
protected: \
typedef DtRtiArrayMsgParam<MAKRti::DtFloat##BitSize, MAKRti::DtFloat##BitSize, MAKRti::DtNetFloat##BitSize,\
ParamName##Type* my##ParamName;
#define DtDECLARE_INT_ARRAY_PARAMETER_METHODS (   ParamName,
  BitSize,
  CountBitSize 
)
Value:
DtDECLARE_ARRAY_PARAMETER_METHODS(ParamName, MAKRti::DtInt##BitSize) \
protected: \
typedef DtRtiArrayMsgParam<MAKRti::DtInt##BitSize, MAKRti::DtInt##BitSize, MAKRti::DtNetInt##BitSize,\
ParamName##Type* my##ParamName;
#define DtDECLARE_STRING_ARRAY_PARAMETER_METHODS (   ParamName,
  LengthBitSize 
)
Value:
public: \
static const char* ParamName##Name; \
DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS(ParamName, std::set<MAKRti::DtString>) \
DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS(ParamName, std::vector<MAKRti::DtString>) \
DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS(ParamName, std::list<MAKRti::DtString>) \
DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS(ParamName, std::deque<MAKRti::DtString>) \
protected: \
typedef DtRtiArrayMsgParam<char, char, char, \
ParamName##Type* my##ParamName;
#define DtDECLARE_STRING_PARAMETER_METHODS (   ParamName,
  LengthBitSize 
)
Value:
public: \
static const char* ParamName##Name; \
DtDECLARE_ARRAY_PARAMETER_CONTAINER_METHODS(ParamName, MAKRti::DtString) \
DtDECLARE_ARRAY_PARAMETER_POINTER_METHODS(ParamName, char) \
protected: \
typedef DtRtiArrayMsgParam<char, char, char, \
ParamName##Type* my##ParamName;
#define DtDECLARE_UNSIGNED_ARRAY_PARAMETER_METHODS (   ParamName,
  BitSize,
  CountBitSize 
)
Value:
DtDECLARE_ARRAY_PARAMETER_METHODS(ParamName, MAKRti::DtU##BitSize) \
protected: \
typedef DtRtiArrayMsgParam<MAKRti::DtU##BitSize, MAKRti::DtU##BitSize, MAKRti::DtNetU##BitSize, \
ParamName##Type* my##ParamName;
#define DtDEFINE_ARRAY_PARAMETER_CONTAINER_METHODS (   ClassName,
  ParamName,
  ParamType,
  BitSize,
  CtrType 
)
Value:
void ClassName::set##ParamName(const CtrType& container, \
DtResizeArrayFlag resizeFlag) \
{ \
unsigned currNum = my##ParamName->numItems(); \
if(resizeFlag == DtResizeIfNeeded && container.size() != currNum) \
{ \
unsigned currSize = currNum * BitSize/8; \
unsigned newSize = container.size() * BitSize/8; \
char* begPtr = static_cast<char*>(my##ParamName->beginPtr()); \
if(newSize > currSize) \
{ \
insertBytes(begPtr + currSize, newSize - currSize); \
} \
else if(currSize > newSize) \
{ \
deleteBytes(begPtr + newSize, currSize - newSize); \
} \
my##ParamName->setNumItems(container.size()); \
} \
my##ParamName->setParams(container); \
} \
void ClassName::get##ParamName(CtrType& container) const \
{ \
my##ParamName->getParams(container); \
}
#define DtDEFINE_ARRAY_PARAMETER_METHODS (   ClassName,
  ParamName,
  ParamType,
  BitSize 
)
Value:
const char* ClassName::ParamName##Name = #ParamName; \
DtDEFINE_ARRAY_PARAMETER_CONTAINER_METHODS(ClassName, ParamName, ParamType, BitSize, std::set<ParamType>) \
DtDEFINE_ARRAY_PARAMETER_CONTAINER_METHODS(ClassName, ParamName, ParamType, BitSize, std::vector<ParamType>) \
DtDEFINE_ARRAY_PARAMETER_CONTAINER_METHODS(ClassName, ParamName, ParamType, BitSize, std::list<ParamType>) \
DtDEFINE_ARRAY_PARAMETER_CONTAINER_METHODS(ClassName, ParamName, ParamType, BitSize, std::deque<ParamType>) \
DtDEFINE_ARRAY_PARAMETER_POINTER_METHODS(ClassName, ParamName, ParamType, BitSize)
#define DtDEFINE_ARRAY_PARAMETER_POINTER_METHODS (   ClassName,
  ParamName,
  ParamType,
  BitSize 
)
Value:
void ClassName::set##ParamName(const ParamType* buff, unsigned num, \
DtResizeArrayFlag resizeFlag) \
{ \
unsigned currNum = my##ParamName->numItems(); \
if(resizeFlag == DtResizeIfNeeded && num != currNum) \
{ \
unsigned currSize = currNum * BitSize/8; \
unsigned newSize = num * BitSize/8; \
char* begPtr = static_cast<char*>(my##ParamName->beginPtr()); \
if(newSize > currSize) \
{ \
insertBytes(begPtr + currSize, newSize - currSize); \
} \
else if(currSize > newSize) \
{ \
deleteBytes(begPtr + newSize, currSize - newSize); \
} \
my##ParamName->setNumItems(num); \
} \
my##ParamName->setParams(buff, num); \
} \
unsigned ClassName::get##ParamName(ParamType* buff) const \
{ \
return my##ParamName->getParams(buff); \
}
#define DtDEFINE_ARRAY_SIZE_PARAMETER_METHODS (   ClassName,
  ParamName,
  BitSize 
)
Value:
DtDEFINE_UNSIGNED_PARAMETER_METHODS(ClassName, ParamName, BitSize) \
void ClassName::reserveSpaceFor##ParamName(unsigned num) \
{ \
void* p = my##ParamName->firstArrayPtr(); \
if(p && my##ParamName->param() == 0) \
{ \
unsigned bytes = my##ParamName->bytesNeeded(num); \
insertBytes(p, bytes); \
my##ParamName->setParam(num); \
} \
}
#define DtDEFINE_BOOL_ARRAY_PARAMETER_METHODS (   ClassName,
  ParamName 
)    DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, bool, 8)
#define DtDEFINE_ENUMERATION_ARRAY_PARAMETER_METHODS (   ClassName,
  ParamName,
  EnumType,
  BitSize 
)    DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, EnumType, BitSize)
#define DtDEFINE_FLOAT_ARRAY_PARAMETER_METHODS (   ClassName,
  ParamName,
  BitSize 
)    DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, MAKRti::DtFloat##BitSize, BitSize)
#define DtDEFINE_INT_ARRAY_PARAMETER_METHODS (   ClassName,
  ParamName,
  BitSize 
)    DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, MAKRti::DtInt##BitSize, BitSize)
#define DtDEFINE_STRING_ARRAY_PARAMETER_CONTAINER_METHODS (   ClassName,
  ParamName,
  CtrType 
)
#define DtDEFINE_STRING_ARRAY_PARAMETER_METHODS (   ClassName,
  ParamName 
)
Value:
const char* ClassName::ParamName##Name = #ParamName; \
DtDEFINE_STRING_ARRAY_PARAMETER_CONTAINER_METHODS(ClassName, ParamName, std::set<MAKRti::DtString>)\
DtDEFINE_STRING_ARRAY_PARAMETER_CONTAINER_METHODS(ClassName, ParamName, std::vector<MAKRti::DtString>)\
DtDEFINE_STRING_ARRAY_PARAMETER_CONTAINER_METHODS(ClassName, ParamName, std::list<MAKRti::DtString>)\
DtDEFINE_STRING_ARRAY_PARAMETER_CONTAINER_METHODS(ClassName, ParamName, std::deque<MAKRti::DtString>)
#define DtDEFINE_STRING_PARAMETER_METHODS (   ClassName,
  ParamName 
)
#define DtDEFINE_UNSIGNED_ARRAY_PARAMETER_METHODS (   ClassName,
  ParamName,
  BitSize 
)    DtDEFINE_ARRAY_PARAMETER_METHODS(ClassName, ParamName, MAKRti::DtU##BitSize, BitSize)

Enumeration Type Documentation

Enumerator:
DtDoNotResize 
DtResizeIfNeeded 

Document ID: Generated on Fri Mar 14 19:08:55 EDT 2014 from SVN revision 137085
Copyright © 2005-2014 VT MÄK Inc. All Rights Reserved (www.mak.com)