summaryrefslogtreecommitdiff
path: root/ace/Managed_Object.i
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-09-20 22:32:07 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-09-20 22:32:07 +0000
commit5ee93a4dba1542ad8d2136ba0ffb389bbefc16b0 (patch)
treedfedd325947bec8380259bf875c36a9f61a4a574 /ace/Managed_Object.i
parent7ed16425b8bed4d147fa7eb2ad8434de100fbc5a (diff)
downloadATCD-5ee93a4dba1542ad8d2136ba0ffb389bbefc16b0.tar.gz
revised ACE_Object_Manager interface for preallocated objects
Diffstat (limited to 'ace/Managed_Object.i')
-rw-r--r--ace/Managed_Object.i52
1 files changed, 52 insertions, 0 deletions
diff --git a/ace/Managed_Object.i b/ace/Managed_Object.i
new file mode 100644
index 00000000000..9c38a7542c5
--- /dev/null
+++ b/ace/Managed_Object.i
@@ -0,0 +1,52 @@
+/* -*- C++ -*- */
+// $Id$
+
+// Note: don't explicitly initialize "object_", because TYPE may not
+// have a default constructor. Let the compiler figure it out . . .
+template <class TYPE>
+ACE_INLINE
+ACE_Managed_Cleanup<TYPE>::ACE_Managed_Cleanup (void)
+{
+}
+
+template <class TYPE>
+ACE_INLINE
+TYPE &
+ACE_Managed_Cleanup<TYPE>::object (void)
+{
+ return this->object_;
+}
+
+template <class TYPE>
+ACE_INLINE
+TYPE *
+ACE_Managed_Object<TYPE>::get_preallocated_object
+ (ACE_Object_Manager::Preallocated_Object id)
+{
+ // The preallocated objects are in a separate, "read-only" array so
+ // that this function doesn't need a lock. Also, because it is
+ // intended _only_ for use with hard-code values, it performs no
+ // range checking on "id".
+
+ // Cast the return type of the the object pointer based
+ // on the type of the function template parameter.
+ return &((ACE_Managed_Cleanup<TYPE> *)
+ ACE_Object_Manager::preallocated_object[id])->object ();
+}
+
+template <class TYPE>
+ACE_INLINE
+TYPE *
+ACE_Managed_Object<TYPE>::get_preallocated_array
+ (ACE_Object_Manager::Preallocated_Array id)
+{
+ // The preallocated array are in a separate, "read-only" array so
+ // that this function doesn't need a lock. Also, because it is
+ // intended _only_ for use with hard-code values, it performs no
+ // range checking on "id".
+
+ // Cast the return type of the the object pointer based
+ // on the type of the function template parameter.
+ return &((ACE_Managed_Cleanup<TYPE> *)
+ ACE_Object_Manager::preallocated_array[id])->object ();
+}