#include <FountainMessage.h>
Inheritance diagram for FountainMessage:

Public Types | |
| enum | MessageAction |
| enumeration that specifies the action attribute of a FountainMessage object More... | |
Public Member Functions | |
| virtual | ~FountainMessage ()=0 |
| Pure virtual destructor so FountainMessage objects cannot be instantiated directly. | |
| void | buildStandardError (bool status=true, FountainErrorCode code=generalSuccess, const char *msg=NULL) |
| This method adds Status, Code, and Message elements to a FountainMessage using the given parameters. | |
| void | buildStandardError (bool status, FountainErrorCode code, const std::string &msg) |
| Same as the c-string equivalent method above. | |
| void | buildStandardSuccess (const std::string &msg=std::string()) |
| Same as caling buildStandardError(true). | |
| BambooLib::XMLElement * | getDataElement () const |
| Get the pointer to the Data element of the message. | |
Static Public Member Functions | |
| static const char * | fountain_convert (FountainMessage::MessageAction m) |
| Convert a MessageAction into a c-string. | |
| static bool | fountain_convert (const char *s, FountainMessage::MessageAction &a) |
| Convert a c-string into a MessageAction enum. | |
Protected Member Functions | |
| FountainMessage (Loki::Int2Type< BambooLib::requestElement >, MessageAction a) | |
| Constructor for building request FountainMessage objects. | |
| FountainMessage (Loki::Int2Type< BambooLib::responseElement >, MessageAction a) | |
| Constructor for building response FountainMessage objects. | |
Protected Attributes | |
| MessageAction | action_ |
Private Member Functions | |
| void | create (BambooLib::SSS_Element_type type) |
| Create a FountainMessage object. | |
| FountainMessage (const FountainMessage &rhs) | |
| Private copy constructor so FountainMessage objects cannot be sliced. | |
| const FountainMessage & | operator= (const FountainMessage &rhs) |
| Private assignment operator so FountainMessage objects cannot be sliced. | |
This class inherits publicly from the Bamboo library's BuildMsg class. It adds additional functionality in the form of Source and Destination elements, explicit Request or Response message types, and explicity action attributes. These additions are in place to prevent malformed messages from being sent between Fountain components.
The constructor for this class uses a traits class so its only defined for two values of the BambooLib::SSS_Element_type enum, the requestElement and responseElement values. I did this since it does not make sense for any future child or grandchild class of FountainMessage to use different base element type. In the context of Fountain and its associated components, each message is either a request or a response. I used this design since I tend to prefer compile time errors instead of runtime errors in the event a future child class tries to use a different base element type. Instead of using the overloaded constructor with a traits class, I could have used the SSS_Element_type as a normal constructor parameter and performed a typical runtime check on its value. The options in this case are rather liberal, return an error code, throw an exception, allow a zombie object, or some other drastic measure that could promote program instability. In summary, I felt using the traits class combined with an overloaded constructor presents the easiest possible interface to this class.
|
||||||||||||
|
Constructor for building request FountainMessage objects.
|
|
||||||||||||
|
Constructor for building response FountainMessage objects.
|
|
||||||||||||||||
|
This method adds Status, Code, and Message elements to a FountainMessage using the given parameters.
|
|
|
Create a FountainMessage object.
|
|
||||||||||||
|
Convert a c-string into a MessageAction enum.
|
|
|
Convert a MessageAction into a c-string.
|
|
|
Get the pointer to the Data element of the message.
|
|
|
The action of this message, defined by one of the MessageAction enumerated types |
1.4.6