00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TAO_ORB_TABLE_H
00016 #define TAO_ORB_TABLE_H
00017
00018 #include "ace/pre.h"
00019
00020 #include "tao/TAO_Export.h"
00021
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif
00025
00026 #include "tao/orbconf.h"
00027 #include "tao/CORBA_String.h"
00028
00029 #include "ace/Array_Map.h"
00030 #include "ace/Thread_Mutex.h"
00031
00032
00033 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00034
00035
00036 class TAO_ORB_Core;
00037
00038 namespace TAO
00039 {
00040 class ORB_Core_Ref_Counter;
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 class TAO_Export ORB_Table
00064 {
00065 public:
00066
00067
00068
00069
00070
00071
00072 ORB_Table (void);
00073
00074 typedef ACE_Array_Map<CORBA::String_var,
00075 ORB_Core_Ref_Counter,
00076 TAO::String_Var_Equal_To> Table;
00077 typedef Table::key_type key_type;
00078 typedef Table::data_type data_type;
00079 typedef Table::value_type value_type;
00080 typedef Table::size_type size_type;
00081 typedef Table::iterator iterator;
00082
00083
00084
00085
00086
00087 iterator begin (void);
00088 iterator end (void);
00089 int bind (const char *orb_id, ::TAO_ORB_Core *orb_core);
00090
00091
00092
00093
00094
00095
00096
00097 ::TAO_ORB_Core* find (const char *orb_id);
00098
00099 int unbind (const char *orb_id);
00100
00101
00102 ::TAO_ORB_Core * const * get_orbs (size_t& num_orbs);
00103
00104
00105
00106 ::TAO_ORB_Core * first_orb (void);
00107
00108
00109 static ORB_Table * instance (void);
00110
00111
00112
00113 void set_default (char const * orb_id);
00114
00115
00116
00117 void not_default (char const * orb_id);
00118
00119
00120 Table * table (void);
00121
00122
00123 TAO_SYNCH_MUTEX & lock (void);
00124
00125 private:
00126
00127
00128 ORB_Table (const ORB_Table &);
00129 void operator= (const ORB_Table &);
00130
00131
00132
00133 ::TAO_ORB_Core * find_i (char const * orb_id);
00134
00135 private:
00136
00137
00138 ::TAO_SYNCH_MUTEX lock_;
00139
00140
00141
00142 bool first_orb_not_default_;
00143
00144
00145 Table table_;
00146
00147
00148 ::TAO_ORB_Core * first_orb_;
00149
00150
00151
00152
00153
00154 ::TAO_ORB_Core ** orbs_;
00155
00156
00157 size_t num_orbs_;
00158
00159 };
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170 class ORB_Core_Ref_Counter
00171 {
00172 public:
00173
00174
00175 ORB_Core_Ref_Counter (void);
00176
00177
00178 ORB_Core_Ref_Counter (::TAO_ORB_Core * core);
00179
00180
00181 ~ORB_Core_Ref_Counter (void);
00182
00183
00184 ORB_Core_Ref_Counter (ORB_Core_Ref_Counter const & rhs);
00185
00186
00187 void operator= (ORB_Core_Ref_Counter const & rhs);
00188
00189
00190 ::TAO_ORB_Core * core (void) const { return this->core_; }
00191
00192 private:
00193
00194 ::TAO_ORB_Core * core_;
00195
00196 };
00197
00198 }
00199
00200 TAO_END_VERSIONED_NAMESPACE_DECL
00201
00202 #if defined (__ACE_INLINE__)
00203 # include "tao/ORB_Table.inl"
00204 #endif
00205
00206 #include "ace/post.h"
00207
00208 #endif