Portable_Group_Map.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Portable_Group_Map.h
00006  *
00007  *  $Id: Portable_Group_Map.h 76589 2007-01-25 18:04:11Z elliott_c $
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 
00100 
00101   /// Remove a GroupId->ObjectKey mapping from the map.
00102   void remove_groupid_objectkey_pair (const PortableGroup::TagGroupTaggedComponent* group_id,
00103                                       const TAO::ObjectKey &key);
00104 
00105   /// Dispatch a request to all of the ObjectIds that belong to
00106   /// the specified group.
00107   void dispatch (PortableGroup::TagGroupTaggedComponent* group_id,
00108                                     TAO_ORB_Core *orb_core,
00109                                     TAO_ServerRequest &request,
00110                                     CORBA::Object_out forward_to);
00111 
00112   /// Id hash map.
00113   typedef ACE_Hash_Map_Manager_Ex<
00114     PortableGroup::TagGroupTaggedComponent *,
00115     Map_Entry *,
00116     TAO_GroupId_Hash,
00117     TAO_GroupId_Equal_To,
00118     ACE_Null_Mutex> GroupId_Table;
00119   typedef GroupId_Table::iterator Iterator;
00120 
00121 protected:
00122   /// Lock used to synchronize access to map_.
00123   TAO_SYNCH_MUTEX lock_;
00124 
00125   /// Id map.
00126   GroupId_Table map_;
00127 };
00128 
00129 TAO_END_VERSIONED_NAMESPACE_DECL
00130 
00131 //#if defined (__ACE_INLINE__)
00132 //# include "Portable_Group_Map.i"
00133 //#endif /* __ACE_INLINE__ */
00134 
00135 #include /**/ "ace/post.h"
00136 #endif /* TAO_PORTABLE_GROUP_MAP_H */

Generated on Sun Jan 27 16:22:31 2008 for TAO_PortableGroup by doxygen 1.3.6