#include <Managed_Object.h>
Static Public Methods | |
| TYPE * | get_preallocated_object (ACE_Object_Manager::Preallocated_Object id) |
| TYPE * | get_preallocated_array (ACE_Object_Manager::Preallocated_Array id) |
Private Methods | |
| ACE_Managed_Object (void) | |
| ACE_Managed_Object (const ACE_Managed_Object< TYPE > &) | |
| void | operator= (const ACE_Managed_Object< TYPE > &) |
Friends | |
| class | this_prevents_compiler_warning_about_only_private_constructors |
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.
Definition at line 100 of file Managed_Object.h.
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
Definition at line 121 of file Managed_Object.h. References ACE_Object_Manager::preallocated_array, and ACE_Object_Manager::Preallocated_Array.
00122 {
00123 // The preallocated array are in a separate, "read-only" array so
00124 // that this function doesn't need a lock. Also, because it is
00125 // intended _only_ for use with hard-code values, it performs no
00126 // range checking on "id".
00127
00128 // Cast the return type of the the object pointer based
00129 // on the type of the function template parameter.
00130 return &((ACE_Cleanup_Adapter<TYPE> *)
00131 ACE_Object_Manager::preallocated_array[id])->object ();
00132 }
|
|
||||||||||
|
Definition at line 103 of file Managed_Object.h. References ACE_Object_Manager::preallocated_object, and ACE_Object_Manager::Preallocated_Object.
00104 {
00105 // The preallocated objects are in a separate, "read-only" array so
00106 // that this function doesn't need a lock. Also, because it is
00107 // intended _only_ for use with hard-code values, it performs no
00108 // range checking on "id".
00109
00110 // Cast the return type of the the object pointer based
00111 // on the type of the function template parameter.
00112 return &((ACE_Cleanup_Adapter<TYPE> *)
00113 ACE_Object_Manager::preallocated_object[id])->object ();
00114 }
|
|
||||||||||
|
|
|
|||||
|
Definition at line 145 of file Managed_Object.h. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002