cornelluniversity::vetserial::pubsub_message Class Reference

For use with the messaging API. The command acts as a proxy, blindly (de)serializing messages to be transported across the wire. More...

#include <vetprot.h>

Inheritance diagram for cornelluniversity::vetserial::pubsub_message:

cornelluniversity::vetserial::base_command List of all members.

Public Member Functions

 pubsub_message (void)
 Default constructor Instantiates a default (i.e. message-less) message proxy command. You need to call set_message() before this will be of value.
 pubsub_message (Message *m)
 Overloaded constructor Accepts a Message struct that will be serialized for transport.
Exceptions:
vetsim_exception if the supplied Message is a null pointer
vetsim_exception to rethrow std::bad_alloc.

 pubsub_message (const uint8_ *in_pkt, uint32_ nbytes)
 Overloaded constructor Accepts packet and packet size for deserialization purposes.
virtual ~pubsub_message (void)
 Destructor.
void set_message (Message *m)
 object mutator to set the message to be processed.
Messageget_message (void)
 object accessor to obtain a pointer to the current message (if it exists). If there is no message, we look in the buffer for a packet to deserialize.
const uint16_ message_length (void) const
virtual void serialize (void)
 Overridden virtual function. Builds a stop request packet by instantiating a header, adding the payload, and capping it off with a trailer. The full packet is left in buffer for you to access via this->packet().
Exceptions:
std::bad_alloc standard memory allocation failure
vetsim_exception in the event that we cannot discern the type for the void pointer.

virtual void deserialize (void)
 parses apart a received packet into the appropriate private members for use via the typical accessor process.
Exceptions:
cornelluniversity::vetsim_exception if we are unable to discern the data type of the Message struct
cornelluniversity::vetsim_badchksum if the crc validation fails
cornelluniversity::vetsim_exception to rethrow std::bad_alloc
cornelluniversity::vetsim_exception if packet_ buffer is empty (null pointer)


Detailed Description

For use with the messaging API. The command acts as a proxy, blindly (de)serializing messages to be transported across the wire.

base_command


Constructor & Destructor Documentation

cornelluniversity::vetserial::pubsub_message::pubsub_message ( void   )  [inline]

Default constructor Instantiates a default (i.e. message-less) message proxy command. You need to call set_message() before this will be of value.

See also:
pubsub_message(Message * m)

cornelluniversity::vetserial::pubsub_message::pubsub_message ( Message m  ) 

Overloaded constructor Accepts a Message struct that will be serialized for transport.

Exceptions:
vetsim_exception if the supplied Message is a null pointer
vetsim_exception to rethrow std::bad_alloc.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

See also:
pubsub_message( void )

cornelluniversity::vetserial::pubsub_message::pubsub_message ( const uint8_ in_pkt,
uint32_  nbytes 
) [inline]

Overloaded constructor Accepts packet and packet size for deserialization purposes.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

virtual cornelluniversity::vetserial::pubsub_message::~pubsub_message ( void   )  [virtual]

Destructor.


Member Function Documentation

virtual void cornelluniversity::vetserial::pubsub_message::deserialize ( void   )  [virtual]

parses apart a received packet into the appropriate private members for use via the typical accessor process.

Exceptions:
cornelluniversity::vetsim_exception if we are unable to discern the data type of the Message struct
cornelluniversity::vetsim_badchksum if the crc validation fails
cornelluniversity::vetsim_exception to rethrow std::bad_alloc
cornelluniversity::vetsim_exception if packet_ buffer is empty (null pointer)

Implements cornelluniversity::vetserial::base_command.

Message* cornelluniversity::vetserial::pubsub_message::get_message ( void   ) 

object accessor to obtain a pointer to the current message (if it exists). If there is no message, we look in the buffer for a packet to deserialize.

Returns:
Message * - pointer to the currently managed Message struct
Exceptions:
vetsim_exception in the event that there is neither a message nor a packet to deserialize
vetsim_exception to rethrow std::bad_alloc

const uint16_ cornelluniversity::vetserial::pubsub_message::message_length ( void   )  const [inline]

virtual void cornelluniversity::vetserial::pubsub_message::serialize ( void   )  [virtual]

Overridden virtual function. Builds a stop request packet by instantiating a header, adding the payload, and capping it off with a trailer. The full packet is left in buffer for you to access via this->packet().

Exceptions:
std::bad_alloc standard memory allocation failure
vetsim_exception in the event that we cannot discern the type for the void pointer.

Implements cornelluniversity::vetserial::base_command.

void cornelluniversity::vetserial::pubsub_message::set_message ( Message m  ) 

object mutator to set the message to be processed.

Parameters:
m - pointer to a Message struct
Exceptions:
vetsim_exception if the supplied Message is a null pointer
vetsim_exception to rethrow std::bad_alloc


The documentation for this class was generated from the following file:
Generated on Wed Nov 14 12:01:02 2012 for VetSim Applications by  doxygen 1.4.7