---
name: "ACE_ODB"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_ODB"
---

# ACE\_ODB(3)

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

## NAME

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

## SYNOPSIS

```
#include <ace/Dump.h>
class ACE_ODB
{
  public:
    enum {MAX_TABLE_SIZE = 100000};
    void dump_objects (void);
    void register_object (const ACE_Dumpable *dumper);
    void remove_object (const void *this_);
    static ACE_ODB *instance (void);
  private:
    ACE_ODB (void);
    struct Tuple
    {
      public:
        const void *this_;
        const ACE_Dumpable_Ptr dumper_;
        inline Tuple (void);
    };
```

    static ACE\_ODB \*instance\_;     Tuple object\_table\_\[ACE\_ODB::MAX\_TABLE\_SIZE\];     int current\_size\_; };

## DESCRIPTION

A prototype mechanism that allow all ACE objects to be registered with a central in-memory "database" that can dump the state of all live ACE objects (e.g., from within a debugger).

To turn on this feature simply compile with -DACE\_NDEBUG

There are several interesting aspects to this design:

1\. It uses the External Polymorphism pattern to avoid having to\
    derive all ACE classes from a common base class that has virtual\
    methods (this is crucial to avoid unnecessary overhead).  In\
    addition, there is no additional space added to ACE objects\
    (this is crucial to maintain binary layout compatibility).

2\. This mechanism can be conditionally compiled in order to\
    completely disable this feature entirely.  Moreover, by\
    using macros there are relatively few changes to ACE code.

3\. This mechanism copes with single-inheritance hierarchies of\
    dumpable classes.  In such cases we typically want only one\
    dump, corresponding to the most derived instance.  Thanks to\
    Christian Millour (chris@etca.fr) for illustrating how to do\
    this.  Note, however, that this scheme doesn't generalize to\
    work with multiple-inheritance or virtual base classes.

Future work includes:

1\. Using a dynamic object table rather than a static table

2\. Adding support to allow particular classes of objects to\
    be selectively dumped.

## PUBLIC MEMBERS

```
void dump_objects (void);
```

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

```
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_);
```

Use this\_ to locate and remove the associated dumper from the list of registered ACE objects.

```
static ACE_ODB *instance (void);
```

Interface to the Singleton instance of the object database.

## PRIVATE MEMBERS

```
ACE_ODB (void);
```

Ensure we have a Singleton...

```
static ACE_ODB *instance_;
```

Singleton instance of this class.

```
Tuple object_table_[ACE_ODB::MAX_TABLE_SIZE];
```

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

```
int current_size_;
```

Current size of object\_table\_.

## AUTHOR

Doug Schmidt

## LIBRARY

ace
