Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

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.

Classes

struct  Tuple

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

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

Static Private Attributes

static 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...
Enumerator:
MAX_TABLE_SIZE 

Definition at line 118 of file Dump.h.

{MAX_TABLE_SIZE = 100000};


Constructor & Destructor Documentation

ACE_ODB::ACE_ODB ( void   )  [private]

Definition at line 50 of file Dump.cpp.

  : current_size_ (0)
{
  ACE_TRACE ("ACE_ODB::ACE_ODB");
}


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.

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

ACE_ODB * ACE_ODB::instance ( void   )  [static]

Interface to the Singleton instance of the object database.

Definition at line 58 of file Dump.cpp.

{
  ACE_TRACE ("ACE_ODB::instance");

  if (ACE_ODB::instance_ == 0)
    {
      ACE_MT (ACE_Thread_Mutex *lock =
        ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object
          (ACE_Object_Manager::ACE_DUMP_LOCK);
        ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0));

      if (ACE_ODB::instance_ == 0)
        ACE_NEW_RETURN (ACE_ODB::instance_,
                        ACE_ODB,
                        0);
    }

  return ACE_ODB::instance_;
}

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.

{
  ACE_TRACE ("ACE_ODB::register_object");
  int i;
  int slot = 0;

  for (i = 0; i < this->current_size_; i++)
    {
      if (this->object_table_[i].this_ == 0)
        slot = i;
      else if (this->object_table_[i].this_ == dumper->this_)
        {
          slot = i;
          break;
        }
    }

  if (i == this->current_size_)
    {
      slot = this->current_size_++;
      ACE_ASSERT (this->current_size_ < ACE_ODB::MAX_TABLE_SIZE);
    }
  this->object_table_[slot].this_ = dumper->this_;
  this->object_table_[slot].dumper_ = dumper;
}

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 121 of file Dump.cpp.

{
  ACE_TRACE ("ACE_ODB::remove_object");
  int i;

  for (i = 0; i < this->current_size_; i++)
    {
      if (this->object_table_[i].this_ == this_ptr)
        break;
    }

  if (i < this->current_size_)
    {
      this->object_table_[i].this_ = 0;
      this->object_table_[i].dumper_ = 0;
    }
}


Member Data Documentation

int ACE_ODB::current_size_ [private]

Current size of <object_table_>.

Definition at line 163 of file Dump.h.

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

Singleton instance of this class.

Definition at line 156 of file Dump.h.

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines