Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TAO_PG_FACTORYREGISTRY_H_
00017 #define TAO_PG_FACTORYREGISTRY_H_
00018 #include "ace/pre.h"
00019 #include "ace/ACE.h"
00020
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 #pragma once
00023 #endif
00024
00025 #include "tao/Versioned_Namespace.h"
00026
00027
00028
00029 #include "orbsvcs/PortableGroup/portablegroup_export.h"
00030 #include "orbsvcs/PortableGroupS.h"
00031 #include "ace/Hash_Map_Manager.h"
00032 #include "ace/SString.h"
00033 #include "ace/Null_Mutex.h"
00034
00035 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00036
00037
00038
00039 namespace TAO
00040 {
00041 class PG_FactoryRegistry;
00042 }
00043
00044
00045
00046
00047 namespace TAO
00048 {
00049
00050
00051
00052
00053
00054 class TAO_PortableGroup_Export PG_FactoryRegistry
00055 : public virtual POA_PortableGroup::FactoryRegistry
00056 {
00057 struct RoleInfo
00058 {
00059 ACE_CString type_id_;
00060 PortableGroup::FactoryInfos infos_;
00061
00062 RoleInfo(size_t estimated_number_entries = 5);
00063 };
00064 typedef ACE_Null_Mutex MapMutex;
00065 typedef ACE_Hash_Map_Manager <ACE_CString, RoleInfo *, MapMutex> RegistryType;
00066 typedef ACE_Hash_Map_Entry <ACE_CString, RoleInfo *> RegistryType_Entry;
00067 typedef ACE_Hash_Map_Iterator <ACE_CString, RoleInfo *, MapMutex> RegistryType_Iterator;
00068
00069
00070
00071 public:
00072
00073 PG_FactoryRegistry (const char * name = "FactoryRegistry");
00074
00075
00076 virtual ~PG_FactoryRegistry (void);
00077
00078
00079
00080
00081
00082
00083
00084 int parse_args (int argc, ACE_TCHAR * argv[]);
00085
00086
00087
00088
00089
00090
00091 int init (CORBA::ORB_ptr orb);
00092
00093
00094
00095
00096 void init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
00097
00098
00099
00100
00101
00102 int fini (void);
00103
00104
00105
00106
00107
00108
00109 int idle(int & result);
00110
00111
00112
00113
00114
00115 const char * identity () const;
00116
00117
00118
00119
00120
00121 ::PortableGroup::FactoryRegistry_ptr reference();
00122
00123
00124
00125 virtual void _remove_ref (void);
00126
00127
00128
00129
00130
00131 virtual void register_factory (
00132 const char * role,
00133 const char * type_id,
00134 const PortableGroup::FactoryInfo & factory_info
00135 );
00136
00137 virtual void unregister_factory (
00138 const char * role,
00139 const PortableGroup::Location & location
00140 );
00141
00142 virtual void unregister_factory_by_role (
00143 const char * role
00144 );
00145
00146
00147 virtual void unregister_factory_by_location (
00148 const PortableGroup::Location & location
00149 );
00150
00151 virtual ::PortableGroup::FactoryInfos * list_factories_by_role (
00152 const char * role,
00153 CORBA::String_out type_id
00154 );
00155
00156 virtual ::PortableGroup::FactoryInfos * list_factories_by_location (
00157 const PortableGroup::Location & location
00158 );
00159
00160
00161
00162 private:
00163
00164
00165
00166 int write_ior_file (const ACE_TCHAR * outputFile, const char * ior);
00167
00168
00169
00170 private:
00171
00172
00173
00174
00175 ACE_CString identity_;
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185 TAO_SYNCH_MUTEX internals_;
00186 typedef ACE_Guard<TAO_SYNCH_MUTEX> InternalGuard;
00187
00188
00189
00190
00191 CORBA::ORB_var orb_;
00192
00193
00194
00195
00196 PortableServer::POA_var poa_;
00197
00198
00199
00200
00201 PortableServer::ObjectId_var object_id_;
00202
00203
00204
00205
00206 CORBA::Object_var this_obj_;
00207
00208
00209
00210
00211 CORBA::String_var ior_;
00212
00213
00214
00215
00216 const ACE_TCHAR * ior_output_file_;
00217
00218
00219
00220
00221 ACE_CString ns_name_;
00222
00223 CosNaming::NamingContext_var naming_context_;
00224
00225 CosNaming::Name this_name_;
00226
00227
00228
00229
00230 int quit_on_idle_;
00231
00232
00233
00234
00235 enum {LIVE, DEACTIVATED, GONE} quit_state_;
00236
00237 int linger_;
00238
00239 RegistryType registry_;
00240
00241 };
00242 }
00243
00244 TAO_END_VERSIONED_NAMESPACE_DECL
00245
00246 #include "ace/post.h"
00247
00248 #endif // TAO_PG_FACTORYREGISTRY_H_