diff options
Diffstat (limited to 'ace/Managed_Object.h')
-rw-r--r-- | ace/Managed_Object.h | 135 |
1 files changed, 66 insertions, 69 deletions
diff --git a/ace/Managed_Object.h b/ace/Managed_Object.h index d5b8eb71d8d..7b96dd8fdaa 100644 --- a/ace/Managed_Object.h +++ b/ace/Managed_Object.h @@ -1,18 +1,15 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Managed_Object.h -// -// = AUTHORS -// David L. Levine -// -// ============================================================================ + +//============================================================================= +/** + * @file Managed_Object.h + * + * $Id$ + * + * @author David L. Levine + */ +//============================================================================= + #ifndef ACE_MANAGED_OBJECT_H #define ACE_MANAGED_OBJECT_H @@ -26,78 +23,78 @@ #include "ace/Object_Manager.h" +/** + * @class ACE_Cleanup_Adapter + * + * @brief Adapter for ACE_Cleanup objects that allows them to be readily + * managed by the ACE_Object_Manager. + * + * This template class adapts an object of any type to be an + * ACE_Cleanup object. The object can then be destroyed + * type-safely by the ACE_Object_Manager. This class is + * typically used to replace a cast; but, it's a bit cleaner and + * allows insertion of, say, run-time type identification + * internally if desired. + */ template <class TYPE> class ACE_Cleanup_Adapter : public ACE_Cleanup { - // = TITLE - // Adapter for ACE_Cleanup objects that allows them to be readily - // managed by the ACE_Object_Manager. - // - // = DESCRIPTION - // This template class adapts an object of any type to be an - // ACE_Cleanup object. The object can then be destroyed - // type-safely by the ACE_Object_Manager. This class is - // typically used to replace a cast; but, it's a bit cleaner and - // allows insertion of, say, run-time type identification - // internally if desired. public: + /// Default constructor. ACE_Cleanup_Adapter (void); - // Default constructor. + /// Virtual destructor, needed by some compilers for vtable placement. virtual ~ACE_Cleanup_Adapter (void); - // Virtual destructor, needed by some compilers for vtable placement. + /// Accessor for contained object. TYPE &object (void); - // Accessor for contained object. private: + /// Contained object. TYPE object_; - // Contained object. }; +/** + * @class ACE_Managed_Object + * + * @brief Wrapper for interface to allocate an object managed by the + * ACE_Object_Manager. + * + * This template class wraps an interface that is used to + * allocate and access an object that is managed by the + * ACE_Object_Manager. Because static template member functions + * are not supported by some compilers, it is a separate + * (template) class. + * This interface is typically used to replace a static object + * with one that is dynamically allocated. It helps to avoid + * problems with order of static object + * construction/destruction. Managed objects won't be allocated + * until needed, but should be allocated when first needed. And + * they are destroyed in the reverse order of construction. + * <get_preallocated_object> accesses a "preallocated" object, + * i.e., one that is identified by a value in the + * ACE_Object_Manager:: Preallocated_Object enum. These objects + * are used internally by the ACE library. + * Hooks are provided for the application to preallocate objects + * via the same mechanism. + * ACE_APPLICATION_PREALLOCATED_OBJECT_DECLARATIONS can be used + * to define enum values; + * ACE_APPLICATION_PREALLOCATED_OBJECT_DEFINITIONS can be used + * to define the corresponding objects. The format of the ACE + * internal library definitions should be followed. And + * similarly, ACE_APPLICATION_PREALLOCATED_ARRAY_DECLARATIONS + * and ACE_APPLICATION_PREALLOCATED_ARRAY_DEFINITIONS can be + * used to preallocate arrays. + * By default, preallocation uses dynamic allocation. The + * preallocated objects and arrays are allocated off the heap in + * the ACE_Object_Manager constructor. To statically place the + * preallocated objects in program global data instead of on the + * heap, #define ACE_HAS_STATIC_PREALLOCATION prior to building + * the ACE library. + */ template <class TYPE> class ACE_Managed_Object { - // = TITLE - // Wrapper for interface to allocate an object managed by the - // ACE_Object_Manager. - // - // = DESCRIPTION - // This template class wraps an interface that is used to - // allocate and access an object that is managed by the - // ACE_Object_Manager. Because static template member functions - // are not supported by some compilers, it is a separate - // (template) class. - // - // This interface is typically used to replace a static object - // with one that is dynamically allocated. It helps to avoid - // problems with order of static object - // construction/destruction. Managed objects won't be allocated - // until needed, but should be allocated when first needed. And - // they are destroyed in the reverse order of construction. - // - // <get_preallocated_object> accesses a "preallocated" object, - // i.e., one that is identified by a value in the - // ACE_Object_Manager:: Preallocated_Object enum. These objects - // are used internally by the ACE library. - // - // Hooks are provided for the application to preallocate objects - // via the same mechanism. - // ACE_APPLICATION_PREALLOCATED_OBJECT_DECLARATIONS can be used - // to define enum values; - // ACE_APPLICATION_PREALLOCATED_OBJECT_DEFINITIONS can be used - // to define the corresponding objects. The format of the ACE - // internal library definitions should be followed. And - // similarly, ACE_APPLICATION_PREALLOCATED_ARRAY_DECLARATIONS - // and ACE_APPLICATION_PREALLOCATED_ARRAY_DEFINITIONS can be - // used to preallocate arrays. - // - // By default, preallocation uses dynamic allocation. The - // preallocated objects and arrays are allocated off the heap in - // the ACE_Object_Manager constructor. To statically place the - // preallocated objects in program global data instead of on the - // heap, #define ACE_HAS_STATIC_PREALLOCATION prior to building - // the ACE library. public: static TYPE *get_preallocated_object (ACE_Object_Manager::Preallocated_Object id) { |