1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
// $Id: Protocol_Handler.h 80826 2008-03-04 14:51:23Z wotte $
#ifndef JAWS_PROTOCOL_HANDLER_H
#define JAWS_PROTOCOL_HANDLER_H
#include "ace/Message_Block.h"
#include "jaws3/Export.h"
#include "jaws3/Event_Completer.h"
class JAWS_Export JAWS_Protocol_State
{
friend class JAWS_Protocol_Handler;
public:
virtual ~JAWS_Protocol_State (void);
protected:
virtual int service (JAWS_Event_Completer *, void *data) = 0;
virtual JAWS_Protocol_State * transition ( const JAWS_Event_Result &
, void *data
, void *act
) = 0;
};
class JAWS_Export JAWS_Protocol_Handler
: public JAWS_Event_Completer
// = TITLE
// Abstraction that interacts with concurrency dispatching.
{
friend class JAWS_TPOOL_Concurrency;
friend class JAWS_TPR_Concurrency;
friend class JAWS_THYBRID_Concurrency;
public:
JAWS_Protocol_Handler (JAWS_Protocol_State *state = 0, void *data = 0);
virtual int service (void);
virtual void dismiss (void)
{
delete this;
}
protected:
virtual ~JAWS_Protocol_Handler (void);
// Try to guarantee this class will be created dynamically.
protected:
void event_complete (const JAWS_Event_Result &result, void *act);
// The event completion routine that triggers the transition
// to the next Protocol State.
void default_complete (const JAWS_Event_Result &result, void *act)
{
this->event_complete (result, act);
}
private:
JAWS_Protocol_State *state_;
void *data_;
ACE_Data_Block db_;
ACE_Message_Block mb_;
};
#endif /* JAWS_PROTOCOL_HANDLER_H */
|