00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef TAO_PG_OBJECT_GROUP_H_
00021 #define TAO_PG_OBJECT_GROUP_H_
00022 #include "ace/pre.h"
00023
00024 #include "orbsvcs/PortableGroup/portablegroup_export.h"
00025
00026 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00027 #pragma once
00028 #endif
00029
00030
00031
00032
00033 #include "orbsvcs/PortableGroup/PG_Property_Set.h"
00034 #include "orbsvcs/PortableGroup/PG_Location_Hash.h"
00035 #include "orbsvcs/PortableGroup/PG_Location_Equal_To.h"
00036 #include "orbsvcs/PortableGroup/PG_Object_Group_Manipulator.h"
00037 #include "orbsvcs/PortableGroupC.h"
00038 #include "tao/PortableServer/PortableServer.h"
00039 #include "ace/Hash_Map_Manager_T.h"
00040 #include "ace/ACE.h"
00041
00042 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00043
00044
00045
00046
00047 namespace TAO_IOP
00048 {
00049 class TAO_IOR_Property;
00050 }
00051
00052
00053
00054 namespace TAO
00055 {
00056
00057
00058 class TAO_PortableGroup_Export PG_Object_Group
00059 {
00060
00061 struct MemberInfo
00062 {
00063
00064 CORBA::Object_var member_;
00065
00066
00067
00068 PortableGroup::GenericFactory_var factory_;
00069
00070
00071 PortableGroup::GenericFactory::FactoryCreationId factory_id_;
00072
00073
00074 PortableGroup::Location location_;
00075
00076
00077
00078 CORBA::Boolean is_primary_;
00079
00080
00081
00082
00083
00084
00085 MemberInfo (CORBA::Object_ptr member, const PortableGroup::Location & location);
00086
00087
00088 MemberInfo (
00089 CORBA::Object_ptr member,
00090 const PortableGroup::Location & location,
00091 PortableGroup::GenericFactory_ptr factory,
00092 PortableGroup::GenericFactory::FactoryCreationId factory_id);
00093
00094
00095 ~MemberInfo();
00096 };
00097
00098 typedef TAO_SYNCH_MUTEX MemberMapMutex;
00099 typedef ACE_Hash_Map_Manager_Ex <
00100 PortableGroup::Location,
00101 MemberInfo *,
00102 TAO_PG_Location_Hash,
00103 TAO_PG_Location_Equal_To,
00104 MemberMapMutex> MemberMap;
00105 typedef ACE_Hash_Map_Entry <PortableGroup::Location, MemberInfo *> MemberMap_Entry;
00106 typedef ACE_Hash_Map_Iterator_Ex <
00107 PortableGroup::Location,
00108 MemberInfo *,
00109 TAO_PG_Location_Hash,
00110 TAO_PG_Location_Equal_To,
00111 MemberMapMutex> MemberMap_Iterator;
00112
00113
00114
00115 public:
00116
00117
00118
00119 PG_Object_Group (
00120 CORBA::ORB_ptr orb,
00121 PortableGroup::FactoryRegistry_ptr factory_registry,
00122 TAO::PG_Object_Group_Manipulator & manipulator,
00123 CORBA::Object_ptr empty_group,
00124 const PortableGroup::TagGroupTaggedComponent & tagged_component,
00125 const char * type_id,
00126 const PortableGroup::Criteria & the_criteria,
00127 TAO::PG_Property_Set * type_properties);
00128
00129
00130
00131 ~PG_Object_Group ();
00132
00133
00134
00135
00136 public:
00137
00138 PortableGroup::ObjectGroup_ptr reference()const;
00139
00140
00141
00142
00143
00144 void get_group_specific_factories (PortableGroup::FactoryInfos & result) const;
00145
00146
00147
00148
00149 const PortableGroup::Location & get_primary_location() const;
00150
00151
00152
00153
00154
00155 PortableGroup::TypeId get_type_id ()const;
00156
00157
00158
00159
00160
00161 PortableGroup::MembershipStyleValue get_membership_style() const;
00162
00163
00164
00165
00166 PortableGroup::MinimumNumberMembersValue get_minimum_number_members () const;
00167
00168
00169
00170
00171 PortableGroup::InitialNumberMembersValue get_initial_number_members () const;
00172
00173
00174
00175
00176
00177
00178 void set_properties_dynamically (
00179 const PortableGroup::Properties & overrides
00180 ACE_ENV_ARG_DECL)
00181 ACE_THROW_SPEC ((CORBA::SystemException,
00182 PortableGroup::InvalidProperty,
00183 PortableGroup::UnsupportedProperty));
00184
00185
00186
00187
00188 void get_properties (PortableGroup::Properties_var & result) const
00189 ACE_THROW_SPEC ((CORBA::SystemException));
00190
00191
00192
00193
00194 PortableGroup::ObjectGroupId get_object_group_id () const;
00195
00196
00197
00198
00199
00200
00201 void add_member (
00202 const PortableGroup::Location & the_location,
00203 CORBA::Object_ptr member
00204 ACE_ENV_ARG_DECL)
00205 ACE_THROW_SPEC ( (CORBA::SystemException,
00206 PortableGroup::ObjectNotAdded));
00207
00208
00209
00210
00211
00212
00213
00214
00215 int set_primary_member (
00216 TAO_IOP::TAO_IOR_Property * prop,
00217 const PortableGroup::Location & the_location
00218 ACE_ENV_ARG_DECL)
00219 ACE_THROW_SPEC ((
00220 CORBA::SystemException
00221 , PortableGroup::MemberNotFound
00222 ));
00223
00224
00225
00226
00227 void remove_member (
00228 const PortableGroup::Location & the_location
00229 ACE_ENV_ARG_DECL)
00230 ACE_THROW_SPEC ( (CORBA::SystemException,
00231 PortableGroup::MemberNotFound));
00232
00233
00234
00235
00236
00237 void create_member (
00238 const PortableGroup::Location & the_location,
00239 const char * type_id,
00240 const PortableGroup::Criteria & the_criteria
00241 ACE_ENV_ARG_DECL)
00242 ACE_THROW_SPEC ( (CORBA::SystemException,
00243 PortableGroup::MemberAlreadyPresent,
00244 PortableGroup::NoFactory,
00245 PortableGroup::ObjectNotCreated,
00246 PortableGroup::InvalidCriteria,
00247 PortableGroup::CannotMeetCriteria));
00248
00249
00250
00251
00252 PortableGroup::Locations * locations_of_members (ACE_ENV_SINGLE_ARG_DECL)
00253 ACE_THROW_SPEC ((CORBA::SystemException));
00254
00255
00256
00257
00258 CORBA::Object_ptr get_member_reference (
00259 const PortableGroup::Location & the_location
00260 ACE_ENV_ARG_DECL)
00261 ACE_THROW_SPEC ((
00262 CORBA::SystemException,
00263 PortableGroup::MemberNotFound));
00264
00265
00266
00267
00268
00269 void initial_populate (ACE_ENV_SINGLE_ARG_DECL);
00270
00271
00272
00273
00274 void minimum_populate (ACE_ENV_SINGLE_ARG_DECL);
00275
00276
00277
00278
00279
00280 int has_member_at (const PortableGroup::Location & location );
00281
00282
00283
00284 private:
00285
00286 int increment_version ();
00287
00288 void distribute_iogr (ACE_ENV_SINGLE_ARG_DECL);
00289
00290 PortableGroup::ObjectGroup_ptr add_member_to_iogr(CORBA::Object_ptr member ACE_ENV_ARG_DECL);
00291
00292
00293 void create_members (size_t count ACE_ENV_ARG_DECL)
00294 ACE_THROW_SPEC ((
00295 CORBA::SystemException,
00296 PortableGroup::NoFactory
00297 ));
00298
00299
00300
00301
00302 private:
00303 PG_Object_Group ();
00304 PG_Object_Group (const PG_Object_Group & rhs);
00305 PG_Object_Group & operator = (const PG_Object_Group & rhs);
00306
00307
00308
00309
00310 public:
00311
00312
00313
00314 private:
00315
00316
00317
00318 private:
00319
00320
00321
00322
00323 mutable TAO_SYNCH_MUTEX internals_;
00324
00325 CORBA::ORB_var orb_;
00326
00327
00328 PortableGroup::FactoryRegistry_var factory_registry_;
00329
00330
00331
00332 TAO::PG_Object_Group_Manipulator & manipulator_;
00333
00334
00335 int empty_;
00336
00337 ACE_CString role_;
00338 PortableGroup::TypeId_var type_id_;
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348 PortableGroup::TagGroupTaggedComponent tagged_component_;
00349
00350
00351
00352
00353 PortableGroup::ObjectGroup_var reference_;
00354
00355
00356
00357
00358 PortableServer::ObjectId_var object_id_;
00359
00360
00361 MemberMap members_;
00362
00363 PortableGroup::Location primary_location_;
00364
00365
00366
00367 TAO::PG_Property_Set properties_;
00368
00369
00370
00371 PortableGroup::InitialNumberMembersValue initial_number_members_;
00372 PortableGroup::MinimumNumberMembersValue minimum_number_members_;
00373 PortableGroup::FactoryInfos group_specific_factories_;
00374
00375 };
00376 }
00377
00378 TAO_END_VERSIONED_NAMESPACE_DECL
00379
00380 #include "ace/post.h"
00381
00382 #endif // TAO_PG_OBJECT_GROUP_H_