Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef MONITOR_BASE_H
00014 #define MONITOR_BASE_H
00015
00016 #include "ace/pre.h"
00017
00018 #include "ace/Monitor_Control_Types.h"
00019
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 #pragma once
00022 #endif
00023
00024 #if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
00025
00026 #include "ace/Refcountable_T.h"
00027 #include "ace/Thread_Mutex.h"
00028 #include "ace/Synch_Traits.h"
00029 #include "ace/CDR_Base.h"
00030
00031 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00032
00033 class ETCL_Constraint;
00034
00035 namespace ACE
00036 {
00037 namespace Monitor_Control
00038 {
00039 class Control_Action;
00040
00041
00042
00043
00044
00045
00046
00047 class ACE_Export Monitor_Base
00048 : private ACE_Refcountable_T<ACE_SYNCH_MUTEX>
00049 {
00050 public:
00051 typedef Monitor_Control_Types::ConstraintList CONSTRAINTS;
00052 typedef CONSTRAINTS::const_iterator CONSTRAINT_ITERATOR;
00053
00054 Monitor_Base (const char* name,
00055 Monitor_Control_Types::Information_Type type);
00056 virtual ~Monitor_Base (void);
00057
00058
00059
00060 virtual void update (void);
00061
00062
00063 virtual void receive (double data);
00064
00065
00066 virtual void receive (size_t data);
00067
00068
00069 virtual void receive (const Monitor_Control_Types::NameList& data);
00070
00071
00072 long add_constraint (const char* expression,
00073 Control_Action* action = 0);
00074
00075
00076
00077 Control_Action* remove_constraint (const long constraint_id);
00078
00079
00080 CONSTRAINTS& constraints (void);
00081
00082
00083 virtual void clear (void);
00084
00085
00086 void retrieve (Monitor_Control_Types::Data& data) const;
00087 void retrieve_and_clear (Monitor_Control_Types::Data& data);
00088
00089
00090
00091 void add_to_registry (
00092 const ACE_Time_Value& time = ACE_Time_Value::zero);
00093 void remove_from_registry (void);
00094
00095 const char* name (void) const;
00096 void name (const char* new_name);
00097
00098 void add_ref (void);
00099 void remove_ref (void);
00100
00101
00102 double average (void) const;
00103
00104
00105 double sum_of_squares (void) const;
00106
00107
00108 size_t count (void) const;
00109
00110
00111 double minimum_sample (void) const;
00112
00113
00114 double maximum_sample (void) const;
00115
00116
00117 double last_sample (void) const;
00118
00119
00120 Monitor_Control_Types::Information_Type type (void) const;
00121
00122
00123 Monitor_Control_Types::NameList get_list (void) const;
00124
00125 protected:
00126
00127
00128 virtual void clear_i (void);
00129
00130 protected:
00131 Monitor_Control_Types::Data data_;
00132 mutable ACE_SYNCH_MUTEX mutex_;
00133
00134 CONSTRAINTS constraints_;
00135
00136 private:
00137 ACE_CString name_;
00138 };
00139 }
00140 }
00141
00142 ACE_END_VERSIONED_NAMESPACE_DECL
00143
00144 #if defined (__ACE_INLINE__)
00145 #include "ace/Monitor_Base.inl"
00146 #endif
00147
00148 #endif
00149
00150 #include "ace/post.h"
00151
00152 #endif // MONITOR_BASE_H