Listing 4: CMsgSwitch declaration
class CMsgSwitch
{
public:
CMsgSwitch();
~CMsgSwitch();
// This is what the client executes instead of the specific functions
// that perform the implementation.
bool SendMsg(const CMsg& msg);
// Declare a Type Definition of a Pointer to a Function that accepts a
// ref to a CMsg and returns a bool. All message processing functions
// have this signature.
typedef bool (CMsgSwitch::*PFB)(const CMsg&);
protected:
private:
// Holds a Map of Pointers to Message Processing Function
// indexed by MSG_TYPE
std::map m_opMap;
// The prototypes for the message processing functions hidden
// from the client.
bool CMsgSwitch::ProcessMsgT1(const CMsgT1&);
bool CMsgSwitch::ProcessMsgT2(const CMsgT2&);
bool CMsgSwitch::ProcessMsgT3(const CMsgT3&);
};
Return to article
|
|
|
|