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