00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Registry_Name_Space.h 00006 * 00007 * Registry_Name_Space.h,v 4.18 2005/10/28 16:14:55 ossama Exp 00008 * 00009 * @author Irfan Pyarali (irfan@cs.wustl.edu) 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef ACE_REGISTRY_NAME_SPACE_H 00015 #define ACE_REGISTRY_NAME_SPACE_H 00016 #include /**/ "ace/pre.h" 00017 00018 #include "ace/config-all.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #if (defined (ACE_WIN32) && defined (UNICODE)) 00025 // This only works on Win32 platforms when UNICODE is turned on 00026 00027 #include "ace/Registry.h" 00028 #include "ace/Naming_Context.h" 00029 #include "ace/Name_Space.h" 00030 00031 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00032 00033 /** 00034 * @class ACE_Registry_Name_Space 00035 * 00036 * @brief Interface to a Name Server Database which is maintained by 00037 * the Win32 Registry. Allows to add, change, remove and 00038 * resolve NameBindings. 00039 * 00040 * Manages a Naming Service for a registry name space which 00041 * includes bindings for all contexts. All strings are stored in 00042 * wide character format. A Name Binding consists of a name 00043 * (that's the key), a value string. There is no type string 00044 * support in this Name Space. 00045 */ 00046 class ACE_Export ACE_Registry_Name_Space : public ACE_Name_Space 00047 { 00048 public: 00049 00050 /// Constructor 00051 ACE_Registry_Name_Space (void); 00052 00053 /// Contacts and opens the registry on the specified server 00054 ACE_Registry_Name_Space (ACE_Name_Options *name_options); 00055 00056 /// Destructor 00057 ~ACE_Registry_Name_Space (void); 00058 00059 /// Contacts and opens the registry on the specified server 00060 int open (ACE_Name_Options *name_options); 00061 00062 /// Bind a new name to a naming context (Wide character strings). 00063 int bind (const ACE_NS_WString &name_in, 00064 const ACE_NS_WString &value_in, 00065 const char *type_in = ""); 00066 00067 /** 00068 * Overwrite the value or type of an existing name in a 00069 * ACE_Name_Space or bind a new name to the context, if it didn't 00070 * exist yet. (Wide charcter strings interface). 00071 */ 00072 int rebind (const ACE_NS_WString &name_in, 00073 const ACE_NS_WString &value_in, 00074 const char *type_in = ""); 00075 00076 /// Delete a name from a ACE_Name_Space (Wide charcter strings 00077 /// Interface). 00078 int unbind (const ACE_NS_WString &name_in); 00079 00080 /// Get value and type of a given name binding (Wide chars). The 00081 /// caller is responsible for deleting both <value_out> and <type_out>! 00082 int resolve (const ACE_NS_WString &name_in, 00083 ACE_NS_WString &value_out, 00084 char *&type_out); 00085 00086 /// Get a set of names matching a specified pattern (wchars). Matching 00087 /// means the names must begin with the pattern string. 00088 int list_names (ACE_WSTRING_SET &set_out, 00089 const ACE_NS_WString &pattern_in); 00090 00091 /// Get a set of values matching a specified pattern (wchars). Matching 00092 /// means the values must begin with the pattern string. 00093 int list_values (ACE_WSTRING_SET &set_out, 00094 const ACE_NS_WString &pattern_in); 00095 00096 /// Get a set of types matching a specified pattern (wchars). Matching 00097 /// means the types must begin with the pattern string. 00098 int list_types (ACE_WSTRING_SET &set_out, 00099 const ACE_NS_WString &pattern_in); 00100 00101 /** 00102 * Get a set of names matching a specified pattern (wchars). Matching 00103 * means the names must begin with the pattern string. Returns the 00104 * complete binding associated each pattern match. 00105 */ 00106 int list_name_entries (ACE_BINDING_SET &set, 00107 const ACE_NS_WString &pattern); 00108 00109 /** 00110 * Get a set of values matching a specified pattern (wchars). Matching 00111 * means the values must begin with the pattern string. Returns the 00112 * complete binding associated each pattern match. 00113 */ 00114 int list_value_entries (ACE_BINDING_SET &set, 00115 const ACE_NS_WString &pattern); 00116 00117 /** 00118 * Get a set of types matching a specified pattern (wchars). Matching 00119 * means the types must begin with the pattern string. Returns the 00120 * complete binding associated each pattern match. 00121 */ 00122 int list_type_entries (ACE_BINDING_SET &set, 00123 const ACE_NS_WString &pattern); 00124 00125 /// Dump the state of the object 00126 void dump (void) const; 00127 00128 private: 00129 00130 /// current context 00131 ACE_Registry::Naming_Context context_; 00132 }; 00133 00134 ACE_END_VERSIONED_NAMESPACE_DECL 00135 00136 #endif /* ACE_WIN32 && UNICODE */ 00137 00138 #include /**/ "ace/post.h" 00139 00140 #endif /* ACE_REGISTRY_NAME_SPACE_H */