class CEngine

The core class of the whole PeerHood system.

Public Methods

[more]CEngine* GetInstance(CBasicCallback* aCallback)
Creates a new instance of the CEngine class.
[more] ~CEngine()
Destructor.
[more] CEngine(CBasicCallback* aCallback)
Constructor.
[more]void StartListening()
Starts listening thread.
[more]bool LoadConnections(const int aLocalPid)
Method creates a listening socket for every networking technology
[more]void* ThreadStarter(void* aArguments)
Starts the listening thread.
[more]void EternalThread()
Listens for incoming requests.


Documentation

The core class of the whole PeerHood system. This singleton class is responsible for receiving incoming method requests handling and dispatching. If a service is registered then a dedicated thread listens for incoming requests. If a request is received it is forwarded to a correct dispatcher. Requests are handled using the fifo (first in first out) methology. If all services are unregistered then the thread is also terminated.
oCEngine* GetInstance(CBasicCallback* aCallback)
Creates a new instance of the CEngine class. This method ensures that at any given moment of time only one instance of this class is running (i.e. it implements the singleton design pattern). If an instance exists already then a pointer to it is returned.

Parameters:
aCallback - The interface where callback notifications should be sent to.
Returns:
pointer to the active CEngine instance

o ~CEngine()
Destructor, stops the listening thread & frees all allocated memory.

Returns:
none

o CEngine(CBasicCallback* aCallback)
Constructor. This constructor is a protected method so it cannot be called directly. Instead, use the <code>GetInstance</code> method.

Parameters:
aCallback - The interface where callback notifications should be sent to.
Returns:
none

ovoid StartListening()
Starts listening thread. This thread listens for incoming connection requests.

Returns:
none

obool LoadConnections(const int aLocalPid)
Method creates a listening socket for every networking technology. These connections listen for incoming connection requests using processID as port number.

Parameters:
aLocalPid - Process ID which is used as a port for listening
Returns:
false if something fails (currently returns always true)

ovoid* ThreadStarter(void* aArguments)
Starts the listening thread. This static function is used because the <code>pthread</code> library doesn't allow running a member function in a thread directly.

Parameters:
aArguments - Pointer to the current instance of the <code>CEngine </code> class.
Returns:
always NULL

ovoid EternalThread()
Listens for incoming requests and forwards them further. A request is forwarded to the registered callback interface or simply discarded if the interface is not registered.

Returns:
none


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.