3 //=============================================================================
5 * @file Monitor_Admin.h
7 * $Id: Monitor_Admin.h 81753 2008-05-21 19:02:47Z parsons $
9 * @author Jeff Parsons <j.parsons@vanderbilt.edu>
11 //=============================================================================
13 #ifndef MONITOR_ADMIN_H
14 #define MONITOR_ADMIN_H
16 #include /**/ "ace/pre.h"
18 #include "ace/Event_Handler.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
26 #include "ace/Monitor_Base.h"
28 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 namespace Monitor_Control
37 * @class Monitor_Point_Auto_Updater
39 * @brief Automates periodic updating of monitor point classes.
41 * A single instance of this class is held by the Admin
42 * class below. For a monitor point that must periodically
43 * check what they are monitoring, the admin class registers
44 * the monitor point with the ACE reactor. Each time the
45 * interval times out, the reactor will call the
46 * handle_timeout() method below, and pass in the appropriate
47 * monitor point. The handle_timeout() method will in turn
48 * call the appropriate method on the monitor point to get
49 * it to update its data.
51 class Monitor_Point_Auto_Updater
: public ACE_Event_Handler
54 /// Override of ACE base class method.
55 virtual int handle_timeout (const ACE_Time_Value
& interval
,
56 const void* monitor_point
);
62 * @brief Accesses monitor points or groups and manages the registries.
64 * Responsible for adding and removing monitor points and creating
65 * automatic periodic actions that update or query monitor points.
67 class ACE_Export Monitor_Admin
71 ~Monitor_Admin (void);
73 /// Add or access monitor points in a global registry
74 /// If the ACE_Time_Value arg is non-zero,
75 /// the monitor point, the auto updater member, and the given time
76 /// interval are passed to our reactor's register_timeout()
79 bool monitor_point (Monitor_Base
* monitor_point
,
80 const ACE_Time_Value
& time
);
81 Monitor_Base
* monitor_point (const char* name
);
83 /// Works similarly to monitor_point() above, but registers the
84 /// handler arg's handle_timeout() method with the reactor,
85 /// instead of our auto_updater_'s handle_timeout().
86 void auto_query (ACE_Event_Handler
* handler
,
88 const ACE_Time_Value
& time
);
90 /// This mutator allows the application to create its own reactor
91 /// and substitute it for the default reactor.
92 void reactor (ACE_Reactor
* new_reactor
);
93 ACE_Reactor
* reactor (void) const;
96 Monitor_Point_Auto_Updater auto_updater_
;
97 ACE_Reactor
* reactor_
;
98 bool default_reactor_
;
103 ACE_END_VERSIONED_NAMESPACE_DECL
105 #endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
107 #include /**/ "ace/post.h"
109 #endif // MONITOR_ADMIN_H