ACE_ODB Class Reference

This is the object database (ODB) that keeps track of all live ACE objects. More...

#include <Dump.h>

Collaboration diagram for ACE_ODB:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { MAX_TABLE_SIZE = 100000 }

Public Member Functions

void dump_objects (void)
void register_object (const ACE_Dumpable *dumper)
 Add the tuple <dumper, this_> to the list of registered ACE objects.

void remove_object (const void *this_)

Static Public Member Functions

ACE_ODBinstance (void)
 Interface to the Singleton instance of the object database.


Private Member Functions

 ACE_ODB (void)

Private Attributes

Tuple object_table_ [ACE_ODB::MAX_TABLE_SIZE]
int current_size_
 Current size of .


Static Private Attributes

ACE_ODBinstance_ = 0
 Singleton instance of this class.


Detailed Description

This is the object database (ODB) that keeps track of all live ACE objects.

Definition at line 114 of file Dump.h.


Member Enumeration Documentation

anonymous enum
 

Todo:
This is clearly inadequate and should be dynamic...
Enumeration values:
MAX_TABLE_SIZE 

Definition at line 118 of file Dump.h.

00118 {MAX_TABLE_SIZE = 100000};


Constructor & Destructor Documentation

ACE_ODB::ACE_ODB void   )  [private]
 

Definition at line 50 of file Dump.cpp.

References ACE_TRACE.

00052   : current_size_ (0)
00053 {
00054   ACE_TRACE ("ACE_ODB::ACE_ODB");
00055 }


Member Function Documentation

void ACE_ODB::dump_objects void   ) 
 

Iterates through the entire set of registered objects and dumps their state.

Definition at line 79 of file Dump.cpp.

References ACE_TRACE, ACE_ODB::Tuple::dumper_, object_table_, and ACE_ODB::Tuple::this_.

00080 {
00081   ACE_TRACE ("ACE_ODB::dump_objects");
00082   for (int i = 0; i < this->current_size_; i++)
00083     {
00084       if (this->object_table_[i].this_ != 0)
00085         // Dump the state of the object.
00086         this->object_table_[i].dumper_->dump ();
00087     }
00088 }

ACE_ODB * ACE_ODB::instance void   )  [static]
 

Interface to the Singleton instance of the object database.

Definition at line 58 of file Dump.cpp.

References ACE_GUARD_RETURN, ACE_NEW_RETURN, ACE_TRACE, and instance_.

00059 {
00060   ACE_TRACE ("ACE_ODB::instance");
00061 
00062   if (ACE_ODB::instance_ == 0)
00063     {
00064       ACE_MT (ACE_Thread_Mutex *lock =
00065         ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object
00066           (ACE_Object_Manager::ACE_DUMP_LOCK);
00067         ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0));
00068 
00069       if (ACE_ODB::instance_ == 0)
00070         ACE_NEW_RETURN (ACE_ODB::instance_,
00071                         ACE_ODB,
00072                         0);
00073     }
00074 
00075   return ACE_ODB::instance_;
00076 }

void ACE_ODB::register_object const ACE_Dumpable dumper  ) 
 

Add the tuple <dumper, this_> to the list of registered ACE objects.

Definition at line 94 of file Dump.cpp.

References ACE_ASSERT, ACE_TRACE, ACE_ODB::Tuple::dumper_, MAX_TABLE_SIZE, object_table_, ACE_Dumpable::this_, and ACE_ODB::Tuple::this_.

00095 {
00096   ACE_TRACE ("ACE_ODB::register_object");
00097   int i;
00098   int slot = 0;
00099 
00100   for (i = 0; i < this->current_size_; i++)
00101     {
00102       if (this->object_table_[i].this_ == 0)
00103         slot = i;
00104       else if (this->object_table_[i].this_ == dumper->this_)
00105         {
00106           slot = i;
00107           break;
00108         }
00109     }
00110 
00111   if (i == this->current_size_)
00112     {
00113       slot = this->current_size_++;
00114       ACE_ASSERT (this->current_size_ < ACE_ODB::MAX_TABLE_SIZE);
00115     }
00116   this->object_table_[slot].this_ = dumper->this_;
00117   this->object_table_[slot].dumper_ = dumper;
00118 }

void ACE_ODB::remove_object const void *  this_  ) 
 

Use to locate and remove the associated from the list of registered ACE objects.

Definition at line 121 of file Dump.cpp.

References ACE_TRACE, ACE_ODB::Tuple::dumper_, object_table_, and ACE_ODB::Tuple::this_.

00122 {
00123   ACE_TRACE ("ACE_ODB::remove_object");
00124   int i;
00125 
00126   for (i = 0; i < this->current_size_; i++)
00127     {
00128       if (this->object_table_[i].this_ == this_ptr)
00129         break;
00130     }
00131 
00132   if (i < this->current_size_)
00133     {
00134       this->object_table_[i].this_ = 0;
00135       this->object_table_[i].dumper_ = 0;
00136     }
00137 }


Member Data Documentation

int ACE_ODB::current_size_ [private]
 

Current size of .

Definition at line 163 of file Dump.h.

ACE_ODB * ACE_ODB::instance_ = 0 [static, private]
 

Singleton instance of this class.

Definition at line 139 of file Dump.cpp.

Referenced by instance().

Tuple ACE_ODB::object_table_[ACE_ODB::MAX_TABLE_SIZE] [private]
 

The current implementation is very simple-minded and will be changed to be dynamic.

Definition at line 160 of file Dump.h.

Referenced by dump_objects(), register_object(), and remove_object().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:26:06 2006 for ACE by doxygen 1.3.6