OSM_Event Class Reference

Event class to monitor a certain event into an Osmius Instance. More...

#include <osm_ag_insmanager.h>

Collaboration diagram for OSM_Event:

Collaboration graph
[legend]
List of all members.

Public Types

enum  OSM_TYP_COMPARE { OSM_COMPARE_GREATER = 0, OSM_COMPARE_LESS = 1 }
 Compare types. 0-Greater Than 1-Less than.

Public Member Functions

 OSM_Event (ACE_Reactor *r=ACE_Reactor::instance())
 Constructor.
virtual int handle_timeout (const ACE_Time_Value &tv, const void *)
 Hook method called when object is signaled by timers.
int open (const ACE_TCHAR *name, OSM_Instance_Base *instance, const int interval, const int i_delay, const int timeout, const int mode=0, const int warn=0, const int alar=0, const int silent=0, const ACE_TCHAR *ev_params=0)
int close (void)
int is_code (const ACE_TCHAR *nm)
 Returns 1 if the name of the action is equal to the name in the parameter.
const ACE_TCHAR * typ_event (void)
 Return a pointer to local typ_event.
const ACE_TCHAR * cmd_line (void)
 Return a pointer to command line char string.
void cmd_line (const ACE_TCHAR *cmd_line, const int len)
 Sets the command line.
OSM_Action_Baseaction (void)
 Returns a pointer to the local action.
void action (OSM_Action_Base *action)
 Set the action to be executed when this Event is called.

Detailed Description

Event class to monitor a certain event into an Osmius Instance.

This class derives from ACE_Event_Handler so we can register timers with the chosen Reactor implementation. It has implemented the handle_time_out() hook method, and this method in turn will call its associated action execute() method. In the open() method we'll register with the reactor, keep our timed_id info, and check every thing. In close() we'll cancel future timers, deregister our- selves with the Reactor and perform cleaning activities.

Definition at line 196 of file osm_ag_insmanager.h.


Member Function Documentation

int OSM_Event::handle_timeout ( const ACE_Time_Value &  tv,
const void *   
) [virtual]

Hook method called when object is signaled by timers.

Typ_Agent is now the same as TYP_INSTANCE

Definition at line 89 of file osm_ag_insmanager.cpp.

References OSM_Instance_Base::connect(), OSM_Instance_Base::disconnect(), OSM_Message::dti_finevent(), OSM_Message::dti_inievent(), OSM_Message::encode(), OSM_Action_Base::execute(), OSM_CfgManager::get_param(), OSM_CfgManager::get_value_int(), OSM_CfgManager::get_value_str(), OSM_Message::idn_instance(), OSM_Message::idn_master(), OSM_CfgManager::instance(), OSM_Message::num_value(), OSM_TYP_ALARM_CRIT, OSM_TYP_ALARM_ERRO, OSM_TYP_ALARM_INFO, OSM_TYP_ALARM_WARN, OSM_Message::txt_message(), OSM_Message::typ_agent(), OSM_Message::typ_alarm(), OSM_Message::typ_event(), and OSM_Message::typ_instance().

Here is the call graph for this function:

int OSM_Event::open ( const ACE_TCHAR *  name,
OSM_Instance_Base instance,
const int  interval,
const int  i_delay,
const int  timeout,
const int  mode = 0,
const int  warn = 0,
const int  alar = 0,
const int  silent = 0,
const ACE_TCHAR *  ev_params = 0 
)

Initializes the Event parameters. An event is basically an action plus a command line.

Parameters:
name Input - Event Name.
instance Input - This event creator instance.
interval Input - The reactor timer interval seconds.
i_delay Input - The reactor timer interval seconds.
timeout Input - Timeout for the action.
mode Input - Compare mode.
warn Input - Warning Limit
alar Input - Critical Alarm Limit
silent Input - Silent mode 0-Off 1-On
ev_params Input - Complete command line parameters in config file.
Return values:
-1 in case of error. 0 for success.

Definition at line 327 of file osm_ag_insmanager.cpp.

References action(), OSM_Message::CODLEN, OSM_Action_Base::ev_parameters(), OSM_Instance_Base::idn_instance(), OSM_CfgManager::instance(), and OSM_Action_Base::set_name().

Here is the call graph for this function:

int OSM_Event::close ( void   ) 

Cleaning activities: Cancel future timer calls. Deregister the timer from the ACE Reactor framework. Delete our action.

Return values:
-1 in case of error. 0 for success.

Definition at line 389 of file osm_ag_insmanager.cpp.

References OSM_CfgManager::instance().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Thu Feb 21 18:39:36 2008 for Osmius by  doxygen 1.5.1