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

# ACE_Configuration_Heap Class Reference

The concrete implementation of a allocator based configuration database. More...

`#include <Configuration.h>`

Inheritance diagram for ACE_Configuration_Heap:

[legend]
Collaboration diagram for ACE_Configuration_Heap:

[legend]
List of all members.

## Public Methods
| ACE_Configuration_Heap (void)
| Default ctor. More...
virtual | ~ACE_Configuration_Heap (void)
| destructor. More...
int | open (const ACE_TCHAR *file_name, void *base_address=ACE_DEFAULT_BASE_ADDR, int default_map_size=ACE_DEFAULT_CONFIG_SECTION_SIZE)
| opens a configuration based on a file name. More...
int | open (int default_map_size=ACE_DEFAULT_CONFIG_SECTION_SIZE)
| opens a heap based configuration. More...
virtual int | open_section (const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, int create, ACE_Configuration_Section_Key &result)
| Finds a <sub_section> in <base> and places the resulting key in <result>. More...
virtual int | remove_section (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *sub_section, int recursive)
| Removes the <sub_section> from <key>. If recursive is non zero, any subkeys below <sub_section> are remove as well. More...
virtual int | enumerate_values (const ACE_Configuration_Section_Key &key, int Index, ACE_TString &name, VALUETYPE &type)
| method to enumerate through the <name> and <type> of values in a <key>. More...
virtual int | enumerate_sections (const ACE_Configuration_Section_Key &key, int Index, ACE_TString &name)
| method to enumerate through the <name> subsections in <key>. More...
virtual int | set_string_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, const ACE_TString &value)
| sets the value in <key> with <name> to a string of <value>. More...
virtual int | set_integer_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, u_int value)
| sets the value in <key> with <name> to an integer of <value>. More...
virtual int | set_binary_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, const void *data, u_int length)
| sets the value in <key> with <name> to binary data of <data> with <length>. More...
virtual int | get_string_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, ACE_TString &value)
| gets the string value of <name> from <key> and places it in <value>. Returns non zero on error (if value is not a string). More...
virtual int | get_integer_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, u_int &value)
| gets the integer value of <name> from <key> and places it in <value>. Returns non zero on error (if value is not an integer). More...
virtual int | get_binary_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, void *&data, u_int &length)
| gets the binary value of <name> from <key> and places a copy in <data> and sets <length> to the length of the data. More...
virtual int | find_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, VALUETYPE &type)
| checks to see if an entry of <name> is in <key> and places the data type in <type>. More...
virtual int | remove_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name)
| Removes the the value <name> from <key>. returns non zero on error. More...
## Private Methods
int | add_section (const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, ACE_Configuration_Section_Key &result)
| adds a new section. More...
int | create_index (void)
| Helper for the <open> method. More...
int | create_index_helper (void *buffer)
| Helper for <create_index> method: places hash table into an allocated space. More...
int | value_open_helper (size_t hash_table_size, void *buffer)
int | section_open_helper (size_t hash_table_size, void *buffer)
int | load_key (const ACE_Configuration_Section_Key &key, ACE_TString &name)
int | new_section (const ACE_TString &section, ACE_Configuration_Section_Key &result)
| ACE_Configuration_Heap (const ACE_Configuration_Heap &rhs)
ACE_Configuration_Heap & | operator= (const ACE_Configuration_Heap &rhs)
## Private Attributes
ACE_Allocator * | allocator_
SECTION_MAP * | index_
int | default_map_size_

## Detailed Description

The concrete implementation of a allocator based configuration database.

This class uses ACE's Allocators to manage a memory representation of a configuraiton database. A persistent heap may be used to store configurations persistently

Note: Before using this class you must call one of the open methods.

Todo:
  -Need to investigate what happens if memory mapped file gets mapped to a location different than it was created with.

## Constructor & Destructor Documentation

ACE_Configuration_Heap::ACE_Configuration_Heap | ( | void |  | ) |

| Default ctor.

ACE_Configuration_Heap::~ACE_Configuration_Heap | ( | void |  | ) | `[virtual]`

| destructor.

ACE_Configuration_Heap::ACE_Configuration_Heap | ( | const ACE_Configuration_Heap & | rhs | ) | `[private]`

## Member Function Documentation

int ACE_Configuration_Heap::add_section | ( | const ACE_Configuration_Section_Key & | base,
|  | const ACE_TCHAR * | sub_section,
|  | ACE_Configuration_Section_Key & | result
| ) | `[private]`

| adds a new section.

int ACE_Configuration_Heap::create_index | ( | void |  | ) | `[private]`

| Helper for the <open> method.

int ACE_Configuration_Heap::create_index_helper | ( | void * | buffer | ) | `[private]`

| Helper for <create_index> method: places hash table into an allocated space.

int ACE_Configuration_Heap::enumerate_sections | ( | const ACE_Configuration_Section_Key & | key,
|  | int | index,
|  | ACE_TString & | name
| ) | `[virtual]`

| method to enumerate through the <name> subsections in <key>. To begin iteration, <index> must zero. to continue iteration, invoke enumerate_sections again while incrementing index. Each iteration will return the <name> of the sub section. This method returns 0 on success, <0 on error and 1 when there are no more subsections to iterate through. Note - you may not delete or add values while enumerating. If you need to do this, you start the enumeration over again. Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::enumerate_values | ( | const ACE_Configuration_Section_Key & | key,
|  | int | index,
|  | ACE_TString & | name,
|  | VALUETYPE & | type
| ) | `[virtual]`

| method to enumerate through the <name> and <type> of values in a <key>. To begin iteration, <index> must be zero. to continue iteration, invoke enumerate_values again while incrementing index. Each iteration will return the <name> of the value and its <type>. This method returns 0 on success, <0 on error and 1 when there are no more values to iterate through. Note - you may not delete or add values while enumerating. If you need to do this, you start the enumeration over again. Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::find_value | ( | const ACE_Configuration_Section_Key & | key,
|  | const ACE_TCHAR * | name,
|  | VALUETYPE & | type_out
| ) | `[virtual]`

| checks to see if an entry of <name> is in <key> and places the data type in <type>. Returns 0 on success (entry is found), -1 on error Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::get_binary_value | ( | const ACE_Configuration_Section_Key & | key,
|  | const ACE_TCHAR * | name,
|  | void *& | data,
|  | u_int & | length
| ) | `[virtual]`

| gets the binary value of <name> from <key> and places a copy in <data> and sets <length> to the length of the data. caller is responsible for deleting <data>. Returns non zero on error (if value is not binary). Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::get_integer_value | ( | const ACE_Configuration_Section_Key & | key,
|  | const ACE_TCHAR * | name,
|  | u_int & | value
| ) | `[virtual]`

| gets the integer value of <name> from <key> and places it in <value>. Returns non zero on error (if value is not an integer). Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::get_string_value | ( | const ACE_Configuration_Section_Key & | key,
|  | const ACE_TCHAR * | name,
|  | ACE_TString & | value
| ) | `[virtual]`

| gets the string value of <name> from <key> and places it in <value>. Returns non zero on error (if value is not a string). Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::load_key | ( | const ACE_Configuration_Section_Key & | key,
|  | ACE_TString & | name
| ) | `[private]`

int ACE_Configuration_Heap::new_section | ( | const ACE_TString & | section,
|  | ACE_Configuration_Section_Key & | result
| ) | `[private]`

int ACE_Configuration_Heap::open | ( | int | default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE | ) |

| opens a heap based configuration.

int ACE_Configuration_Heap::open | ( | const ACE_TCHAR * | file_name,
|  | void * | base_address = ACE_DEFAULT_BASE_ADDR,
|  | int | default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE
| ) |

| opens a configuration based on a file name.

int ACE_Configuration_Heap::open_section | ( | const ACE_Configuration_Section_Key & | base,
|  | const ACE_TCHAR * | sub_section,
|  | int | create,
|  | ACE_Configuration_Section_Key & | result
| ) | `[virtual]`

| Finds a <sub_section> in <base> and places the resulting key in <result>. If create is non zero, the sub_section will be created if it doesn't exist Reimplemented from ACE_Configuration.

ACE_Configuration_Heap& ACE_Configuration_Heap::operator= | ( | const ACE_Configuration_Heap & | rhs | ) | `[private]`

int ACE_Configuration_Heap::remove_section | ( | const ACE_Configuration_Section_Key & | key,
|  | const ACE_TCHAR * | sub_section,
|  | int | recursive
| ) | `[virtual]`

| Removes the <sub_section> from <key>. If recursive is non zero, any subkeys below <sub_section> are remove as well. Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::remove_value | ( | const ACE_Configuration_Section_Key & | key,
|  | const ACE_TCHAR * | name
| ) | `[virtual]`

| Removes the the value <name> from <key>. returns non zero on error. Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::section_open_helper | ( | size_t | hash_table_size,
|  | void * | buffer
| ) | `[private]`

int ACE_Configuration_Heap::set_binary_value | ( | const ACE_Configuration_Section_Key & | key,
|  | const ACE_TCHAR * | name,
|  | const void * | data,
|  | u_int | length
| ) | `[virtual]`

| sets the value in <key> with <name> to binary data of <data> with <length>. Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::set_integer_value | ( | const ACE_Configuration_Section_Key & | key,
|  | const ACE_TCHAR * | name,
|  | u_int | value
| ) | `[virtual]`

| sets the value in <key> with <name> to an integer of <value>. Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::set_string_value | ( | const ACE_Configuration_Section_Key & | key,
|  | const ACE_TCHAR * | name,
|  | const ACE_TString & | value
| ) | `[virtual]`

| sets the value in <key> with <name> to a string of <value>. Reimplemented from ACE_Configuration.

int ACE_Configuration_Heap::value_open_helper | ( | size_t | hash_table_size,
|  | void * | buffer
| ) | `[private]`

## Member Data Documentation

ACE_Allocator* ACE_Configuration_Heap::allocator_`[private]`

int ACE_Configuration_Heap::default_map_size_`[private]`

SECTION_MAP* ACE_Configuration_Heap::index_`[private]`

The documentation for this class was generated from the following files:

- Configuration.h
- Configuration.cpp