Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Name_Space.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //==========================================================================
00004 /**
00005  *  @file    Name_Space.h
00006  *
00007  *  $Id: Name_Space.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Prashant Jain
00010  */
00011 //==========================================================================
00012 
00013 
00014 #ifndef ACE_NAME_SPACE_H
00015 #define ACE_NAME_SPACE_H
00016 #include "ace/pre.h"
00017 
00018 #include "ace/ACE_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ace/SString.h"
00025 #include "ace/Unbounded_Set.h"
00026 #include "ace/Name_Proxy.h"
00027 
00028 typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_WSTRING_SET;
00029 
00030 /**
00031  * @class ACE_Name_Binding
00032  *
00033  * @brief Maintains a mapping from name to value and type.
00034  */
00035 class ACE_Export ACE_Name_Binding
00036 {
00037 public:
00038   // = Initialization and termination.
00039   /// Main constructor that initializes all the fields.
00040   ACE_Name_Binding (const ACE_NS_WString &n,
00041                     const ACE_NS_WString &v,
00042                     const char *t);
00043 
00044   /// Default constructor.
00045   ACE_Name_Binding (void);
00046 
00047   /// Copy constructor.
00048   ACE_Name_Binding (const ACE_Name_Binding &);
00049 
00050   /// Assignment operator.
00051   void operator= (const ACE_Name_Binding &);
00052 
00053   /// Destructor.
00054   ~ACE_Name_Binding (void);
00055 
00056   /// Test for equality.
00057   int operator == (const ACE_Name_Binding &s) const;
00058 
00059   /// Name of the binding.
00060   ACE_NS_WString name_;
00061 
00062   /// Value of the binding.
00063   ACE_NS_WString value_;
00064 
00065   /// Type of the binding.
00066   char *type_;
00067 };
00068 
00069 typedef ACE_Unbounded_Set<ACE_Name_Binding> ACE_BINDING_SET;
00070 typedef ACE_Unbounded_Set_Iterator<ACE_Name_Binding> ACE_BINDING_ITERATOR;
00071 
00072 typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_PWSTRING_SET;
00073 typedef ACE_Unbounded_Set_Iterator<ACE_NS_WString> ACE_PWSTRING_ITERATOR;
00074 
00075 /**
00076  * @class ACE_Name_Space
00077  *
00078  * @brief Abstract base class that provides an abstract interface to
00079  * the database without exposing any implemenation details.
00080  *
00081  * Manages a Naming Service Name Space. Provides the basic
00082  * methods -- bind, unbind, rebind, find, and listnames.
00083  */
00084 class ACE_Export ACE_Name_Space
00085 {
00086 public:
00087 
00088   /// virtual destructor to ensure destructors of subclasses get
00089   /// called.
00090   virtual ~ACE_Name_Space (void);
00091 
00092   /// Bind a new name to a naming context (Wide character strings).
00093   virtual int bind (const ACE_NS_WString &name_in,
00094                     const ACE_NS_WString &value_in,
00095                     const char *type_in = "") = 0;
00096 
00097 
00098   /**
00099    * Overwrite the value or type of an existing name in a
00100    * ACE_Name_Space or bind a new name to the context, if it didn't
00101    * exist yet. (Wide charcter strings interface).
00102    */
00103   virtual int rebind (const ACE_NS_WString &name_in,
00104                       const ACE_NS_WString &value_in,
00105                       const char *type_in = "") = 0;
00106 
00107   /// Delete a name from a ACE_Name_Space (Wide charcter strings
00108   /// Interface).
00109   virtual int unbind (const ACE_NS_WString &name_in) = 0;
00110 
00111   /// Get value and type of a given name binding (Wide chars).  The
00112   /// caller is responsible for deleting both <value_out> and <type_out>!
00113   virtual int resolve (const ACE_NS_WString &name_in,
00114                        ACE_NS_WString &value_out,
00115                        char *&type_out) = 0;
00116 
00117   /// Get a set of names matching a specified pattern (wchars). Matching
00118   /// means the names must begin with the pattern string.
00119   virtual int list_names (ACE_WSTRING_SET &set_out,
00120                           const ACE_NS_WString &pattern_in) = 0;
00121 
00122   /// Get a set of values matching a specified pattern (wchars). Matching
00123   /// means the values must begin with the pattern string.
00124   virtual int list_values (ACE_WSTRING_SET &set_out,
00125                            const ACE_NS_WString &pattern_in) = 0;
00126 
00127   /// Get a set of types matching a specified pattern (wchars). Matching
00128   /// means the types must begin with the pattern string.
00129   virtual int list_types (ACE_WSTRING_SET &set_out,
00130                           const ACE_NS_WString &pattern_in) = 0;
00131 
00132   /**
00133    * Get a set of names matching a specified pattern (wchars). Matching
00134    * means the names must begin with the pattern string. Returns the
00135    * complete binding associated each pattern match.
00136    */
00137   virtual int list_name_entries (ACE_BINDING_SET &set,
00138                                  const ACE_NS_WString &pattern) = 0;
00139 
00140   /**
00141    * Get a set of values matching a specified pattern (wchars). Matching
00142    * means the values must begin with the pattern string. Returns the
00143    * complete binding associated each pattern match.
00144    */
00145   virtual int list_value_entries (ACE_BINDING_SET &set,
00146                                   const ACE_NS_WString &pattern) = 0;
00147 
00148   /**
00149    * Get a set of types matching a specified pattern (wchars). Matching
00150    * means the types must begin with the pattern string. Returns the
00151    * complete binding associated each pattern match.
00152    */
00153   virtual int list_type_entries (ACE_BINDING_SET &set,
00154                                  const ACE_NS_WString &pattern) = 0;
00155 
00156   /// Dump the state of the object
00157   virtual void dump (void) const = 0;
00158 };
00159 
00160 #include "ace/post.h"
00161 #endif /* ACE_NAME_SPACE_H */

Generated on Mon Jun 16 11:20:28 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002