EpcTools
An event based multi-threaded C++ development framework.
Public Member Functions | Friends | List of all members
PFCP::ApplicationWorker Class Reference

The application worker thread class. The various virtual methods should be overridden to implement application specific behavior. Any additional event handlers can be added to handle application specific (non PFCP) events. More...

#include <epfcp.h>

Inheritance diagram for PFCP::ApplicationWorker:
EThreadEventWorker< TQueue, TMessage > EThreadBasic

Public Member Functions

virtual Void onInit ()
 Called when the worker thread is initialized. When overriding, the overriding method should call the associated base class method. More...
 
virtual Void onQuit ()
 Called when the worker thread is has received the EM_QUIT event. When overriding, the overriding method should call the associated base class method. More...
 
virtual Void onRcvdReq (AppMsgReqPtr req)
 Called when a PFCP request message has been received. More...
 
virtual Void onRcvdRsp (AppMsgRspPtr rsp)
 Called when a PFCP response message has been received. More...
 
virtual Void onReqTimeout (AppMsgReqPtr req)
 Called when a PFCP request message has timed out waiting for the associated response message. More...
 
virtual Void onLocalNodeStateChange (LocalNodeSPtr &ln, LocalNode::State oldState, LocalNode::State newState)
 Called when the local node state changes. More...
 
virtual Void onRemoteNodeStateChange (RemoteNodeSPtr &rn, RemoteNode::State oldState, RemoteNode::State newState)
 Called when a new remote node/peer has been added. More...
 
virtual Void onRemoteNodeRestart (RemoteNodeSPtr &rn, const ETime &restartTime)
 Called when a new remote node/peer has been added. More...
 
virtual Void onSndReqError (AppMsgReqPtr req, SndReqException &err)
 Called when a remote node/peer object is removed. More...
 
virtual Void onSndRspError (AppMsgRspPtr rsp, SndRspException &err)
 Called when an error is encountered while sending a response message. More...
 
virtual Void onEncodeReqError (AppMsgReqPtr req, EncodeReqException &err)
 Called when an error is encountered while encoding a request message. More...
 
virtual Void onEncodeRspError (AppMsgRspPtr rsp, EncodeRspException &err)
 Called when an error is encountered while encoding a response message. More...
 
- Public Member Functions inherited from EThreadEventWorker< TQueue, TMessage >
Int workerId () const
 
virtual Void onTimer (EThreadEventTimer *ptimer)
 Called in the context of the thread when th EM_TIMER event is processed. More...
 
ESemaphoreDatagetMsgSemaphore ()
 Returns the semaphore associated with this work groups' event queue. More...
 
Bool sendMessage (UInt message, Bool wait=True)
 Sends event message to this work group. More...
 
Bool sendMessage (UInt message, pVoid voidptr, Bool wait=True)
 Sends event message to this work group. More...
 
Bool sendMessage (const TMessage &msg, Bool wait=True)
 Sends event message to this work group. More...
 
- Public Member Functions inherited from EThreadBasic
 EThreadBasic ()
 Class constructor. More...
 
virtual ~EThreadBasic ()
 Class destructor. More...
 
Void init (pVoid arg, size_t stackSize=0)
 Initialize and start the thread. More...
 
Void join ()
 Waits for the thread to terminate. More...
 
Bool isInitialized ()
 Returns the thread initialization state. More...
 
RunState getRunState ()
 Returns the current thread run state. More...
 
Bool isWaitingToRun ()
 Determines if the thread is waiting to run. More...
 
Bool isRunning ()
 Determines if the thread is running. More...
 
Bool isDoneRunning ()
 Determines if the thread has finished running. More...
 
Int cancelWait ()
 Sends a cancellation request to the thread. More...
 
Void signal (Int sig)
 

Friends

Void Uninitialize ()
 Uninitializes/stops the PFCP stack. More...
 

Additional Inherited Members

- Public Types inherited from EThreadBasic
enum  RunState { rsWaitingToRun, rsRunning, rsDoneRunning }
 EThreadBasic run states. More...
 
- Static Public Member Functions inherited from EThreadBasic
static Void sleep (Int milliseconds)
 Sleeps for the specified number of milliseconds. More...
 
static Void yield ()
 Relinquishes the CPU. More...
 
- Protected Member Functions inherited from EThreadEventWorker< TQueue, TMessage >
 EThreadEventWorker ()
 Default class constructor. More...
 
 ~EThreadEventWorker ()
 The class destructor. More...
 
virtual Void onMessageQueued (const TMessage &msg)
 Called when an event message is queued. More...
 
virtual Void init (TQueue &queue, Int workerid, pVoid arg, Dword stackSize=0)
 Initializes the thread object. More...
 
Void start ()
 Initializes the thread when it was suspended at init(). More...
 
Bool pumpMessage (TMessage &msg, Bool wait=true)
 Dispatches the next thread event message. More...
 
virtual Void pumpMessages ()
 Process event messages. More...
 
virtual Void defaultMessageHandler (TMessage &msg)
 The default event message handler. More...
 
pid_t getThreadId ()
 Retrieves the internal thread ID. More...
 
- Static Protected Member Functions inherited from EThreadBasic
static Void Initialize ()
 performs internal initialization *** DO NOT CALL *** More...
 
static Void UnInitialize ()
 performs internal de-initialization *** DO NOT CALL *** More...
 

Detailed Description

The application worker thread class. The various virtual methods should be overridden to implement application specific behavior. Any additional event handlers can be added to handle application specific (non PFCP) events.

Member Function Documentation

Void PFCP::ApplicationWorker::onEncodeReqError ( AppMsgReqPtr  req,
EncodeReqException &  err 
)
virtual

Called when an error is encountered while encoding a request message.

Parameters
reqthe appication request message that failed.
erra reference to the associated exception.
Void PFCP::ApplicationWorker::onEncodeRspError ( AppMsgRspPtr  rsp,
EncodeRspException &  err 
)
virtual

Called when an error is encountered while encoding a response message.

Parameters
rspthe appication response message that failed.
erra reference to the associated exception.
Void PFCP::ApplicationWorker::onInit ( )
virtual

Called when the worker thread is initialized. When overriding, the overriding method should call the associated base class method.

Reimplemented from EThreadEventWorker< TQueue, TMessage >.

Void PFCP::ApplicationWorker::onLocalNodeStateChange ( LocalNodeSPtr &  ln,
LocalNode::State  oldState,
LocalNode::State  newState 
)
virtual

Called when the local node state changes.

Parameters
lna shared pointer to the local node object.
oldStatethe previous state of the local node.
newStatethe new state of the local node.
Void PFCP::ApplicationWorker::onQuit ( )
virtual

Called when the worker thread is has received the EM_QUIT event. When overriding, the overriding method should call the associated base class method.

Reimplemented from EThreadEventWorker< TQueue, TMessage >.

Void PFCP::ApplicationWorker::onRcvdReq ( AppMsgReqPtr  req)
virtual

Called when a PFCP request message has been received.

Parameters
reqa pointer to the request message.
Void PFCP::ApplicationWorker::onRcvdRsp ( AppMsgRspPtr  rsp)
virtual

Called when a PFCP response message has been received.

Parameters
rspa pointer to the response message.
Void PFCP::ApplicationWorker::onRemoteNodeRestart ( RemoteNodeSPtr &  rn,
const ETime restartTime 
)
virtual

Called when a new remote node/peer has been added.

Parameters
rmtNodea shared pointer to the remote node object.
Void PFCP::ApplicationWorker::onRemoteNodeStateChange ( RemoteNodeSPtr &  rn,
RemoteNode::State  oldState,
RemoteNode::State  newState 
)
virtual

Called when a new remote node/peer has been added.

Parameters
rna shared pointer to the remote node object.
oldStatethe previous state of the remote node.
newStatethe new state of the remote node.
Void PFCP::ApplicationWorker::onReqTimeout ( AppMsgReqPtr  req)
virtual

Called when a PFCP request message has timed out waiting for the associated response message.

Parameters
reqa pointer to the request message that did not receive a response.
Void PFCP::ApplicationWorker::onSndReqError ( AppMsgReqPtr  req,
SndReqException &  err 
)
virtual

Called when a remote node/peer object is removed.

Parameters
rna shared pointer to the remote node object.
restartTimethe time the remote node restarted.
Void PFCP::ApplicationWorker::onSndRspError ( AppMsgRspPtr  rsp,
SndRspException &  err 
)
virtual

Called when an error is encountered while sending a response message.

Parameters
rspthe appication response message that failed.
erra reference to the associated exception.

Friends And Related Function Documentation

Void Uninitialize ( )
friend

Uninitializes/stops the PFCP stack.


The documentation for this class was generated from the following files: