Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 Methods

void dump_objects (void)
 Iterates through the entire set of registered objects and dumps their state. More...

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

void remove_object (const void *this_)
 Use <this_> to locate and remove the associated <dumper> from the list of registered ACE objects. More...


Static Public Methods

ACE_ODB * instance (void)
 Interface to the Singleton instance of the object database. More...


Private Methods

 ACE_ODB (void)

Private Attributes

Tuple object_table_ [ACE_ODB::MAX_TABLE_SIZE]
 The current implementation is very simple-minded and will be changed to be dynamic. More...

int current_size_
 Current size of <object_table_>. More...


Static Private Attributes

ACE_ODB * instance_ = 0
 Singleton instance of this class. More...


Detailed Description

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

Definition at line 112 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 116 of file Dump.h.

00116 {MAX_TABLE_SIZE = 100000};


Constructor & Destructor Documentation

ACE_ODB::ACE_ODB void    [private]
 

Definition at line 48 of file Dump.cpp.

References ACE_TRACE.

00050   : current_size_ (0)
00051 {
00052   ACE_TRACE ("ACE_ODB::ACE_ODB");
00053 }


Member Function Documentation

void ACE_ODB::dump_objects void   
 

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

Definition at line 77 of file Dump.cpp.

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

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

ACE_ODB * ACE_ODB::instance void    [static]
 

Interface to the Singleton instance of the object database.

Definition at line 56 of file Dump.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_NEW_RETURN, ACE_TRACE, and instance_.

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

void ACE_ODB::register_object const ACE_Dumpable   dumper
 

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

Definition at line 92 of file Dump.cpp.

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

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

void ACE_ODB::remove_object const void *    this_
 

Use <this_> to locate and remove the associated <dumper> from the list of registered ACE objects.

Definition at line 119 of file Dump.cpp.

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

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


Member Data Documentation

int ACE_ODB::current_size_ [private]
 

Current size of <object_table_>.

Definition at line 161 of file Dump.h.

Referenced by dump_objects, register_object, and remove_object.

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

Singleton instance of this class.

Definition at line 137 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 158 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 Mon Jun 16 12:51:21 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002