FountainParseMessage Class Reference
[Message Building and Parsing]

simple wrapper class around the bamboo library ParseMsg class More...

#include <FountainMessage.h>

List of all members.

Public Member Functions

 FountainParseMessage (const BambooLib::ParseMsg *msg)
 Default constructor.
 ~FountainParseMessage ()
 Destructor.
BambooParseMsg::PointerType getParseMsg () const
 Implicit conversion operator to a BambooParseMsg::PointerType pointer Explicity conversion to a BambooParseMsg::PointerType pointer.
FountainMessage::MessageAction getAction () const
 returns the action attribute enum
bool getStatus () const
 returns the Status element value
BambooLib::SSS_Element_type getMessageType () const
 returns the SSS_Element_type element value
BambooLib::XMLElementgetRoot () const
 returns the root element
const char * getActor () const
 returns the actor attribute
BambooLib::XMLElementgetDataElement () const
 returns the data element
const char * getDataElementValue (const char *value) const
 returns the value of a data element
const char * getResponseMessage () const
 returns the Response element value
const char * getSource () const
 Returns the source NodeID.
const char * getDestination () const
 returns the destination NodeID
FountainErrorCode getErrorCode () const
 returns the error code from the status element

Private Types

typedef Loki::SmartPtr< const
BambooLib::ParseMsg, Loki::NoCopy,
Loki::AllowConversion, Loki::RejectNullStrict > 
BambooParseMsg
 SmartPtr object wrapped around a const BambooLib::ParseMsg pointer.

Private Member Functions

 FountainParseMessage (const FountainParseMessage &rhs)
 Private copy constructor with no implementation so clients cannot use it.
FountainParseMessageoperator= (const FountainParseMessage &rhs)
 Private assignment operator with no implementation so clients cannot use it.

Private Attributes

BambooParseMsg msg_
 The underlying pointer to a BambooLib::ParseMsg object.

Friends

std::ostream & operator<< (std::ostream &output, const FountainParseMessage &rhs)
 ostream operator


Detailed Description

simple wrapper class around the bamboo library ParseMsg class

This class adds a few Fountain specific features to the bamboo ParseMsg class. Most notable, it adds support for getting the Source and Destination elements as well as the FountainErrorCode enum if the Status element has a FAILURE value.

This class is modeled using composition since it retains a private pointer to the bamboo library ParseMsg object. Since this class does not add many new features to the ParseMsg class, it might make more sense to model this class using the "is-a" idiom since all FountainParseMessage objects could be considered ParseMsg objects. However, this is not currently possible for a couple of reasons:

  1. The FountainWireProt class abstracts away most of the semantics of the BambooLib::SSSWireProt
  2. The BambooLib::SSSWireProt class requires that messages are received as ParseMsg objects for encryption and decryption to work properly in the event the underlying wire protocol is one of the SSSRMAP variants
  3. The only way to model the FountainWireProt class with a "is-a" ParseMsg design would be to use the BambooLib::SSSWireProt::recvMessage(int&) method to receive this message as a c-string instead of a ParseMsg. This would disable the decryption support as mentioned previously.

An alternative to this composition design would be to implement a cloning factory design that would take each ParseMsg object received and clone it before creating a FountainParseMessage object. This would allow the "is-a" idiom to be used and get rid of the public "getter" methods that call the same method in the ParseMsg class. I decided against this decision since I felt cloning a ParseMsg object each time a message was received would be inefficient.


Member Typedef Documentation

FountainParseMessage::BambooParseMsg [private]
 

SmartPtr object wrapped around a const BambooLib::ParseMsg pointer.

This object uses the following policy classes:

  • NoCopy storage policy to explicitly disable copying
  • DisallowConversion conversion policy to prevent implicit conversions to the pointee type
  • RejectNullStrict checking policy to throw an exception when initialized with a NULL pointer


Constructor & Destructor Documentation

FountainParseMessage::FountainParseMessage const BambooLib::ParseMsg msg  )  [inline]
 

Default constructor.

Parameters:
[in] msg Pointer to a ParseMsg object


Member Function Documentation

FountainMessage::MessageAction FountainParseMessage::getAction  )  const
 

returns the action attribute enum

Returns:
The MessageAction enum specified in the action attribute in the message

invalidAction if the action attribute is missing or the attribute could not be converted to a valid enumeration value

const char* FountainParseMessage::getDataElementValue const char *  value  )  const [inline]
 

returns the value of a data element

Return values:
char* The value of the data element if it exists, NULL otherwise

const char * FountainParseMessage::getDestination  )  const
 

returns the destination NodeID

Returns:
The value of the Destination element in the message

FountainErrorCode FountainParseMessage::getErrorCode  )  const
 

returns the error code from the status element

Returns:
the integer error number of the Code element in the Status element

invalidFountainErrorCode if no error code is found in the message

const char* FountainParseMessage::getResponseMessage  )  const [inline]
 

returns the Response element value

Return values:
char* The response element value if it exists, NULL otherwise

const char * FountainParseMessage::getSource  )  const
 

Returns the source NodeID.

Returns:
The value of the Source element in the message


The documentation for this class was generated from the following files:
Generated on Wed Mar 8 14:43:33 2006 for Fountain by  doxygen 1.4.6