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.
43 ACE_Name_Binding (void);
46 ACE_Name_Binding (const ACE_Name_Binding
&);
48 /// Assignment operator.
49 const ACE_Name_Binding
& operator= (const ACE_Name_Binding
&);
52 ~ACE_Name_Binding (void);
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
86 /// virtual destructor to ensure destructors of subclasses get
88 virtual ~ACE_Name_Space (void);
90 /// Bind a new name to a naming context (Wide character strings).
91 virtual int bind (const ACE_NS_WString
&name_in
,
92 const ACE_NS_WString
&value_in
,
93 const char *type_in
= "") = 0;
97 * Overwrite the value or type of an existing name in a
98 * ACE_Name_Space or bind a new name to the context, if it didn't
99 * exist yet. (Wide character strings interface).
101 virtual int rebind (const ACE_NS_WString
&name_in
,
102 const ACE_NS_WString
&value_in
,
103 const char *type_in
= "") = 0;
105 /// Delete a name from a ACE_Name_Space (Wide character strings
107 virtual int unbind (const ACE_NS_WString
&name_in
) = 0;
109 /// Get value and type of a given name binding (Wide chars). The
110 /// caller is responsible for deleting both <value_out> and <type_out>!
111 virtual int resolve (const ACE_NS_WString
&name_in
,
112 ACE_NS_WString
&value_out
,
113 char *&type_out
) = 0;
115 /// Get a set of names matching a specified pattern (wchars). Matching
116 /// means the names must begin with the pattern string.
117 virtual int list_names (ACE_WSTRING_SET
&set_out
,
118 const ACE_NS_WString
&pattern_in
) = 0;
120 /// Get a set of values matching a specified pattern (wchars). Matching
121 /// means the values must begin with the pattern string.
122 virtual int list_values (ACE_WSTRING_SET
&set_out
,
123 const ACE_NS_WString
&pattern_in
) = 0;
125 /// Get a set of types matching a specified pattern (wchars). Matching
126 /// means the types must begin with the pattern string.
127 virtual int list_types (ACE_WSTRING_SET
&set_out
,
128 const ACE_NS_WString
&pattern_in
) = 0;
131 * Get a set of names matching a specified pattern (wchars). Matching
132 * means the names must begin with the pattern string. Returns the
133 * complete binding associated each pattern match.
135 virtual int list_name_entries (ACE_BINDING_SET
&set
,
136 const ACE_NS_WString
&pattern
) = 0;
139 * Get a set of values matching a specified pattern (wchars). Matching
140 * means the values must begin with the pattern string. Returns the
141 * complete binding associated each pattern match.
143 virtual int list_value_entries (ACE_BINDING_SET
&set
,
144 const ACE_NS_WString
&pattern
) = 0;
147 * Get a set of types matching a specified pattern (wchars). Matching
148 * means the types must begin with the pattern string. Returns the
149 * complete binding associated each pattern match.
151 virtual int list_type_entries (ACE_BINDING_SET
&set
,
152 const ACE_NS_WString
&pattern
) = 0;
154 /// Dump the state of the object
155 virtual void dump (void) const = 0;
158 ACE_END_VERSIONED_NAMESPACE_DECL
160 #include /**/ "ace/post.h"
162 #endif /* ACE_NAME_SPACE_H */