MOOS 0.2375
Public Member Functions | Public Attributes
CMOOSMsg Class Reference

#include <MOOSMsg.h>

List of all members.

Public Member Functions

 CMOOSMsg ()
virtual ~CMOOSMsg ()
 CMOOSMsg (char cMsgType, const std::string &sKey, double dfVal, double dfTime=-1)
 CMOOSMsg (char cMsgType, const std::string &sKey, const std::string &sVal, double dfTime=-1)
void MarkAsBinary ()
bool IsDataType (char cDataType) const
bool IsDouble () const
bool IsString () const
bool IsSkewed (double dfTimeNow, double *pdfSkew=NULL)
bool IsYoungerThan (double dfAge) const
bool IsType (char cType) const
double GetTime () const
double GetDouble () const
std::string GetString () const
std::string GetKey () const
std::string GetName () const
std::string GetSource () const
std::string GetSourceAux () const
void SetSourceAux (const std::string &sSrcAux)
std::string GetCommunity () const
std::string GetAsString (int nFieldWidth=12, int nNumDP=5)
void Trace ()
void SetDouble (double dfD)
int Serialize (unsigned char *pBuffer, int nLen, bool bToStream=true)
bool operator< (const CMOOSMsg &Msg) const
unsigned int GetSizeInBytesWhenSerialised () const

Public Attributes

char m_cMsgType
char m_cDataType
std::string m_sKey
int m_nID
double m_dfTime
double m_dfVal
double m_dfVal2
std::string m_sVal
std::string m_sSrc
std::string m_sSrcAux
std::string m_sOriginatingCommunity

Detailed Description

MOOS Comms Messaging class. This is a class encapsulating the data which the MOOS Comms API shuttles between the MOOSDB and other clients

Definition at line 66 of file MOOSMsg.h.


Constructor & Destructor Documentation

CMOOSMsg::CMOOSMsg ( )

standard construction destruction

Definition at line 54 of file MOOSMsg.cpp.

CMOOSMsg::~CMOOSMsg ( ) [virtual]

Definition at line 66 of file MOOSMsg.cpp.

CMOOSMsg::CMOOSMsg ( char  cMsgType,
const std::string &  sKey,
double  dfVal,
double  dfTime = -1 
)

specialised construction

Definition at line 71 of file MOOSMsg.cpp.

CMOOSMsg::CMOOSMsg ( char  cMsgType,
const std::string &  sKey,
const std::string &  sVal,
double  dfTime = -1 
)

specialised construction

Definition at line 92 of file MOOSMsg.cpp.


Member Function Documentation

string CMOOSMsg::GetAsString ( int  nFieldWidth = 12,
int  nNumDP = 5 
)

format the message as string regardless of type

Definition at line 546 of file MOOSMsg.cpp.

std::string CMOOSMsg::GetCommunity ( ) const [inline]

return the name of the MOOS community in which the orginator lives

Definition at line 124 of file MOOSMsg.h.

double CMOOSMsg::GetDouble ( ) const [inline]

return double val of message

Definition at line 108 of file MOOSMsg.h.

std::string CMOOSMsg::GetKey ( ) const [inline]

return the name of the message

Definition at line 114 of file MOOSMsg.h.

std::string CMOOSMsg::GetName ( ) const [inline]

Definition at line 115 of file MOOSMsg.h.

unsigned int CMOOSMsg::GetSizeInBytesWhenSerialised ( ) const

Definition at line 316 of file MOOSMsg.cpp.

std::string CMOOSMsg::GetSource ( ) const [inline]

return the name of the process (as registered with the DB) which posted this notification

Definition at line 119 of file MOOSMsg.h.

std::string CMOOSMsg::GetSourceAux ( ) const [inline]

Definition at line 120 of file MOOSMsg.h.

std::string CMOOSMsg::GetString ( ) const [inline]

return string value of message

Definition at line 111 of file MOOSMsg.h.

double CMOOSMsg::GetTime ( ) const [inline]

return time stamp of message

Definition at line 105 of file MOOSMsg.h.

bool CMOOSMsg::IsDataType ( char  cDataType) const

check data type (MOOS_STRING or MOOS_DOUBLE)

Definition at line 577 of file MOOSMsg.cpp.

bool CMOOSMsg::IsDouble ( ) const [inline]

check data type is double

Definition at line 89 of file MOOSMsg.h.

bool CMOOSMsg::IsSkewed ( double  dfTimeNow,
double *  pdfSkew = NULL 
)

return true if mesage is substantially (SKEW_TOLERANCE) older than dfTimeNow if pdfSkew is not NULL, the time skew is returned in *pdfSkew

A method to check the timestamping of a MOOSMsg. Does so by checking the TimeNow passed to it, and gives the requesting class an idea about how out of sync this message is by comparing the MOOSMsg's time stamp (m_dfTime) to SKEW_TOLERANCE.

Returns:
true if a MOOSMsg's time stamp is either SKEW_TOLERANCE seconds ahead or behind the MOOSDB clock. Will also pass you the pdfSkew, or amount of time difference between the MOOSDB and MOOSMsg timestamp if desired.

Definition at line 521 of file MOOSMsg.cpp.

bool CMOOSMsg::IsString ( ) const [inline]

check data type is string

Definition at line 92 of file MOOSMsg.h.

bool CMOOSMsg::IsType ( char  cType) const

check message type MOOS_NOTIFY, REGISTER etc

Definition at line 479 of file MOOSMsg.cpp.

bool CMOOSMsg::IsYoungerThan ( double  dfAge) const

return true if message is younger that dfAge

Definition at line 507 of file MOOSMsg.cpp.

void CMOOSMsg::MarkAsBinary ( )

Mark string payload as binary

Definition at line 114 of file MOOSMsg.cpp.

bool CMOOSMsg::operator< ( const CMOOSMsg Msg) const [inline]

Definition at line 172 of file MOOSMsg.h.

int CMOOSMsg::Serialize ( unsigned char *  pBuffer,
int  nLen,
bool  bToStream = true 
)

Definition at line 335 of file MOOSMsg.cpp.

void CMOOSMsg::SetDouble ( double  dfD) [inline]

set the Double value

Definition at line 133 of file MOOSMsg.h.

void CMOOSMsg::SetSourceAux ( const std::string &  sSrcAux) [inline]

Definition at line 121 of file MOOSMsg.h.

void CMOOSMsg::Trace ( )

print a summary of the message

Definition at line 484 of file MOOSMsg.cpp.


Member Data Documentation

what kind of data is this? String,Double,Array?

Definition at line 139 of file MOOSMsg.h.

what type of message is this? Notification,Command,Register etc

Definition at line 136 of file MOOSMsg.h.

double precision time stamp (UNIX time)

Definition at line 148 of file MOOSMsg.h.

Definition at line 153 of file MOOSMsg.h.

Definition at line 154 of file MOOSMsg.h.

ID of message

Definition at line 145 of file MOOSMsg.h.

std::string CMOOSMsg::m_sKey

what is the variable name?

Definition at line 142 of file MOOSMsg.h.

Definition at line 166 of file MOOSMsg.h.

std::string CMOOSMsg::m_sSrc

Definition at line 160 of file MOOSMsg.h.

std::string CMOOSMsg::m_sSrcAux

Definition at line 163 of file MOOSMsg.h.

std::string CMOOSMsg::m_sVal

Definition at line 157 of file MOOSMsg.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines