Persistent_Entries.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Persistent_Entries.h
00006  *
00007  *  $Id: Persistent_Entries.h 71526 2006-03-14 06:14:35Z jtc $
00008  *
00009  *  @author Marina Spivak <marina@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef TAO_PERSISTENT_ENTRIES_H
00015 #define TAO_PERSISTENT_ENTRIES_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/Hash_Map_With_Allocator_T.h"
00019 #include "orbsvcs/CosNamingC.h"
00020 #include "orbsvcs/Naming/naming_serv_export.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00027 
00028 /**
00029  * @class TAO_Persistent_IntId
00030  *
00031  * @brief Helper class for TAO_Persistent_Bindings_Map: unifies several
00032  * data items, so they can be stored together as a  <value>
00033  * for a <key> in a hash table holding the state of a Persistent
00034  * Naming Context.
00035  *
00036  * This class holds a strigified IOR and a binding type, so
00037  * they can be stored together as a <value> for a <key> in a
00038  * hash table holding the state of a Persistent Naming Context.
00039  * Memory for the ior isn't allocated/deallocated, this class just
00040  * copies a pointer.
00041  */
00042 class TAO_Naming_Serv_Export TAO_Persistent_IntId
00043 {
00044 public:
00045   // = Initialization and termination methods.
00046   /// Constructor.
00047   TAO_Persistent_IntId (void);
00048 
00049   /// Constructor.
00050   TAO_Persistent_IntId (char * obj_ref,
00051                         CosNaming::BindingType type /* = CosNaming::nobject */);
00052 
00053   /// Copy constructor.
00054   TAO_Persistent_IntId (const TAO_Persistent_IntId & rhs);
00055 
00056   /// Destructor.
00057   ~TAO_Persistent_IntId (void);
00058 
00059   /// Assignment operator.
00060   void operator= (const TAO_Persistent_IntId & rhs);
00061 
00062   // = Data members.
00063 
00064   /// Stringified IOR to be stored in a Persistent Naming Context.
00065   const char *ref_;
00066 
00067   /// Binding type for <ref_>.
00068   CosNaming::BindingType type_;
00069 };
00070 
00071 /**
00072  * @class TAO_Persistent_ExtId
00073  *
00074  * @brief Helper class for TAO_Persistent_Bindings_Map: unifies several
00075  * data items, so they can be stored together as a  <key>
00076  * for a <value> in a hash table holding the state of a Persistent
00077  * Naming Context.
00078  *
00079  * This class holds id and kind strings, so
00080  * they can be stored together as a <key> for a <value> in a
00081  * hash table holding the state of a Persistent Naming Context.
00082  * Memory for id and kind isn't allocated/deallocated, this
00083  * class just copies pointers.
00084  */
00085 class TAO_Naming_Serv_Export TAO_Persistent_ExtId
00086 {
00087 public:
00088   // = Initialization and termination methods.
00089 
00090   /// Constructor.
00091   TAO_Persistent_ExtId (void);
00092 
00093   /// Constructor.
00094   TAO_Persistent_ExtId (const char *id,
00095                         const char *kind);
00096 
00097   /// Copy constructor.
00098   TAO_Persistent_ExtId (const TAO_Persistent_ExtId & rhs);
00099 
00100   /// Destructor.
00101   ~TAO_Persistent_ExtId (void);
00102 
00103   // = Assignment and comparison methods.
00104 
00105   /// Assignment operator (does copy memory).
00106   void operator= (const TAO_Persistent_ExtId & rhs);
00107 
00108   /// Equality comparison operator (must match both id_ and kind_).
00109   bool operator== (const TAO_Persistent_ExtId &rhs) const;
00110 
00111   /// Inequality comparison operator.
00112   bool operator!= (const TAO_Persistent_ExtId &rhs) const;
00113 
00114   /// <hash> function is required in order for this class to be usable by
00115   /// ACE_Hash_Map_Manager.
00116   u_long hash (void) const;
00117 
00118   // = Data members.
00119 
00120   /// <id> portion of the name to be associated with some object
00121   /// reference in a Persistent Naming Context.
00122   const char * id_;
00123 
00124   /// <kind> portion of the name to be associated with some object
00125   /// reference in a Persistent Naming Context.
00126   const char * kind_;
00127 
00128   // Accessors.
00129 
00130   const char * id (void);
00131   const char * kind (void);
00132 };
00133 
00134 /**
00135  * @class TAO_Persistent_Index_IntId
00136  *
00137  * @brief Helper class for TAO_Persistent_Context_Index: unifies several
00138  * data items, so they can be stored together as a  <value>
00139  * for a <key> in a hash table holding the state of a Persistent
00140  * Context Index.  (Persistent Context Index is like directory
00141  * that stores info about every active Naming Context).
00142  *
00143  * This class holds a counter and a hash map pointers, so
00144  * they can be stored together as a <value> for a <key> in a
00145  * hash table holding the state of a Persistent Context Index.
00146  */
00147 class TAO_Naming_Serv_Export TAO_Persistent_Index_IntId
00148 {
00149 public:
00150   // = Initialization and termination methods.
00151   /// Constructor.
00152   TAO_Persistent_Index_IntId (void);
00153 
00154   /// Constructor.
00155   TAO_Persistent_Index_IntId (ACE_UINT32 *counter,
00156                               ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId,
00157                               TAO_Persistent_IntId> * hash_map);
00158 
00159   /// Copy constructor.
00160   TAO_Persistent_Index_IntId (const TAO_Persistent_Index_IntId & rhs);
00161 
00162   /// Destructor.
00163   ~TAO_Persistent_Index_IntId (void);
00164 
00165   /// Assignment operator (does copy memory).
00166   void operator= (const TAO_Persistent_Index_IntId & rhs);
00167 
00168   // = Data members.
00169 
00170   /// Pointer to a Persistent Naming Context's counter.
00171   ACE_UINT32 *counter_;
00172 
00173   /// Pointer to a Persistent Naming Context's hash map.
00174   ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId,
00175     TAO_Persistent_IntId> * hash_map_;
00176 };
00177 
00178 /**
00179  * @class TAO_Persistent_Index_ExtId
00180  *
00181  * @brief Helper class for TAO_Persistent_Context_Index: holds
00182  * Persistent Naming Context POA id, so it can be stored as a <key>
00183  * for a <value> in a hash table holding state of a Persistent
00184  * Context Index.  (Persistent Context Index is like directory
00185  * that stores info about every active Naming Context).
00186  *
00187  * We need this wrapper class around the actual data because we must
00188  * provide <hash> function for it to work with
00189  * ACE_Hash_Map_Manager.
00190  */
00191 class TAO_Naming_Serv_Export TAO_Persistent_Index_ExtId
00192 {
00193 public:
00194   // = Initialization and termination methods.
00195 
00196   /// Constructor.
00197   TAO_Persistent_Index_ExtId (void);
00198 
00199   /// Constructor.
00200   TAO_Persistent_Index_ExtId (const char *poa_id);
00201 
00202   /// Copy constructor.
00203   TAO_Persistent_Index_ExtId (const TAO_Persistent_Index_ExtId & rhs);
00204 
00205   /// Destructor.
00206   ~TAO_Persistent_Index_ExtId (void);
00207 
00208   // = Assignment and comparison methods.
00209 
00210   /// Assignment operator (does copy memory).
00211   void operator= (const TAO_Persistent_Index_ExtId & rhs);
00212 
00213   /// Equality comparison operator (must match both id_ and kind_).
00214   bool operator== (const TAO_Persistent_Index_ExtId &rhs) const;
00215 
00216   /// Inequality comparison operator.
00217   bool operator!= (const TAO_Persistent_Index_ExtId &rhs) const;
00218 
00219   /// <hash> function is required in order for this class to be usable by
00220   /// ACE_Hash_Map_Manager.
00221   u_long hash (void) const;
00222 
00223   // = Data member.
00224 
00225   /// POA id to be associated with the rest of the info for some
00226   /// Persistent Naming Context in the Persistent Context Index.
00227   const char * poa_id_;
00228 };
00229 
00230 TAO_END_VERSIONED_NAMESPACE_DECL
00231 
00232 #include /**/ "ace/post.h"
00233 #endif /* TAO_PERSISTENT_ENTRIES_H */

Generated on Sun Jan 27 16:15:31 2008 for TAO_CosNaming by doxygen 1.3.6