PG_Group_Factory.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  * @file  PG_Group_Factory.h
00006  *
00007  * PG_Group_Factory.h,v 1.11 2006/03/14 06:14:34 jtc Exp
00008  *
00009  * @author Dale Wilson <wilson_d@ociweb.com>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_PG_GROUP_FACTORY_H
00014 #define TAO_PG_GROUP_FACTORY_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/PortableGroup/PG_Object_Group_Manipulator.h"
00025 
00026 #include "orbsvcs/PortableGroupC.h"
00027 
00028 #include "tao/PortableServer/PortableServer.h"
00029 
00030 #include "ace/ACE.h"
00031 #include "ace/Hash_Map_Manager.h"
00032 
00033 
00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00035 
00036 //////////////////
00037 // Forward reference
00038 namespace TAO
00039 {
00040   class PG_Property_Set;
00041 } // namespace TAO_PG
00042 
00043 namespace TAO
00044 {
00045   /////////////////////
00046   // forward references
00047   class PG_Object_Group;
00048 
00049   /**
00050    * class PG_Group_Factory
00051    */
00052   class TAO_PortableGroup_Export PG_Group_Factory
00053   {
00054     ////////////////////////////////////////////////////////////
00055     // typedef private implementation classes
00056     typedef ACE_Hash_Map_Manager_Ex<
00057         PortableGroup::ObjectGroupId,
00058         ::TAO::PG_Object_Group *,
00059         ACE_Hash<ACE_UINT64>,
00060         ACE_Equal_To<ACE_UINT64>,
00061          TAO_SYNCH_MUTEX> Group_Map;
00062 
00063     typedef ACE_Hash_Map_Entry <PortableGroup::ObjectGroupId, ::TAO::PG_Object_Group *> Group_Map_Entry;
00064 
00065     typedef ACE_Hash_Map_Iterator_Ex <
00066       PortableGroup::ObjectGroupId,
00067       ::TAO::PG_Object_Group *,
00068       ACE_Hash<ACE_UINT64>,
00069       ACE_Equal_To<ACE_UINT64>,
00070        TAO_SYNCH_MUTEX> Group_Map_Iterator;
00071 
00072   public:
00073 
00074     /// Constructor.
00075     PG_Group_Factory ();
00076 
00077     /// Destructor.
00078     ~PG_Group_Factory ();
00079 
00080     void init (
00081       CORBA::ORB_ptr orb,
00082       PortableServer::POA_ptr poa,
00083       PortableGroup::FactoryRegistry_ptr factory_registry
00084       ACE_ENV_ARG_DECL);
00085 
00086 
00087     TAO::PG_Object_Group * create_group (
00088         const char * type_id,
00089         const PortableGroup::Criteria & the_criteria,
00090         TAO::PG_Property_Set * typeid_properties
00091         ACE_ENV_ARG_DECL)
00092       ACE_THROW_SPEC ((CORBA::SystemException,
00093                        PortableGroup::NoFactory,
00094                        PortableGroup::ObjectNotCreated,
00095                        PortableGroup::InvalidCriteria,
00096                        PortableGroup::InvalidProperty,
00097                        PortableGroup::CannotMeetCriteria));
00098 
00099 
00100     void delete_group (PortableGroup::ObjectGroup_ptr object_group
00101         ACE_ENV_ARG_DECL)
00102       ACE_THROW_SPEC ((CORBA::SystemException,
00103                        PortableGroup::ObjectNotFound));
00104 
00105 
00106     void delete_group (PortableGroup::ObjectGroupId group_id
00107         ACE_ENV_ARG_DECL)
00108       ACE_THROW_SPEC ((CORBA::SystemException,
00109                        PortableGroup::ObjectNotFound));
00110 
00111     PortableGroup::ObjectGroups *
00112     groups_at_location (
00113         const PortableGroup::Location & the_location
00114         ACE_ENV_ARG_DECL)
00115       ACE_THROW_SPEC ( (CORBA::SystemException));
00116 
00117 
00118 
00119     /**
00120      * insert existing group.  Take ownership
00121      * note: uses group id extracted from group object
00122      * @return bool true if insertion successful
00123      */
00124     int insert_group ( ::TAO::PG_Object_Group * group);
00125 
00126     /**
00127      * insert group.  Take ownership
00128      * @return bool true if insertion successful
00129      */
00130     int insert_group (PortableGroup::ObjectGroupId group_id, ::TAO::PG_Object_Group * group);
00131 
00132     /**
00133      * find group
00134      * @return bool true if found
00135      */
00136     int find_group (PortableGroup::ObjectGroupId group_id, ::TAO::PG_Object_Group *& group) const;
00137 
00138     /**
00139      * find group
00140      * note: uses group id extracted from object_group
00141      * @return bool true if found
00142      */
00143     int find_group (PortableGroup::ObjectGroup_ptr object_group, ::TAO::PG_Object_Group *& group) const;
00144 
00145     /**
00146      * remove group from map and delete it.
00147      * @return bool true if found
00148      */
00149     int destroy_group (PortableGroup::ObjectGroupId object_group_id);
00150 
00151     /**
00152      * remove group from map and delete it.
00153      * note: uses group id extracted from object_group
00154      * @return bool true if found
00155      */
00156     int destroy_group (PortableGroup::ObjectGroup_ptr object_group);
00157 
00158   private:
00159 
00160   private:
00161 
00162     CORBA::ORB_var orb_;
00163 
00164     /// Reference to the POA used to create object group references.
00165     PortableServer::POA_var poa_;
00166 
00167     /// The factory registry for replica factories
00168     PortableGroup::FactoryRegistry_var factory_registry_;
00169 
00170     ::TAO::PG_Object_Group_Manipulator manipulator_;
00171 
00172     const char * domain_id_;
00173 
00174     Group_Map group_map_;
00175 
00176 
00177   };
00178 } // namespace TAO
00179 
00180 TAO_END_VERSIONED_NAMESPACE_DECL
00181 
00182 #include /**/ "ace/post.h"
00183 
00184 #endif  /* TAO_PG_GROUP_FACTORY_H */

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