Fixed typos
[ACE_TAO.git] / ACE / ace / Monitor_Point_Registry.h
blob42245249d6361234b4da6bfdd61309d523ab3266
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Monitor_Point_Registry.h
7 * @author Jeff Parsons <j.parsons@vanderbilt.edu>
8 */
9 //=============================================================================
11 #ifndef MONITOR_POINT_REGISTRY_H
12 #define MONITOR_POINT_REGISTRY_H
14 #include /**/ "ace/pre.h"
16 #include "ace/Thread_Mutex.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
24 #include "ace/Synch_Traits.h"
25 #include "ace/Null_Mutex.h"
26 #include "ace/Hash_Map_Manager_T.h"
27 #include "ace/Monitor_Control_Types.h"
28 #include "ace/Singleton.h"
30 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 namespace ACE
34 namespace Monitor_Control
36 class Monitor_Base;
38 /**
39 * @class Monitor_Point_Registry
41 * @brief Storage for instantiated monitor points.
44 class ACE_Export Monitor_Point_Registry
46 public:
47 friend class ACE_Singleton<Monitor_Point_Registry, ACE_SYNCH_MUTEX>;
49 /// Used to help ensure that there is only a single instance
50 /// per process of Monitor_Point_Registry.
51 static Monitor_Point_Registry* instance (void);
53 /// Adds a monitor to the registry.
54 bool add (Monitor_Base* type);
56 /// Remove a monitor from the registry.
57 bool remove (const char* name);
59 /// Returns a list of names stored in the registry
60 Monitor_Control_Types::NameList names (void);
62 /// Increments the refcount, so the caller is responsible for
63 /// decrementing it when finished.
64 Monitor_Base* get (const ACE_CString& name) const;
66 /// Returns a unique id for a constraint when it is created.
67 long constraint_id (void);
69 /// Decrements the reference count on all remaining entries,
70 /// called right before we go out of scope (i.e., process exits).
71 void cleanup (void);
73 private:
74 /// Prevent that users can make an instance.
75 Monitor_Point_Registry (void);
77 /// Underlying container for the registry.
78 typedef ACE_Hash_Map_Manager<ACE_CString,
79 Monitor_Base*,
80 ACE_SYNCH_NULL_MUTEX> Map;
82 mutable ACE_SYNCH_MUTEX mutex_;
83 Map map_;
85 /// Since we're accessed as a singleton, we can keep track of
86 /// dispensing unique ids for constraints.
87 long constraint_id_;
92 ACE_END_VERSIONED_NAMESPACE_DECL
94 #endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
96 #include /**/ "ace/post.h"
98 #endif // MONITOR_POINT_REGISTRY_H