#include <CigiIGMsgV2.h>
Inheritance diagram for CigiIGMsgV2:
Public Member Functions | |
CigiIGMsgV2 () | |
virtual | ~CigiIGMsgV2 () |
virtual int | Pack (CigiBasePacket *Base, unsigned char *Buff, void *Spec) const |
virtual int | Unpack (unsigned char *Buff, bool Swap, void *Spec) |
virtual int | GetTruePacketSize (CigiBaseVariableSizePckt &refPacket) |
int | SetMsg (const Cigi_Ascii *MsgIn, bool bndchk=true) |
Definition at line 58 of file CigiIGMsgV2.h.
CigiIGMsgV2::CigiIGMsgV2 | ( | ) |
General Constructor
Definition at line 87 of file CigiIGMsgV2.cpp.
References CIGI_IG_MSG_PACKET_ID_V2, CigiBasePacket::MinorVersion, CigiBaseIGMsg::Msg, CigiBaseIGMsg::MsgID, CigiBaseIGMsg::MsgLen, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseVariableSizePckt::VariableDataSize, and CigiBasePacket::Version.
00088 { 00089 00090 PacketID = CIGI_IG_MSG_PACKET_ID_V2; 00091 PacketSize = 8; 00092 Version = 2; 00093 MinorVersion = 0; 00094 00095 MsgID = 0; 00096 memset(Msg,0,4); 00097 VariableDataSize = MsgLen = 4; 00098 00099 }
CigiIGMsgV2::~CigiIGMsgV2 | ( | ) | [virtual] |
int CigiIGMsgV2::GetTruePacketSize | ( | CigiBaseVariableSizePckt & | refPacket | ) | [virtual] |
A virtual function to determine the size that the packet will take up when packed.
refPacket | - A pointer to the current pack point. |
Implements CigiBaseIGMsg.
Definition at line 187 of file CigiIGMsgV2.cpp.
References CigiBaseVariableSizePckt::GetVariableDataSize().
00188 { 00189 return(refPacket.GetVariableDataSize() + 4); 00190 }
virtual int CigiIGMsgV2::Pack | ( | CigiBasePacket * | Base, | |
unsigned char * | Buff, | |||
void * | Spec | |||
) | const [virtual] |
The virtual Pack function for CIGI 2
Base | - A pointer to the instance of the packet to be packed. (Downcast to CigiBasePacket) | |
Buff | - A pointer to the current pack point. | |
Spec | - A pointer to special data - This is not used in this class. |
int CigiIGMsgV2::SetMsg | ( | const Cigi_Ascii * | MsgIn, | |
bool | bndchk = true | |||
) |
Sets the Msg with bound checking control
MsgIn | - Message string | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 202 of file CigiIGMsgV2.cpp.
References CIGI_SUCCESS, CigiBaseIGMsg::Msg, CigiBasePacket::PacketSize, and CigiBaseVariableSizePckt::VariableDataSize.
00203 { 00204 00205 MsgLen = strlen(MsgIn); 00206 00207 if(MsgLen == 0) 00208 { 00209 MsgLen = 4; 00210 memset(Msg,0,4); 00211 } 00212 else if(MsgLen >= 95) 00213 { 00214 MsgLen = 100; 00215 memcpy(Msg,MsgIn,95); 00216 memset(&Msg[MsgLen],0,5); 00217 Msg[99] = 0; 00218 } 00219 else 00220 { 00221 memcpy(Msg,MsgIn,MsgLen); 00222 00223 int tadj = (MsgLen + 1) % 4; 00224 00225 tadj = (tadj == 0) ? 1 : (5 - tadj); 00226 00227 memset(&Msg[MsgLen],0,(tadj+4)); 00228 00229 MsgLen += tadj; 00230 } 00231 00232 VariableDataSize = MsgLen; 00233 PacketSize = VariableDataSize + 4; 00234 00235 return(CIGI_SUCCESS); 00236 }
virtual int CigiIGMsgV2::Unpack | ( | unsigned char * | Buff, | |
bool | Swap, | |||
void * | Spec | |||
) | [virtual] |
The virtual Unpack function for CIGI 2
Buff | - A pointer to the current pack point. | |
Swap | - N/A for V1 & V2 | |
Spec | - A pointer to special data - This is not used in this class. |