Name_Space.h

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

Generated on Thu Nov 9 09:41:57 2006 for ACE by doxygen 1.3.6