Portable_Group_Map.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Portable_Group_Map.h
00006  *
00007  *  Portable_Group_Map.h,v 1.17 2006/03/14 06:14:34 jtc Exp
00008  *
00009  *  @author Frank Hunleth <fhunleth@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_PORTABLE_GROUP_MAP_H
00014 #define TAO_PORTABLE_GROUP_MAP_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "orbsvcs/PortableGroup/portablegroup_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "orbsvcs/PortableGroupC.h"
00025 
00026 #include "tao/Object_KeyC.h"
00027 
00028 #include "ace/Null_Mutex.h"
00029 #include "ace/Hash_Map_Manager_T.h"
00030 
00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00032 
00033 class TAO_ServerRequest;
00034 
00035 /**
00036  * @class TAO_GroupId_Hash
00037  *
00038  * @brief Hashing class for Group Ids.
00039  *
00040  * Define the hash() method for Group Ids.
00041  */
00042 class TAO_PortableGroup_Export TAO_GroupId_Hash
00043 {
00044 public:
00045 
00046   /// Returns hash value.
00047   u_long operator () (const PortableGroup::TagGroupTaggedComponent *id) const;
00048 };
00049 
00050 /**
00051  * @class TAO_GroupId_Equal_To
00052  *
00053  * @brief Hashing class for Group Ids.
00054  *
00055  * Define the Equal_To () method for Object Ids.
00056  */
00057 class TAO_PortableGroup_Export TAO_GroupId_Equal_To
00058 {
00059 public:
00060 
00061   /// Returns 1 if equal.
00062   int operator () (const PortableGroup::TagGroupTaggedComponent *lhs,
00063                    const PortableGroup::TagGroupTaggedComponent *rhs) const;
00064 };
00065 
00066 /**
00067  * @class TAO_Portable_Group_Map
00068  *
00069  * @brief Map of GroupIds to ObjectKeys.
00070  */
00071 class TAO_PortableGroup_Export TAO_Portable_Group_Map
00072 {
00073 public:
00074 
00075   /**
00076    * @struct Map_Entry
00077    *
00078    * @brief Value field of the portable group map.
00079    */
00080   struct Map_Entry
00081   {
00082     /// The key.
00083     TAO::ObjectKey key;
00084 
00085     /// next ObjectKey in the group.
00086     struct Map_Entry *next;
00087   };
00088 
00089   /// Constructor.
00090   TAO_Portable_Group_Map ();
00091 
00092   /// Destructor.
00093   ~TAO_Portable_Group_Map (void);
00094 
00095   /// Add a GroupId->ObjectKey mapping to the map.
00096   /// This function takes ownership of the memory pointed to be group_id
00097   void add_groupid_objectkey_pair (PortableGroup::TagGroupTaggedComponent *group_id,
00098                                    const TAO::ObjectKey &key
00099                                    ACE_ENV_ARG_DECL);
00100 
00101 
00102   /// Remove a GroupId->ObjectKey mapping from the map.
00103   void remove_groupid_objectkey_pair (const PortableGroup::TagGroupTaggedComponent* group_id,
00104                                       const TAO::ObjectKey &key
00105                                       ACE_ENV_ARG_DECL);
00106 
00107   /// Dispatch a request to all of the ObjectIds that belong to
00108   /// the specified group.
00109   void dispatch (PortableGroup::TagGroupTaggedComponent* group_id,
00110                                     TAO_ORB_Core *orb_core,
00111                                     TAO_ServerRequest &request,
00112                                     CORBA::Object_out forward_to
00113                                     ACE_ENV_ARG_DECL);
00114 
00115   /// Id hash map.
00116   typedef ACE_Hash_Map_Manager_Ex<
00117     PortableGroup::TagGroupTaggedComponent *,
00118     Map_Entry *,
00119     TAO_GroupId_Hash,
00120     TAO_GroupId_Equal_To,
00121     ACE_Null_Mutex> GroupId_Table;
00122   typedef GroupId_Table::iterator Iterator;
00123 
00124 protected:
00125   /// Lock used to synchronize access to map_.
00126   TAO_SYNCH_MUTEX lock_;
00127 
00128   /// Id map.
00129   GroupId_Table map_;
00130 };
00131 
00132 TAO_END_VERSIONED_NAMESPACE_DECL
00133 
00134 //#if defined (__ACE_INLINE__)
00135 //# include "Portable_Group_Map.i"
00136 //#endif /* __ACE_INLINE__ */
00137 
00138 #include /**/ "ace/post.h"
00139 #endif /* TAO_PORTABLE_GROUP_MAP_H */

Generated on Thu Nov 9 14:03:34 2006 for TAO_PortableGroup by doxygen 1.3.6