ACE 8.0.0
|
The concrete implementation of a allocator based configuration database. More...
#include <Configuration.h>
Private Member Functions | |
int | open_simple_section (const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, bool create, ACE_Configuration_Section_Key &result) |
sub_section may not contain path separators | |
int | add_section (const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, ACE_Configuration_Section_Key &result) |
Adds a new section. | |
int | create_index () |
Helper for the <open> method. | |
int | create_index_helper (void *buffer) |
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 §ion, 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_ |
size_t | default_map_size_ |
Additional Inherited Members | |
![]() | |
enum | VALUETYPE { STRING , INTEGER , BINARY , INVALID } |
Enumeration for the various types of values we can store. More... | |
![]() | |
static ACE_TCHAR | NULL_String_ = '\0' |
![]() | |
ACE_Configuration () | |
Default ctor. | |
ACE_Section_Key_Internal * | get_internal_key (const ACE_Configuration_Section_Key &key) |
Resolves the internal key from a section key. | |
int | validate_name (const ACE_TCHAR *name, int allow_path=0) |
int | validate_value_name (const ACE_TCHAR *name) |
ACE_Configuration (const ACE_Configuration &rhs) | |
ACE_Configuration & | operator= (const ACE_Configuration &rhs) |
![]() | |
ACE_Configuration_Section_Key | root_ |
The concrete implementation of a allocator based configuration database.
This class uses ACE's Allocators to manage a memory representation of a configuration database. A persistent heap may be used to store configurations persistently
ACE_Configuration_Heap::ACE_Configuration_Heap | ( | ) |
Default ctor.
|
virtual |
Destructor.
|
private |
|
private |
Adds a new section.
|
private |
Helper for the <open> method.
Helper for create_index() method: places hash table into an allocated space.
|
virtual |
Enumerates through the subsections in a section.
key | Section key to iterate through. |
index | Iteration position. Must be zero on the first call to iterate through key. Increment index by one on each successive call to this method. |
name | Receives the subsection's name. |
0 | for success, name has a valid name. |
1 | there are no more subsections in the section. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
virtual |
Enumerates through the values in a section.
key | Section key to iterate through. |
index | Iteration position. Must be zero on the first call to iterate through key. Increment index by one on each successive call to this method. |
name | Receives the value's name. |
type | Receives the value's data type. |
0 | for success, name and type are valid. |
1 | there are no more values in the section. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
virtual |
Retrieves the type of a named configuration value.
key | Configuration section to look up the name in. |
name | Name of the configuration value to get the type of. |
type | Receives the data type of the named value, if it exists. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
virtual |
Gets a binary-typed value.
key | Configuration section to get the value from. |
name | Name of the configuration value to get. |
data | Receives a pointer to memory holding the binary data for the value. This method allocates the memory pointed to using operator new[]. The caller is responsible for freeing the memory using operator delete[]. |
length | Receives the number of bytes in the value. |
0 | for success; caller is responsible for freeing the returned memory. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
virtual |
Gets an integer-typed value.
key | Configuration section to get the value from. |
name | Name of the configuration value to get. |
value | Receives the configuration value if it exists and has type INTEGER. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
virtual |
Gets a string-typed value.
key | Configuration section to get the value from. |
name | Name of the configuration value to get. |
value | Receives the configuration value if it exists and has type STRING. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
private |
|
private |
int ACE_Configuration_Heap::open | ( | const ACE_TCHAR * | file_name, |
void * | base_address = ACE_DEFAULT_BASE_ADDR, | ||
size_t | default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE ) |
Opens a configuration that allocates its memory from a memory-mapped file. This makes it possible to persist a configuration to permanent storage. This is not the same as exporting the configuration to a file; the memory-mapped file is not likely to be very readable by humans.
file_name | Name of the file to map into memory. |
base_address | Address to map the base of file_name to. |
default_map_size | Starting size for the internal hash tables that contain configuration information. |
0 | for success. |
-1 | for error, with errno set to indicate the cause. If open() is called multiple times, errno will be EBUSY . |
int ACE_Configuration_Heap::open | ( | size_t | default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE | ) |
Opens a configuration that allocates memory from the heap.
default_map_size | Starting size for the internal hash tables that contain configuration information. |
0 | for success. |
-1 | for error, with errno set to indicate the cause. If open() is called multiple times, errno will be EBUSY . |
|
virtual |
Opens a named section in an existing section.
base | Existing section in which to open the named section. |
sub_section | Name of the section to open. |
create | If false, the named section must exist, otherwise the named section will be created if it does not exist. |
result | Reference; receives the section key for the new section. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
private |
sub_section may not contain path separators
|
private |
|
virtual |
Removes a named section.
key | Section key to remove the named section from. |
sub_section | Name of the section to remove. |
recursive | If true, any subkeys below sub_section are removed as well. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
virtual |
Removes the the value name from key. returns non zero on error.
Implements ACE_Configuration.
|
virtual |
Sets a binary-typed value.
key | Configuration section to set the value in. |
name | Name of the configuration value to set. If a value with the specified name exists, it is replaced. |
data | Pointer to the binary data for the value. |
length | Number of bytes for the new value. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
virtual |
Sets a integer-typed value.
key | Configuration section to set the value in. |
name | Name of the configuration value to set. If a value with the specified name exists, it is replaced. |
value | The integer to set the configuration value to. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
virtual |
Sets a string-typed value.
key | Configuration section to set the value in. |
name | Name of the configuration value to set. If a value with the specified name exists, it is replaced. |
value | The string to set the configuration value to. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
|
private |
|
private |
|
private |