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
00030 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00031
00032 class ETCL_Constraint;
00033
00034 namespace ACE
00035 {
00036 namespace Monitor_Control
00037 {
00038 class Control_Action;
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 class ACE_Export Monitor_Base
00051 : private ACE_Refcountable_T<ACE_SYNCH_MUTEX>
00052 {
00053 public:
00054 typedef Monitor_Control_Types::ConstraintList CONSTRAINTS;
00055 typedef CONSTRAINTS::const_iterator CONSTRAINT_ITERATOR;
00056
00057
00058
00059 virtual void update (void) = 0;
00060
00061
00062 virtual void receive (double value);
00063
00064
00065 virtual void receive (size_t value);
00066
00067
00068 long add_constraint (const char* expression,
00069 Control_Action* action = 0);
00070
00071
00072
00073 Control_Action* remove_constraint (const long constraint_id);
00074
00075
00076 CONSTRAINTS& constraints (void);
00077
00078
00079 void clear (void);
00080
00081
00082 void retrieve (Monitor_Control_Types::Data& data) const;
00083 void retrieve_and_clear (Monitor_Control_Types::Data& data);
00084
00085
00086
00087 void add_to_registry (
00088 const ACE_Time_Value& time = ACE_Time_Value::zero);
00089 void remove_from_registry (void);
00090
00091 const char* name (void) const;
00092 void name (const char* new_name);
00093
00094 void add_ref (void);
00095 void remove_ref (void);
00096
00097 protected:
00098 Monitor_Base (void);
00099 Monitor_Base (const char* name);
00100 virtual ~Monitor_Base (void);
00101
00102
00103
00104 virtual void clear_i (void);
00105
00106 protected:
00107 Monitor_Control_Types::Data data_;
00108 mutable ACE_SYNCH_MUTEX mutex_;
00109
00110 CONSTRAINTS constraints_;
00111
00112 private:
00113 ACE_CString name_;
00114 };
00115 }
00116 }
00117
00118 ACE_END_VERSIONED_NAMESPACE_DECL
00119
00120 #if defined (__ACE_INLINE__)
00121 #include "ace/Monitor_Base.inl"
00122 #endif
00123
00124 #endif
00125
00126 #include "ace/post.h"
00127
00128 #endif // MONITOR_BASE_H