EventManagement Class Reference

Manages all pending and running events. More...

#include <event_management.h>

List of all members.

Public Member Functions

 EventManagement ()
 constructor initializing the class
virtual ~EventManagement ()
const std::string cur_prog (int id)
 returns the current program of an event with the id id
const std::string name (int id)
 get name of an event
int moveOn (int id)
 moves the iterator current_program_2_execute to the next program of this event
int registerEvent (Event &event, time_t timeout)
 registers one event event and adjusts some values
int count ()
 get number of pending events
bool remove (int id)
 removes one event and frees its memory
Eventevent (int id)
 returns the event which refers to id
void adjustTimeouts (unsigned long sleep_time)
 adjusts timeouts after resuming
int eventIsRunning (const std::string &eventName)
 checks whether an event is still running
void checkScriptReturn (int id, int returnValue, std::string &comment)
 checks if a returned script belongs to a pending event and executes the appropriate actions
bool continueEvent (Event *event, std::string acpi_event_line)
 continues an event by executing the next action
bool executeEvent (const std::string &eventName, const char *acpi_event_line="")
 execute a powersave event
void checkEventTimeouts ()
 checks all pending events whether there timeouts are reached

Public Attributes

std::list< EventEvents
 double linked list of Event-pointers to manage events

Private Member Functions

bool executeInternalAction (Event *event, std::string action)
 execute an internal action

Private Attributes

unsigned int id_count
 every event will get a unique id


Detailed Description

Manages all pending and running events.


Constructor & Destructor Documentation

EventManagement::EventManagement  ) 
 

constructor initializing the class

EventManagement::~EventManagement  )  [virtual]
 


Member Function Documentation

void EventManagement::adjustTimeouts unsigned long  sleep_time  ) 
 

adjusts timeouts after resuming

Parameters:
sleep_time time we slept in milliseconds

void EventManagement::checkEventTimeouts  ) 
 

checks all pending events whether there timeouts are reached

void EventManagement::checkScriptReturn int  id,
int  returnValue,
std::string &  comment
 

checks if a returned script belongs to a pending event and executes the appropriate actions

bool EventManagement::continueEvent Event event,
std::string  acpi_event_line
 

continues an event by executing the next action

Parameters:
event the event to continue
acpi_event_line the acpi event if available, else ""
Returns:
false if action could not be executed

int EventManagement::count  ) 
 

get number of pending events

Returns:
number of still running/pending events

const string EventManagement::cur_prog int  id  ) 
 

returns the current program of an event with the id id

Parameters:
id event id
Returns:
current program to execute of this event

Event * EventManagement::event int  id  ) 
 

returns the event which refers to id

Parameters:
id event id
Returns:
pointer to event
Return values:
pointer pointing to an event object
NULL if event was not found

int EventManagement::eventIsRunning const std::string &  eventName  ) 
 

checks whether an event is still running

Parameters:
eventName the name of the event
Returns:
integer
Return values:
1 if running
0 if not

bool EventManagement::executeEvent const std::string &  eventName,
const char *  acpi_event_line = ""
 

execute a powersave event

Parameters:
eventName the name of the powersave event
acpi_event_line acpi event if present
Returns:
true if event got executed, false if event does not exist

bool EventManagement::executeInternalAction Event event,
std::string  action
[private]
 

execute an internal action

Returns:
integer with result of execute requested internal action
Return values:
1 if the action could be found
-1 if this was not an internal action

int EventManagement::moveOn int  id  ) 
 

moves the iterator current_program_2_execute to the next program of this event

Parameters:
id event id
Returns:
interger value
Return values:
1 if there are programs left
0 if all programs returned already
-1 if such an event specified by id could not be found

const string EventManagement::name int  id  ) 
 

get name of an event

Parameters:
id event id
Returns:
returns the name of the event

int EventManagement::registerEvent Event event,
time_t  timeout
 

registers one event event and adjusts some values

Parameters:
event an event object
timeout timeout of this event in seconds
Returns:
integer value
Return values:
true if successfull
false otherwise

bool EventManagement::remove int  id  ) 
 

removes one event and frees its memory

Parameters:
id event id
Returns:
true on success, false otherwise


Member Data Documentation

std::list< Event > EventManagement::Events
 

double linked list of Event-pointers to manage events

unsigned int EventManagement::id_count [private]
 

every event will get a unique id


The documentation for this class was generated from the following files:
Generated on Mon Mar 27 09:27:19 2006 for Powersave Daemon by  doxygen 1.4.6