ESA JPIP server  0.1
ipc::Event Class Reference

IPC object that offers the functionality of an event (Windows IPC object), implemented by means of a combination of the pthread mutex and conditional variables API. More...

#include <event.h>

Inheritance diagram for ipc::Event:
Collaboration diagram for ipc::Event:

Public Types

typedef SHARED_PTR< EventPtr
 Pointer to a Event object. More...
 
- Public Types inherited from ipc::IPCObject
typedef SHARED_PTR< IPCObjectPtr
 Pointer to an IPC object. More...
 

Public Member Functions

virtual bool Init ()
 Initializes the object desactivated and with automatic reset. More...
 
bool Init (bool manual_reset, bool initial_state=false)
 Initializes the object. More...
 
virtual WaitResult Wait (int time_out=-1)
 Performs a wait operation with the object to get it. More...
 
virtual bool Dispose ()
 Release the resources associated to the IPC object and sets the internal status to false. More...
 
bool Set (bool new_state=true)
 Sets the state of the object. More...
 
bool Get () const
 Returns the current activation state of the object. More...
 
bool Pulse ()
 Generates the same result as if the event has automatic reset and the Set method is called with true, independently of the real reset type. More...
 
bool Reset ()
 Desactivates the object. More...
 
- Public Member Functions inherited from ipc::IPCObject
 IPCObject ()
 Initializes the internal status to false. More...
 
bool IsValid ()
 Returns true if the object is valid, that is, the internal status value is true. More...
 
virtual ~IPCObject ()
 The desctructor calls the method Dispose. More...
 

Private Attributes

bool state
 Current activation state of the event. More...
 
bool manual_reset
 Indicates if the event reset is manual. More...
 
pthread_cond_t condv
 Conditional variable information. More...
 
pthread_mutex_t mutex
 Mutex information. More...
 

Detailed Description

IPC object that offers the functionality of an event (Windows IPC object), implemented by means of a combination of the pthread mutex and conditional variables API.

See also
IPCObject

Member Typedef Documentation

Pointer to a Event object.

Member Function Documentation

bool ipc::Event::Dispose ( )
virtual

Release the resources associated to the IPC object and sets the internal status to false.

Returns
true if successful.

Reimplemented from ipc::IPCObject.

Here is the call graph for this function:

bool ipc::Event::Get ( ) const
inline

Returns the current activation state of the object.

virtual bool ipc::Event::Init ( )
inlinevirtual

Initializes the object desactivated and with automatic reset.

Returns
true if successful.

Reimplemented from ipc::IPCObject.

bool ipc::Event::Init ( bool  manual_reset,
bool  initial_state = false 
)

Initializes the object.

Parameters
manual_resettrue if the reset is manual.
initial_statetrue if the initial state is activated.
Returns
true if successful.

Here is the call graph for this function:

bool ipc::Event::Pulse ( )

Generates the same result as if the event has automatic reset and the Set method is called with true, independently of the real reset type.

Returns
true if successful.

Here is the call graph for this function:

bool ipc::Event::Reset ( )
inline

Desactivates the object.

Returns
true if successful.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ipc::Event::Set ( bool  new_state = true)

Sets the state of the object.

If it is activated (with true) and the reset is manual, all the threads waiting for the object will be resumed. If the reset is not manual (automatic), only one thread will be resumed and the state will be set to false again.

Parameters
new_stateNew state of the object.
Returns
true if successful.

Here is the call graph for this function:

Here is the caller graph for this function:

WaitResult ipc::Event::Wait ( int  time_out = -1)
virtual

Performs a wait operation with the object to get it.

Parameters
time_outTime out (infinite by default).
Returns
WAIT_OBJECT if successful, WAIT_TIMEOUT if time out or WAIT_ERROR is error.

Reimplemented from ipc::IPCObject.

Here is the call graph for this function:

Member Data Documentation

pthread_cond_t ipc::Event::condv
private

Conditional variable information.

bool ipc::Event::manual_reset
private

Indicates if the event reset is manual.

pthread_mutex_t ipc::Event::mutex
private

Mutex information.

bool ipc::Event::state
private

Current activation state of the event.


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