diff options
Diffstat (limited to 'ace/Naming_Context.h')
-rw-r--r-- | ace/Naming_Context.h | 283 |
1 files changed, 156 insertions, 127 deletions
diff --git a/ace/Naming_Context.h b/ace/Naming_Context.h index 3ad1d4dbc5a..c50a8da49c0 100644 --- a/ace/Naming_Context.h +++ b/ace/Naming_Context.h @@ -1,18 +1,17 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE -// -// = FILENAME -// Naming_Context.h -// -// = AUTHOR -// Gerhard Lenzer, Douglas C. Schmidt, and Prashant Jain -// -// ============================================================================ + +//============================================================================= +/** + * @file Naming_Context.h + * + * $Id$ + * + * @author Gerhard Lenzer + * @author Douglas C. Schmidt + * @author and Prashant Jain + */ +//============================================================================= + #ifndef ACE_NAMING_CONTEXT_H #define ACE_NAMING_CONTEXT_H @@ -33,231 +32,261 @@ // Forward decl class ACE_Name_Options; +/** + * @class ACE_Naming_Context + * + * @brief Maintaining accesses Name Server Databases. Allows to add + * NameBindings, change them, remove them and resolve + * NameBindings + * + * Manages a Naming Service . That represents a persistent + * string to string mapping for different scopes. The scope of a + * ACE_Naming_Context may be either local for the calling + * process (Note : A process is hereby not identified by it's + * pid, but by it's argv[0]. So different processes (in UNIX + * syntax) may access the same NameBindings), global for all + * processes running on one host or global for all processes on + * the net (that know the address of the net name server + * socket). Strings may be plain character strings or Wide + * character strings. A Name Binding consists of a name string + * (that's the key), a value string and an optional type string + * (no wide chars). + */ class ACE_Export ACE_Naming_Context : public ACE_Service_Object { - // = TITLE - // Maintaining accesses Name Server Databases. Allows to add - // NameBindings, change them, remove them and resolve - // NameBindings - // - // = DESCRIPTION - // Manages a Naming Service . That represents a persistent - // string to string mapping for different scopes. The scope of a - // ACE_Naming_Context may be either local for the calling - // process (Note : A process is hereby not identified by it's - // pid, but by it's argv[0]. So different processes (in UNIX - // syntax) may access the same NameBindings), global for all - // processes running on one host or global for all processes on - // the net (that know the address of the net name server - // socket). Strings may be plain character strings or Wide - // character strings. A Name Binding consists of a name string - // (that's the key), a value string and an optional type string - // (no wide chars). public: enum Context_Scope_Type { - PROC_LOCAL, // Name lookup is local to the process. - NODE_LOCAL, // Name lookup is local to the node (host). - NET_LOCAL // Name lookup is local to the (sub)network. + /// Name lookup is local to the process. + PROC_LOCAL, + /// Name lookup is local to the node (host). + NODE_LOCAL, + /// Name lookup is local to the (sub)network. + NET_LOCAL }; // = Initialization and termination methods. + /// "Do-nothing" constructor. ACE_Naming_Context (void); - // "Do-nothing" constructor. + /** + * Specifies the scope of this namespace, opens and memory-maps the + * associated file (if accessible) or contacts the dedicated name + * server process for NET_LOCAL namespace. Note that <light> + * specifies whether or not we want to use + * ACE_Lite_MMap_Memory_Pool. By default we use ACE_MMap_Memory_Pool. + */ ACE_Naming_Context (Context_Scope_Type scope_in, int light = 0); - // Specifies the scope of this namespace, opens and memory-maps the - // associated file (if accessible) or contacts the dedicated name - // server process for NET_LOCAL namespace. Note that <light> - // specifies whether or not we want to use - // ACE_Lite_MMap_Memory_Pool. By default we use ACE_MMap_Memory_Pool. + /** + * Specifies the scope of this namespace, opens and memory-maps the + * associated file (if accessible) or contacts the dedicated name + * server process for NET_LOCAL namespace. Note that <light> + * specifies whether or not we want to use + * ACE_Lite_MMap_Memory_Pool. By default we use ACE_MMap_Memory_Pool. + */ int open (Context_Scope_Type scope_in = ACE_Naming_Context::PROC_LOCAL, int light = 0); - // Specifies the scope of this namespace, opens and memory-maps the - // associated file (if accessible) or contacts the dedicated name - // server process for NET_LOCAL namespace. Note that <light> - // specifies whether or not we want to use - // ACE_Lite_MMap_Memory_Pool. By default we use ACE_MMap_Memory_Pool. + /// Deletes the instance of Name Space. Must be called before + /// switching name spaces. int close (void); - // Deletes the instance of Name Space. Must be called before - // switching name spaces. + /// Release all resources. Gets called by destructor and fini. int close_down (void); - // Release all resources. Gets called by destructor and fini. + /// destructor, do some cleanup :TBD: last dtor should "compress" + /// file ~ACE_Naming_Context (void); - // destructor, do some cleanup :TBD: last dtor should "compress" - // file // = Dynamic initialization hooks. + /// Initialize name options and naming context when dynamically + /// linked. virtual int init (int argc, ACE_TCHAR *argv[]); - // Initialize name options and naming context when dynamically - // linked. + /// Close down the test when dynamically unlinked. virtual int fini (void); - // Close down the test when dynamically unlinked. + /// Returns information about this context. virtual int info (char **strp, size_t length) const; - // Returns information about this context. + /// Returns the ACE_Name_Options associated with the Naming_Context ACE_Name_Options *name_options (void); - // Returns the ACE_Name_Options associated with the Naming_Context + /// Bind a new name to a naming context (Wide character strings). int bind (const ACE_WString &name_in, const ACE_WString &value_in, const char *type_in = ""); - // Bind a new name to a naming context (Wide character strings). + /// Bind a new name to a naming context ( character strings). int bind (const char *name_in, const char *value_in, const char *type_in = ""); - // Bind a new name to a naming context ( character strings). + /** + * Overwrite the value or type of an existing name in a + * ACE_Naming_Context or bind a new name to the context, if it + * didn't exist yet. (Wide charcter strings interface). + */ int rebind (const ACE_WString &name_in, const ACE_WString &value_in, const char *type_in = ""); - // Overwrite the value or type of an existing name in a - // ACE_Naming_Context or bind a new name to the context, if it - // didn't exist yet. (Wide charcter strings interface). + /** + * Overwrite the value or type of an existing name in a + * ACE_Naming_Context or bind a new name to the context, if it + * didn't exist yet. ( charcter strings interface) + */ int rebind (const char *name_in, const char *value_in, const char *type_in = ""); - // Overwrite the value or type of an existing name in a - // ACE_Naming_Context or bind a new name to the context, if it - // didn't exist yet. ( charcter strings interface) + /// Delete a name from a ACE_Naming_Context (Wide charcter strings + /// Interface). int unbind (const ACE_WString &name_in); - // Delete a name from a ACE_Naming_Context (Wide charcter strings - // Interface). + /// Delete a name from a ACE_Naming_Context (character strings + /// interface). int unbind (const char *name_in); - // Delete a name from a ACE_Naming_Context (character strings - // interface). + /// Get value and type of a given name binding (Wide chars). The + /// caller is responsible for deleting both <value_out> and <type_out>! int resolve (const ACE_WString &name_in, ACE_WString &value_out, char *&type_out); - // Get value and type of a given name binding (Wide chars). The - // caller is responsible for deleting both <value_out> and <type_out>! + /** + * Get value and type of a given name binding (Wide chars output). + * The caller is responsible for deleting both <value_out> and + * <type_out>! + */ int resolve (const char *name_in, ACE_WString &value_out, char *&type_out); - // Get value and type of a given name binding (Wide chars output). - // The caller is responsible for deleting both <value_out> and - // <type_out>! + /// Get value and type of a given name binding ( chars ). The caller + /// is responsible for deleting both <value_out> and <type_out>! int resolve (const char *name_in, char *&value_out, char *&type_out); - // Get value and type of a given name binding ( chars ). The caller - // is responsible for deleting both <value_out> and <type_out>! + /// Get a set of names matching a specified pattern (wchars). Matching + /// means the names must begin with the pattern string. int list_names (ACE_PWSTRING_SET &set_out, const ACE_WString &pattern_in); - // Get a set of names matching a specified pattern (wchars). Matching - // means the names must begin with the pattern string. + /// Get a set of names matching a specified pattern (chars). Matching + /// means the names must begin with the pattern string. int list_names (ACE_PWSTRING_SET &set_out, const char *pattern_in); - // Get a set of names matching a specified pattern (chars). Matching - // means the names must begin with the pattern string. + /// Get a set of values matching a specified pattern (wchars). Matching + /// means the values must begin with the pattern string. int list_values (ACE_PWSTRING_SET &set_out, const ACE_WString &pattern_in); - // Get a set of values matching a specified pattern (wchars). Matching - // means the values must begin with the pattern string. + /// Get a set of values matching a specified pattern (chars). Matching + /// means the values must begin with the pattern string. int list_values (ACE_PWSTRING_SET &set_out, const char *pattern_in); - // Get a set of values matching a specified pattern (chars). Matching - // means the values must begin with the pattern string. + /// Get a set of types matching a specified pattern (wchars). Matching + /// means the types must begin with the pattern string. int list_types (ACE_PWSTRING_SET &set_out, const ACE_WString &pattern_in); - // Get a set of types matching a specified pattern (wchars). Matching - // means the types must begin with the pattern string. + /// Get a set of types matching a specified pattern (chars). Matching + /// means the types must begin with the pattern string. int list_types (ACE_PWSTRING_SET &set_out, const char *pattern_in); - // Get a set of types matching a specified pattern (chars). Matching - // means the types must begin with the pattern string. + /** + * Get a set of names matching a specified pattern (wchars). Matching + * means the names must begin with the pattern string. Returns the + * complete binding associated each pattern match. + */ virtual int list_name_entries (ACE_BINDING_SET &set_out, const ACE_WString &pattern_in); - // Get a set of names matching a specified pattern (wchars). Matching - // means the names must begin with the pattern string. Returns the - // complete binding associated each pattern match. + /** + * Get a set of names matching a specified pattern (wchars). Matching + * means the names must begin with the pattern string. Returns the + * complete binding associated each pattern match. + */ virtual int list_name_entries (ACE_BINDING_SET &set_out, const char *pattern_in); - // Get a set of names matching a specified pattern (wchars). Matching - // means the names must begin with the pattern string. Returns the - // complete binding associated each pattern match. + /** + * Get a set of values matching a specified pattern (wchars). Matching + * means the values must begin with the pattern string. Returns the + * complete binding associated each pattern match. + */ virtual int list_value_entries (ACE_BINDING_SET &set_out, const ACE_WString &pattern_in); - // Get a set of values matching a specified pattern (wchars). Matching - // means the values must begin with the pattern string. Returns the - // complete binding associated each pattern match. + /** + * Get a set of values matching a specified pattern (wchars). Matching + * means the values must begin with the pattern string. Returns the + * complete binding associated each pattern match. + */ virtual int list_value_entries (ACE_BINDING_SET &set_out, const char *pattern_in); - // Get a set of values matching a specified pattern (wchars). Matching - // means the values must begin with the pattern string. Returns the - // complete binding associated each pattern match. + /** + * Get a set of types matching a specified pattern (wchars). Matching + * means the types must begin with the pattern string. Returns the + * complete binding associated each pattern match. + */ virtual int list_type_entries (ACE_BINDING_SET &set_out, const ACE_WString &pattern_in); - // Get a set of types matching a specified pattern (wchars). Matching - // means the types must begin with the pattern string. Returns the - // complete binding associated each pattern match. + /** + * Get a set of types matching a specified pattern (wchars). Matching + * means the types must begin with the pattern string. Returns the + * complete binding associated each pattern match. + */ virtual int list_type_entries (ACE_BINDING_SET &set_out, const char *pattern_in); - // Get a set of types matching a specified pattern (wchars). Matching - // means the types must begin with the pattern string. Returns the - // complete binding associated each pattern match. + /// Dump the state of the object. void dump (void); - // Dump the state of the object. private: + /// Keep track of the options such as database name etc per Naming Context ACE_Name_Options *name_options_; - // Keep track of the options such as database name etc per Naming Context + /// Name space (can be either local or remote) dynamically bound. ACE_Name_Space *name_space_; - // Name space (can be either local or remote) dynamically bound. + /// Holds the local hostname. ACE_TCHAR hostname_[MAXHOSTNAMELEN + 1]; - // Holds the local hostname. + /// Holds name of net name server. const ACE_TCHAR *netnameserver_host_; - // Holds name of net name server. + /// Holds port number of the net name server. int netnameserver_port_; - // Holds port number of the net name server. + /// 1 if we're on the same local machine as the name server, else 0. int local (void); - // 1 if we're on the same local machine as the name server, else 0. }; +/** + * @class ACE_Name_Options + * + * @brief Manages the options for the ACE Name_Server. + */ class ACE_Export ACE_Name_Options { - // = TITLE - // Manages the options for the ACE Name_Server. public: // = Initialization and termination methods. ACE_Name_Options (void); ~ACE_Name_Options (void); + /// Parse arguments. void parse_args (int argc, ACE_TCHAR *argv[]); - // Parse arguments. // = Set/Get port number void nameserver_port (int port); @@ -291,42 +320,42 @@ public: int use_registry (void); void use_registry (int); + /// Return debug status int debug (void); - // Return debug status + /// Return verbose status int verbose (void); - // Return verbose status private: + /// Extra debugging info int debugging_; - // Extra debugging info + /// Extra verbose messages int verbosity_; - // Extra verbose messages + /// Use Win32 Registry int use_registry_; - // Use Win32 Registry + /// Port to connect to nameserver process. int nameserver_port_; - // Port to connect to nameserver process. + /// Hostname of nameserver. const ACE_TCHAR *nameserver_host_; - // Hostname of nameserver. + /// Directory to hold name_bindings. ACE_TCHAR *namespace_dir_; - // Directory to hold name_bindings. + /// Name of this process. const ACE_TCHAR *process_name_; - // Name of this process. + /// Name of the database that stores the name/value/type bindings. const ACE_TCHAR *database_; - // Name of the database that stores the name/value/type bindings. + /// Base address of the underlying allocator char *base_address_; - // Base address of the underlying allocator + /// The context in which the naming database will be created. ACE_Naming_Context::Context_Scope_Type context_; - // The context in which the naming database will be created. }; ACE_FACTORY_DECLARE (ACE, ACE_Naming_Context) |