ACE_Managed_Object< TYPE > Class Template Reference

Wrapper for interface to allocate an object managed by the ACE_Object_Manager. More...

#include <Managed_Object.h>

List of all members.

Static Public Member Functions

TYPE * get_preallocated_object (ACE_Object_Manager::Preallocated_Object identifier)
TYPE * get_preallocated_array (ACE_Object_Manager::Preallocated_Array identifier)

Protected Member Functions

 ACE_Managed_Object (void)

Private Member Functions

 ACE_Managed_Object (const ACE_Managed_Object< TYPE > &)
void operator= (const ACE_Managed_Object< TYPE > &)


Detailed Description

template<class TYPE>
class ACE_Managed_Object< TYPE >

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. 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.

Definition at line 102 of file Managed_Object.h.


Constructor & Destructor Documentation

template<class TYPE>
ACE_Managed_Object< TYPE >::ACE_Managed_Object void   )  [protected]
 

template<class TYPE>
ACE_Managed_Object< TYPE >::ACE_Managed_Object const ACE_Managed_Object< TYPE > &   )  [private]
 


Member Function Documentation

template<class TYPE>
TYPE* ACE_Managed_Object< TYPE >::get_preallocated_array ACE_Object_Manager::Preallocated_Array  identifier  )  [inline, static]
 

Definition at line 123 of file Managed_Object.h.

00124   {
00125     // The preallocated array are in a separate, "read-only" array so
00126     // that this function doesn't need a lock.  Also, because it is
00127     // intended _only_ for use with hard-code values, it performs no
00128     // range checking on "id".
00129 
00130     // Cast the return type of the the object pointer based
00131     // on the type of the function template parameter.
00132     return &((ACE_Cleanup_Adapter<TYPE> *)
00133              ACE_Object_Manager::preallocated_array[identifier])->object ();
00134   }

template<class TYPE>
TYPE* ACE_Managed_Object< TYPE >::get_preallocated_object ACE_Object_Manager::Preallocated_Object  identifier  )  [inline, static]
 

Definition at line 105 of file Managed_Object.h.

00106   {
00107     // The preallocated objects are in a separate, "read-only" array so
00108     // that this function doesn't need a lock.  Also, because it is
00109     // intended _only_ for use with hard-code values, it performs no
00110     // range checking on "id".
00111 
00112     // Cast the return type of the the object pointer based
00113     // on the type of the function template parameter.
00114     return &((ACE_Cleanup_Adapter<TYPE> *)
00115              ACE_Object_Manager::preallocated_object[identifier])->object ();
00116   }

template<class TYPE>
void ACE_Managed_Object< TYPE >::operator= const ACE_Managed_Object< TYPE > &   )  [private]
 


The documentation for this class was generated from the following file:
Generated on Thu Nov 9 11:24:20 2006 for ACE by doxygen 1.3.6