3 //=============================================================================
5 * @file Configuration.h
7 * @author Chris Hafey <chafey@stentor.com>
9 * The ACE configuration API provides a portable abstraction for
10 * program configuration similar to the Microsoft Windows registry.
11 * The API supports a tree based hierarchy of configuration sections. Each
12 * section contains other sections or values. Values may contain string,
13 * unsigned integer and binary data.
15 * @note These classes are not thread safe, if multiple threads use these
16 * classes, you are responsible for serializing access.
18 * For examples of using this class, see:
19 * -# The test code in ACE_wrappers/test
20 * -# wxConfigViewer, a Windows like Registry Editor for ACE_Configuration
21 * -# TAO's IFR, it makes extensive use of ACE_Configuration
23 * @todo Templatize this class with an ACE_LOCK to provide thread safety
25 //=============================================================================
27 #ifndef ACE_CONFIGURATION_H
28 #define ACE_CONFIGURATION_H
29 #include /**/ "ace/pre.h"
31 #include "ace/SStringfwd.h"
32 #include "ace/Hash_Map_With_Allocator_T.h"
33 #include "ace/Malloc_T.h"
34 #include "ace/MMAP_Memory_Pool.h"
35 #include "ace/Local_Memory_Pool.h"
36 #include "ace/Synch_Traits.h"
39 #if !defined (ACE_LACKS_PRAGMA_ONCE)
41 #endif /* ACE_LACKS_PRAGMA_ONCE */
43 // configurable parameters
45 #if !defined (ACE_CONFIG_SECTION_INDEX)
46 # define ACE_CONFIG_SECTION_INDEX "Config_Section_Index"
47 #endif /* ! ACE_CONFIG_SECTION_INDEX */
49 #if !defined (ACE_DEFAULT_CONFIG_SECTION_SIZE)
50 #define ACE_DEFAULT_CONFIG_SECTION_SIZE 16
51 #endif /* ACE_DEFAULT_CONFIG_SECTION_SIZE */
53 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
56 * @class ACE_Section_Key_Internal
60 * @brief A base class for internal handles to section keys for
61 * configuration implementations
63 * Implementations subclass this base class to represent a
66 class ACE_Export ACE_Section_Key_Internal
69 /// Virtual destructor, make sure descendants are virtual!
70 virtual ~ACE_Section_Key_Internal () = default;
72 /// Increment reference count
73 virtual int add_ref ();
75 /// Decrement reference count. Will delete this if count gets to 0
76 virtual int dec_ref ();
78 ACE_Section_Key_Internal () = default;
79 ACE_Section_Key_Internal (const ACE_Section_Key_Internal
& rhs
);
80 ACE_Section_Key_Internal
& operator= (ACE_Section_Key_Internal
& rhs
);
86 * @class ACE_Configuration_Section_Key
88 * @brief Reference counted wrapper for ACE_Section_Key_Internal.
90 * Reference counted wrapper class for the abstract internal
91 * section key. A user gets one of these to represent a section
92 * in the configuration database.
94 class ACE_Export ACE_Configuration_Section_Key
96 friend class ACE_Configuration
;
98 /// Default constructor.
99 ACE_Configuration_Section_Key () = default;
101 /// Constructor that initializes to a pointer to a concrete internal key.
103 * @param key The section key to reference. Calls add_ref() with @a key.
105 explicit ACE_Configuration_Section_Key (ACE_Section_Key_Internal
*key
);
107 /// Copy constructor, increments the reference count on the key.
108 ACE_Configuration_Section_Key (const ACE_Configuration_Section_Key
&rhs
);
110 /// Destructor, decrements reference count on the referenced key.
111 ~ACE_Configuration_Section_Key ();
113 /// Assignment operator, increments reference count for this object
114 /// and decrements it on @a rhs.
115 ACE_Configuration_Section_Key
&operator= (const ACE_Configuration_Section_Key
&rhs
);
117 ACE_Section_Key_Internal
*key_
{};
121 * @class ACE_Configuration
125 * @brief Base class for configuration databases
127 * This class provides an interface for configuration databases. A concrete
128 * class is required that implements the interface.
130 * @sa ACE_Configuration_Heap
131 * @sa ACE_Configuration_Win32Registry
133 class ACE_Export ACE_Configuration
136 /// Enumeration for the various types of values we can store.
146 virtual ~ACE_Configuration () = default;
148 /// Obtain a reference to the root section of this configuration.
150 * @return Reference to the configuration's root section. Note that
151 * it is a const reference.
153 virtual const ACE_Configuration_Section_Key
& root_section () const;
156 * Opens a named section in an existing section.
158 * @param base Existing section in which to open the named section.
159 * @param sub_section Name of the section to open.
160 * @param create If false, the named section must exist, otherwise
161 * the named section will be created if it does not exist.
162 * @param result Reference; receives the section key for the new
165 * @retval 0 for success.
166 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
168 virtual int open_section (const ACE_Configuration_Section_Key
&base
,
169 const ACE_TCHAR
*sub_section
,
171 ACE_Configuration_Section_Key
& result
) = 0;
173 /// Removes a named section.
175 * @param key Section key to remove the named section from.
176 * @param sub_section Name of the section to remove.
177 * @param recursive If true, any subkeys below @a sub_section are
180 * @retval 0 for success.
181 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
183 virtual int remove_section (const ACE_Configuration_Section_Key
&key
,
184 const ACE_TCHAR
*sub_section
,
188 * Enumerates through the values in a section.
190 * @param key Section key to iterate through.
191 * @param index Iteration position. Must be zero on the first call to
192 * iterate through @a key. Increment @a index by one on each
193 * successive call to this method.
194 * @param name Receives the value's name.
195 * @param type Receives the value's data type.
197 * @note You may not delete or add values while enumerating. If the
198 * section is modified during enumeration, results are undefined;
199 * you must restart the enumeration from index 0.
201 * @retval 0 for success, @a name and @a type are valid.
202 * @retval 1 there are no more values in the section.
203 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
205 virtual int enumerate_values (const ACE_Configuration_Section_Key
& key
,
208 VALUETYPE
& type
) = 0;
211 * Enumerates through the subsections in a section.
213 * @param key Section key to iterate through.
214 * @param index Iteration position. Must be zero on the first call to
215 * iterate through @a key. Increment @a index by one on each
216 * successive call to this method.
217 * @param name Receives the subsection's name.
219 * @note You may not modify the @a key section while enumerating. If the
220 * section is modified during enumeration, results are undefined;
221 * you must restart the enumeration from index 0.
223 * @retval 0 for success, @a name has a valid name.
224 * @retval 1 there are no more subsections in the section.
225 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
227 virtual int enumerate_sections (const ACE_Configuration_Section_Key
& key
,
228 int index
, ACE_TString
& name
) = 0;
230 /// Sets a string-typed value.
232 * @param key Configuration section to set the value in.
233 * @param name Name of the configuration value to set. If a value with
234 * the specified name exists, it is replaced.
235 * @param value The string to set the configuration value to.
237 * @retval 0 for success.
238 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
240 virtual int set_string_value (const ACE_Configuration_Section_Key
& key
,
241 const ACE_TCHAR
* name
,
242 const ACE_TString
& value
) = 0;
244 /// Sets a integer-typed value.
246 * @param key Configuration section to set the value in.
247 * @param name Name of the configuration value to set. If a value with
248 * the specified name exists, it is replaced.
249 * @param value The integer to set the configuration value to.
251 * @retval 0 for success.
252 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
254 virtual int set_integer_value (const ACE_Configuration_Section_Key
& key
,
255 const ACE_TCHAR
* name
,
258 /// Sets a binary-typed value.
260 * @param key Configuration section to set the value in.
261 * @param name Name of the configuration value to set. If a value with
262 * the specified name exists, it is replaced.
263 * @param data Pointer to the binary data for the value.
264 * @param length Number of bytes for the new value.
266 * @retval 0 for success.
267 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
269 virtual int set_binary_value (const ACE_Configuration_Section_Key
& key
,
270 const ACE_TCHAR
* name
,
274 /// Gets a string-typed value.
276 * @param key Configuration section to get the value from.
277 * @param name Name of the configuration value to get.
278 * @param value Receives the configuration value if it exists and
281 * @retval 0 for success.
282 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
284 virtual int get_string_value (const ACE_Configuration_Section_Key
& key
,
285 const ACE_TCHAR
* name
,
286 ACE_TString
& value
) = 0;
288 /// Gets an integer-typed value.
290 * @param key Configuration section to get the value from.
291 * @param name Name of the configuration value to get.
292 * @param value Receives the configuration value if it exists and
295 * @retval 0 for success.
296 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
298 virtual int get_integer_value (const ACE_Configuration_Section_Key
& key
,
299 const ACE_TCHAR
* name
,
302 /// Gets a binary-typed value.
304 * @param key Configuration section to get the value from.
305 * @param name Name of the configuration value to get.
306 * @param data Receives a pointer to memory holding the binary data
307 * for the value. This method allocates the memory pointed
308 * to using operator new[]. The caller is responsible for
309 * freeing the memory using operator delete[].
310 * @param length Receives the number of bytes in the value.
312 * @retval 0 for success; caller is responsible for freeing the
314 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
316 virtual int get_binary_value (const ACE_Configuration_Section_Key
& key
,
317 const ACE_TCHAR
* name
,
322 * Retrieves the type of a named configuration value.
324 * @param key Configuration section to look up the name in.
325 * @param name Name of the configuration value to get the type of.
326 * @param type Receives the data type of the named value, if it exists.
328 * @retval 0 for success.
329 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
331 virtual int find_value(const ACE_Configuration_Section_Key
& key
,
332 const ACE_TCHAR
* name
,
333 VALUETYPE
& type
) = 0;
335 /// Removes a named value.
337 * @param key Configuration section to remove the named value from.
338 * @param name Name of the configuration value to remove.
340 * @retval 0 for success.
341 * @retval -1 for error; ACE_OS::last_error() retrieves error code.
343 virtual int remove_value (const ACE_Configuration_Section_Key
& key
,
344 const ACE_TCHAR
* name
) = 0;
347 * Expands @a path_in to @a key_out from @a key. If create is true,
348 * the subsections are created. Returns 0 on success, non zero on
349 * error The path consists of sections separated by the backslash
350 * '\' or forward slash '/'.
351 * Returns 0 on success, -1 if <create) is 0 and the path refers
352 * a nonexistant section
354 int expand_path (const ACE_Configuration_Section_Key
& key
,
355 const ACE_TString
& path_in
,
356 ACE_Configuration_Section_Key
& key_out
,
360 * Determine if the contents of this object is the same as the
361 * contents of the object on the right hand side.
362 * Returns true if they are equal and false if they are not equal
364 bool operator==(const ACE_Configuration
& rhs
) const;
367 * Determine if the contents of this object are different from the
368 * contents of the object on the right hand side.
369 * Returns false if they are equal and true if they are not equal
371 bool operator!=(const ACE_Configuration
& rhs
) const;
374 * * Represents the "NULL" string to simplify the internal logic.
376 static ACE_TCHAR NULL_String_
;
380 ACE_Configuration ();
382 /// Resolves the internal key from a section key
383 ACE_Section_Key_Internal
* get_internal_key
384 (const ACE_Configuration_Section_Key
& key
);
387 * Tests to see if @a name is valid. @a name must be < 255 characters
388 * and not contain the path separator '\', brackets [] or = (maybe
389 * just restrict to alphanumeric?) returns non zero if name is not
390 * valid. The path separator is allowed, except for the first character,
391 * if @a allow_path is true.
393 int validate_name (const ACE_TCHAR
* name
, int allow_path
= 0);
396 * Test to see if @a name is valid. The default value for a key can be
397 * unnamed, which means either @a name is == 0 or @a name == '\0` is
398 * valid. Otherwise, it calls validate_name() to test @a name for the
399 * same rules that apply to keys.
401 int validate_value_name (const ACE_TCHAR
* name
);
404 ACE_Configuration (const ACE_Configuration
& rhs
);
405 ACE_Configuration
& operator= (const ACE_Configuration
& rhs
);
407 ACE_Configuration_Section_Key root_
;
410 #if defined (ACE_WIN32)
413 * @class ACE_Section_Key_Win32
415 * @brief The Win32 registry implementation of an internal section key.
417 * Holds the HKEY for a section (registry key).
419 class ACE_Export ACE_Section_Key_Win32
: public ACE_Section_Key_Internal
422 /// Constructor based on an HKEY
423 ACE_Section_Key_Win32 (HKEY hKey
);
428 /// Destructor - invokes <RegCloseKey>
429 virtual ~ACE_Section_Key_Win32 ();
432 ACE_Section_Key_Win32 (const ACE_Section_Key_Win32
& rhs
);
433 ACE_Section_Key_Win32
& operator= (const ACE_Section_Key_Win32
& rhs
);
437 * @class ACE_Configuration_Win32Registry
439 * @brief The win32 registry implementation of a configuration database
441 * The win32 implementation basically makes calls through to the
442 * registry functions. The API is very similar so very little
445 class ACE_Export ACE_Configuration_Win32Registry
: public ACE_Configuration
449 * Constructor for registry configuration database. hKey is the
450 * base registry key to attach to. This class takes ownership of
451 * hKey, it will invoke <RegCloseKey> on it upon destruction.
453 explicit ACE_Configuration_Win32Registry (HKEY hKey
,
454 u_long security_access
= KEY_ALL_ACCESS
);
457 virtual ~ACE_Configuration_Win32Registry ();
459 virtual int open_section (const ACE_Configuration_Section_Key
& base
,
460 const ACE_TCHAR
* sub_section
,
462 ACE_Configuration_Section_Key
& result
);
464 virtual int remove_section (const ACE_Configuration_Section_Key
& key
,
465 const ACE_TCHAR
* sub_section
,
468 virtual int enumerate_values (const ACE_Configuration_Section_Key
& key
,
473 virtual int enumerate_sections (const ACE_Configuration_Section_Key
& key
,
477 virtual int set_string_value (const ACE_Configuration_Section_Key
& key
,
478 const ACE_TCHAR
* name
,
479 const ACE_TString
& value
);
481 virtual int set_integer_value (const ACE_Configuration_Section_Key
& key
,
482 const ACE_TCHAR
* name
,
485 virtual int set_binary_value (const ACE_Configuration_Section_Key
& key
,
486 const ACE_TCHAR
* name
,
490 virtual int get_string_value (const ACE_Configuration_Section_Key
& key
,
491 const ACE_TCHAR
* name
,
494 virtual int get_integer_value (const ACE_Configuration_Section_Key
& key
,
495 const ACE_TCHAR
* name
,
498 virtual int get_binary_value (const ACE_Configuration_Section_Key
& key
,
499 const ACE_TCHAR
* name
,
503 virtual int find_value(const ACE_Configuration_Section_Key
& key
,
504 const ACE_TCHAR
* name
,
507 /// Removes the the value @a name from @a key. returns non zero on error
508 virtual int remove_value (const ACE_Configuration_Section_Key
& key
,
509 const ACE_TCHAR
* name
);
512 * This method traverses <path> through <hKey>. It is useful when
513 * you want the HKEY for a specific registry key, especially when
514 * initializing this implementation. Caller is responsible for
515 * closeing this key when it is no longer used. If create is 1
516 * (default) the keys are create if they don't already exist.
519 static HKEY
resolve_key (HKEY hKey
,
520 const ACE_TCHAR
* path
,
522 u_long security_access
= KEY_ALL_ACCESS
);
523 virtual bool operator== (const ACE_Configuration_Win32Registry
&rhs
) const;
524 virtual bool operator!= (const ACE_Configuration_Win32Registry
&rhs
) const;
527 /// Gets the HKEY for a configuration section
528 int load_key (const ACE_Configuration_Section_Key
& key
, HKEY
& hKey
);
531 ACE_Configuration_Win32Registry ();
532 ACE_Configuration_Win32Registry (const ACE_Configuration_Win32Registry
& rhs
);
533 ACE_Configuration_Win32Registry
& operator= (const ACE_Configuration_Win32Registry
& rhs
);
535 const u_long security_access_
;
537 #endif /* ACE_WIN32 */
539 // ACE_Allocator version
541 typedef ACE_Allocator_Adapter
<ACE_Malloc
<ACE_MMAP_MEMORY_POOL
,
543 PERSISTENT_ALLOCATOR
;
544 typedef ACE_Allocator_Adapter
<ACE_Malloc
<ACE_LOCAL_MEMORY_POOL
,
549 * @class ACE_Configuration_ExtId
551 * @brief External ID for the section and value hash
553 * Contains a pointer to the section or value name.
555 class ACE_Export ACE_Configuration_ExtId
559 ACE_Configuration_ExtId () = default;
561 /// Named constructor
562 explicit ACE_Configuration_ExtId (const ACE_TCHAR
* name
);
565 ACE_Configuration_ExtId (const ACE_Configuration_ExtId
& rhs
);
568 ~ACE_Configuration_ExtId () = default;
570 /// Assignment operator
571 ACE_Configuration_ExtId
& operator= (const ACE_Configuration_ExtId
& rhs
);
573 /// Equality comparison operator (must match name_).
574 bool operator== (const ACE_Configuration_ExtId
&rhs
) const;
576 /// Inequality comparison operator.
577 bool operator!= (const ACE_Configuration_ExtId
&rhs
) const;
579 /// Frees the name of the value. needed since we don't know the
580 /// allocator name_ was created in
581 void free (ACE_Allocator
*alloc
);
583 /// hash function is required in order for this class to be usable by
584 /// ACE_Hash_Map_Manager.
585 u_long
hash () const;
588 const ACE_TCHAR
* name_
{};
591 const ACE_TCHAR
*name ();
594 typedef ACE_Hash_Map_With_Allocator
<ACE_Configuration_ExtId
, int>
596 typedef ACE_Hash_Map_Manager_Ex
<ACE_Configuration_ExtId
,
598 ACE_Hash
<ACE_Configuration_ExtId
>,
599 ACE_Equal_To
<ACE_Configuration_ExtId
>,
604 * @class ACE_Configuration_Value_IntId
606 * @brief The section hash table internal value class
608 * This class is present as the internal portion of a section's
609 * value hash table It may store string, integer or binary data.
611 class ACE_Export ACE_Configuration_Value_IntId
614 /// Default constructor
615 ACE_Configuration_Value_IntId ();
617 /// String constructor, takes ownership of string
618 explicit ACE_Configuration_Value_IntId (ACE_TCHAR
* string
);
620 /// Integer constructor
621 explicit ACE_Configuration_Value_IntId (u_int integer
);
623 /// Binary constructor, takes ownership of data
624 ACE_Configuration_Value_IntId (void* data
, size_t length
);
627 ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId
& rhs
);
630 ~ACE_Configuration_Value_IntId ();
632 /// Assignment operator
633 ACE_Configuration_Value_IntId
& operator= (
634 const ACE_Configuration_Value_IntId
& rhs
);
636 void free (ACE_Allocator
*alloc
);
641 * Points to the string value or binary data or IS the integer
642 * Length is only used when type_ == BINARY
644 ACE_Configuration::VALUETYPE type_
;
652 typedef ACE_Hash_Map_With_Allocator
<ACE_Configuration_ExtId
,
653 ACE_Configuration_Value_IntId
>
655 typedef ACE_Hash_Map_Manager_Ex
<ACE_Configuration_ExtId
,
656 ACE_Configuration_Value_IntId
,
657 ACE_Hash
<ACE_Configuration_ExtId
>,
658 ACE_Equal_To
<ACE_Configuration_ExtId
>,
662 // Deprecated typedef. Use the VALUE_HASH::ENTRY trait instead.
663 typedef VALUE_HASH::ENTRY VALUE_ENTRY
;
666 * @class ACE_Configuration_Section_IntId
668 * @brief The internal ID for a section hash table
670 * Contains a hash table containing value name/values
672 class ACE_Export ACE_Configuration_Section_IntId
676 ACE_Configuration_Section_IntId ();
679 ACE_Configuration_Section_IntId (VALUE_MAP
* value_hash_map
,
680 SUBSECTION_MAP
* section_hash_map
);
683 ACE_Configuration_Section_IntId (const ACE_Configuration_Section_IntId
& rhs
);
686 ~ACE_Configuration_Section_IntId ();
688 /// Assignment operator
689 ACE_Configuration_Section_IntId
& operator= (
690 const ACE_Configuration_Section_IntId
& rhs
);
692 /// Frees the hash table and all its values
693 void free (ACE_Allocator
*alloc
);
696 VALUE_MAP
* value_hash_map_
;
698 SUBSECTION_MAP
* section_hash_map_
;
701 typedef ACE_Hash_Map_With_Allocator
<ACE_Configuration_ExtId
,
702 ACE_Configuration_Section_IntId
>
704 typedef ACE_Hash_Map_Manager_Ex
<ACE_Configuration_ExtId
,
705 ACE_Configuration_Section_IntId
,
706 ACE_Hash
<ACE_Configuration_ExtId
>,
707 ACE_Equal_To
<ACE_Configuration_ExtId
>,
711 // Deprecated typedef. Use the SECTION_HASH::ENTRY trait instead.
712 typedef SECTION_HASH::ENTRY SECTION_ENTRY
;
715 * @class ACE_Configuration_Section_Key_Heap
717 * @brief Internal section key class for heap based configuration
720 * Contains a value iterator and full path name of section.
722 class ACE_Export ACE_Configuration_Section_Key_Heap
723 : public ACE_Section_Key_Internal
726 /// Constructor based on the full path of the section
727 ACE_Configuration_Section_Key_Heap (const ACE_TCHAR
* path
);
732 /// The value iterator
733 VALUE_HASH::ITERATOR
* value_iter_
;
735 /// The sub section iterator
736 SUBSECTION_HASH::ITERATOR
* section_iter_
;
738 ACE_ALLOC_HOOK_DECLARE
;
741 /// Destructor - will delete the iterators
742 virtual ~ACE_Configuration_Section_Key_Heap ();
745 ACE_Configuration_Section_Key_Heap (const ACE_Configuration_Section_Key_Heap
& rhs
);
746 ACE_Configuration_Section_Key_Heap
& operator= (const ACE_Configuration_Section_Key_Heap
& rhs
);
750 * @class ACE_Configuration_Heap
752 * @brief The concrete implementation of a allocator based
753 * configuration database
755 * This class uses ACE's Allocators to manage a memory
756 * representation of a configuration database. A persistent heap
757 * may be used to store configurations persistently
759 * @note Before using this class you must call one of the open methods.
762 * - Need to investigate what happens if memory mapped file gets mapped to
763 * a location different than it was created with.
765 class ACE_Export ACE_Configuration_Heap
: public ACE_Configuration
769 ACE_Configuration_Heap ();
772 virtual ~ACE_Configuration_Heap ();
775 * Opens a configuration that allocates its memory from a memory-mapped file.
776 * This makes it possible to persist a configuration to permanent storage.
777 * This is not the same as exporting the configuration to a file; the
778 * memory-mapped file is not likely to be very readable by humans.
780 * @param file_name Name of the file to map into memory.
782 * @param base_address Address to map the base of @a file_name to.
784 * @param default_map_size Starting size for the internal hash tables that
785 * contain configuration information.
787 * @retval 0 for success.
788 * @retval -1 for error, with errno set to indicate the cause. If open()
789 * is called multiple times, errno will be @c EBUSY.
791 int open (const ACE_TCHAR
* file_name
,
792 void* base_address
= ACE_DEFAULT_BASE_ADDR
,
793 size_t default_map_size
= ACE_DEFAULT_CONFIG_SECTION_SIZE
);
796 * Opens a configuration that allocates memory from the heap.
798 * @param default_map_size Starting size for the internal hash tables that
799 * contain configuration information.
801 * @retval 0 for success.
802 * @retval -1 for error, with errno set to indicate the cause. If open()
803 * is called multiple times, errno will be @c EBUSY.
805 int open (size_t default_map_size
= ACE_DEFAULT_CONFIG_SECTION_SIZE
);
807 virtual int open_section (const ACE_Configuration_Section_Key
& base
,
808 const ACE_TCHAR
* sub_section
,
809 bool create
, ACE_Configuration_Section_Key
& result
);
811 virtual int remove_section (const ACE_Configuration_Section_Key
& key
,
812 const ACE_TCHAR
* sub_section
,
815 virtual int enumerate_values (const ACE_Configuration_Section_Key
& key
,
820 virtual int enumerate_sections (const ACE_Configuration_Section_Key
& key
,
824 virtual int set_string_value (const ACE_Configuration_Section_Key
& key
,
825 const ACE_TCHAR
* name
,
826 const ACE_TString
& value
);
828 virtual int set_integer_value (const ACE_Configuration_Section_Key
& key
,
829 const ACE_TCHAR
* name
,
832 virtual int set_binary_value (const ACE_Configuration_Section_Key
& key
,
833 const ACE_TCHAR
* name
,
837 virtual int get_string_value (const ACE_Configuration_Section_Key
& key
,
838 const ACE_TCHAR
* name
,
841 virtual int get_integer_value (const ACE_Configuration_Section_Key
& key
,
842 const ACE_TCHAR
* name
,
845 virtual int get_binary_value (const ACE_Configuration_Section_Key
& key
,
846 const ACE_TCHAR
* name
,
850 virtual int find_value(const ACE_Configuration_Section_Key
& key
,
851 const ACE_TCHAR
* name
,
854 /// Removes the the value @a name from @a key. returns non zero on error
855 virtual int remove_value (const ACE_Configuration_Section_Key
& key
,
856 const ACE_TCHAR
* name
);
859 /// @a sub_section may not contain path separators
860 int open_simple_section (const ACE_Configuration_Section_Key
&base
,
861 const ACE_TCHAR
*sub_section
,
862 bool create
, ACE_Configuration_Section_Key
&result
);
863 /// Adds a new section
864 int add_section (const ACE_Configuration_Section_Key
&base
,
865 const ACE_TCHAR
*sub_section
,
866 ACE_Configuration_Section_Key
&result
);
868 /// Helper for the <open> method.
871 /// Helper for create_index() method: places hash table into an
873 int create_index_helper (void *buffer
);
875 int value_open_helper (size_t hash_table_size
, void *buffer
);
877 int section_open_helper (size_t hash_table_size
, void *buffer
);
879 int load_key (const ACE_Configuration_Section_Key
& key
, ACE_TString
& name
);
881 int new_section (const ACE_TString
& section
,
882 ACE_Configuration_Section_Key
& result
);
884 ACE_Configuration_Heap (const ACE_Configuration_Heap
& rhs
);
885 ACE_Configuration_Heap
& operator= (const ACE_Configuration_Heap
& rhs
);
887 ACE_Allocator
*allocator_
;
889 size_t default_map_size_
;
892 ACE_END_VERSIONED_NAMESPACE_DECL
894 #if defined (__ACE_INLINE__)
895 #include "ace/Configuration.inl"
896 #endif /* __ACE_INLINE__ */
898 #include /**/ "ace/post.h"
899 #endif /* ACE_CONFIGURATION_H */