3 //==========================================================================
7 * @author Prashant Jain <pjain@cse.wustl.edu>
9 //==========================================================================
11 #ifndef ACE_NAME_SPACE_H
12 #define ACE_NAME_SPACE_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/ACE_export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/SString.h"
23 #include "ace/Unbounded_Set.h"
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 typedef ACE_Unbounded_Set
<ACE_NS_WString
> ACE_WSTRING_SET
;
30 * @class ACE_Name_Binding
32 * @brief Maintains a mapping from name to value and type.
34 class ACE_Export ACE_Name_Binding
37 /// Main constructor that initializes all the fields.
38 ACE_Name_Binding (const ACE_NS_WString
&n
,
39 const ACE_NS_WString
&v
,
42 /// Default constructor.
46 ACE_Name_Binding (const ACE_Name_Binding
&);
48 /// Assignment operator.
49 const ACE_Name_Binding
& operator= (const ACE_Name_Binding
&);
54 /// Test for equality.
55 bool operator == (const ACE_Name_Binding
&s
) const;
57 /// Name of the binding.
60 /// Value of the binding.
61 ACE_NS_WString value_
;
63 /// Type of the binding.
67 typedef ACE_Unbounded_Set
<ACE_Name_Binding
> ACE_BINDING_SET
;
68 typedef ACE_Unbounded_Set_Iterator
<ACE_Name_Binding
> ACE_BINDING_ITERATOR
;
70 typedef ACE_Unbounded_Set
<ACE_NS_WString
> ACE_PWSTRING_SET
;
71 typedef ACE_Unbounded_Set_Iterator
<ACE_NS_WString
> ACE_PWSTRING_ITERATOR
;
74 * @class ACE_Name_Space
76 * @brief Abstract base class that provides an abstract interface to
77 * the database without exposing any implementation details.
79 * Manages a Naming Service Name Space. Provides the basic
80 * methods -- bind, unbind, rebind, find, and listnames.
82 class ACE_Export ACE_Name_Space
85 /// virtual destructor to ensure destructors of subclasses get
87 virtual ~ACE_Name_Space ();
89 /// Bind a new name to a naming context (Wide character strings).
90 virtual int bind (const ACE_NS_WString
&name_in
,
91 const ACE_NS_WString
&value_in
,
92 const char *type_in
= "") = 0;
96 * Overwrite the value or type of an existing name in a
97 * ACE_Name_Space or bind a new name to the context, if it didn't
98 * exist yet. (Wide character strings interface).
100 virtual int rebind (const ACE_NS_WString
&name_in
,
101 const ACE_NS_WString
&value_in
,
102 const char *type_in
= "") = 0;
104 /// Delete a name from a ACE_Name_Space (Wide character strings
106 virtual int unbind (const ACE_NS_WString
&name_in
) = 0;
108 /// Get value and type of a given name binding (Wide chars). The
109 /// caller is responsible for deleting both <value_out> and <type_out>!
110 virtual int resolve (const ACE_NS_WString
&name_in
,
111 ACE_NS_WString
&value_out
,
112 char *&type_out
) = 0;
114 /// Get a set of names matching a specified pattern (wchars). Matching
115 /// means the names must begin with the pattern string.
116 virtual int list_names (ACE_WSTRING_SET
&set_out
,
117 const ACE_NS_WString
&pattern_in
) = 0;
119 /// Get a set of values matching a specified pattern (wchars). Matching
120 /// means the values must begin with the pattern string.
121 virtual int list_values (ACE_WSTRING_SET
&set_out
,
122 const ACE_NS_WString
&pattern_in
) = 0;
124 /// Get a set of types matching a specified pattern (wchars). Matching
125 /// means the types must begin with the pattern string.
126 virtual int list_types (ACE_WSTRING_SET
&set_out
,
127 const ACE_NS_WString
&pattern_in
) = 0;
130 * Get a set of names matching a specified pattern (wchars). Matching
131 * means the names must begin with the pattern string. Returns the
132 * complete binding associated each pattern match.
134 virtual int list_name_entries (ACE_BINDING_SET
&set
,
135 const ACE_NS_WString
&pattern
) = 0;
138 * Get a set of values matching a specified pattern (wchars). Matching
139 * means the values must begin with the pattern string. Returns the
140 * complete binding associated each pattern match.
142 virtual int list_value_entries (ACE_BINDING_SET
&set
,
143 const ACE_NS_WString
&pattern
) = 0;
146 * Get a set of types matching a specified pattern (wchars). Matching
147 * means the types must begin with the pattern string. Returns the
148 * complete binding associated each pattern match.
150 virtual int list_type_entries (ACE_BINDING_SET
&set
,
151 const ACE_NS_WString
&pattern
) = 0;
153 /// Dump the state of the object
154 virtual void dump () const = 0;
157 ACE_END_VERSIONED_NAMESPACE_DECL
159 #include /**/ "ace/post.h"
161 #endif /* ACE_NAME_SPACE_H */