ApparatusFramework::Msg Class Reference
[Kernel Services]

#include <KernelServices/common/current/include/Msg.h>

Inheritance diagram for ApparatusFramework::Msg:
ApparatusFramework::ConnectionMsg ApparatusFramework::DummyMsg ApparatusFramework::LogMsg ApparatusFramework::MemMsg ApparatusFramework::TaskWakeUpMsg ApparatusFramework::TimerMsg ApparatusFramework::CanMsg ApparatusFramework::TraceTextMsg ApparatusFramework::CanNMTMsg ApparatusFramework::CanPDOMsg ApparatusFramework::CanReceiveMsg ApparatusFramework::CanSDOMsg ApparatusFramework::CanSYNCMsg

List of all members.

Public Member Functions

 Msg ()
 Msg (const MsgId msgId)
virtual ~Msg ()
 Msg (const Msg &msg)
Msgoperator= (const Msg &msg)
void * operator new (size_t msgSize)
void operator delete (void *pMsg)
virtual Msgclone ()=0
virtual void dump () const
virtual int toString (char *pBuffer, const int32 bufferLen) const

Static Public Member Functions

static void Release (Msg *pMsg)

Public Attributes

MsgId m_msgId
RefCounter m_refCount

Detailed Description

The objects of the class message are used to send information from one task to another. Each application has full freedom to define the data members and the properties of this class. If the standard tracing tools should be used, the class must inherit publicly form the class message field, otherwise this inheritance relation can be eliminated.

Definition at line 83 of file Msg.h.


Constructor & Destructor Documentation

ApparatusFramework::Msg::Msg (  ) 

Construction, destruction Constructs a new Msg object with an unknown message id.

ApparatusFramework::Msg::Msg ( const MsgId  msgId  )  [explicit]

Constructs a new Msg object with the specified message id.

Parameters:
msgId Id of the created message.
virtual ApparatusFramework::Msg::~Msg (  )  [virtual]

The virtual destructor.

ApparatusFramework::Msg::Msg ( const Msg msg  ) 

Copy and Assignment Copy constructor (we do not want to copy the m_refCount).

Parameters:
msg The message to be copied.

Member Function Documentation

virtual Msg* ApparatusFramework::Msg::clone (  )  [pure virtual]

Cloning Copies an instance of Msg given as parameter and delivers it back to the caller. Has to be overwritten by the subclass and made sure that it does the coping in the right way by implementing a proper copy constructor (flat/deep copy).

Returns:
A copy of this message.

Implemented in ApparatusFramework::CanMsg, ApparatusFramework::CanSDOMsg, ApparatusFramework::CanPDOMsg, ApparatusFramework::CanNMTMsg, ApparatusFramework::CanSYNCMsg, ApparatusFramework::CanReceiveMsg, ApparatusFramework::TraceTextMsg, ApparatusFramework::LogMsg, ApparatusFramework::TimerMsg, ApparatusFramework::TaskWakeUpMsg, ApparatusFramework::DummyMsg, and ApparatusFramework::MemMsg.

virtual void ApparatusFramework::Msg::dump (  )  const [virtual]

Each message should be able to print itself onto wherever needed. This method may implement this.

void ApparatusFramework::Msg::operator delete ( void *  pMsg  ) 

Not implemented. Please use Release to free a message.

Parameters:
pMsg Not used.
void* ApparatusFramework::Msg::operator new ( size_t  msgSize  ) 

Allocation Reserves a message. New checks if the size of the object the user wants to have memory for does not exceed the previously allocated size for a Msg (m_data). If its not, it returns a pointer to the reserved msg out of the pool.

Msg& ApparatusFramework::Msg::operator= ( const Msg msg  ) 

Assignment operator (we do not want to copy the m_refCount).

Parameters:
msg The message to be copied.

Reimplemented in ApparatusFramework::TraceTextMsg, and ApparatusFramework::LogMsg.

static void ApparatusFramework::Msg::Release ( Msg pMsg  )  [static]

Releases the with new allocated memory for a message (release message).

Parameters:
pMsg Pointer to the Msg to be released.
virtual int ApparatusFramework::Msg::toString ( char *  pBuffer,
const int32  bufferLen 
) const [virtual]

Each message should be able to present itself as a string. This method is called by the default implementation of dump().

Parameters:
pBuffer Buffer for the string representation.
bufferLen Size of the buffer.
Returns:
Number of characters that (would) have been printed to pBuffer or -1 on failure.

Reimplemented in ApparatusFramework::CanMsg, ApparatusFramework::CanSDOMsg, ApparatusFramework::CanPDOMsg, ApparatusFramework::CanNMTMsg, ApparatusFramework::CanSYNCMsg, ApparatusFramework::CanReceiveMsg, ApparatusFramework::TraceTextMsg, ApparatusFramework::LogMsg, and ApparatusFramework::TimerMsg.


Member Data Documentation

fields Stores the identfication of the data sent with the message. This field implements a simplified distributed RTTI for the message class.

Definition at line 155 of file Msg.h.

Used to save time and memory. Messages distributed with the observer pattern will not be copied. Instead just this reference count is increased. !!! IMPORTANT !!! !!! If one receives a message over "update" or "updateFrom" and does !!! !!! not only read its data, but modify it, he has to COPY the message !!!

Definition at line 165 of file Msg.h.

© 2004-2010 bbv Software Services AG / Apparatus Services