#include <Dump.h>
Collaboration diagram for ACE_ODB:
Public Types | |
MAX_TABLE_SIZE = 100000 | |
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_ODB * | instance (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_ODB * | instance_ = 0 |
Singleton instance of this class. | |
Classes | |
struct | Tuple |
Definition at line 114 of file Dump.h.
anonymous enum |
Definition at line 118 of file Dump.h.
00118 {MAX_TABLE_SIZE = 100000};
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 }
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, and current_size_.
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_TRACE, current_size_, and ACE_Dumpable::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 <this_> to locate and remove the associated <dumper> from the list of registered ACE objects.
Definition at line 121 of file Dump.cpp.
References ACE_TRACE, and current_size_.
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 }
int ACE_ODB::current_size_ [private] |
Current size of <object_table_>.
Definition at line 163 of file Dump.h.
Referenced by dump_objects(), register_object(), and remove_object().
ACE_ODB * ACE_ODB::instance_ = 0 [static, private] |
Tuple ACE_ODB::object_table_[ACE_ODB::MAX_TABLE_SIZE] [private] |