00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ___HxCorbaNJet_tie_h__
00016 #define ___HxCorbaNJet_tie_h__
00017
00018 #include <HxCorbaNJet_skel.h>
00019
00020 #ifndef OB_INTEGER_VERSION
00021 # error No ORBacus version defined! Is <OB/CORBA.h> included?
00022 #endif
00023
00024 #ifndef OB_NO_VERSION_CHECK
00025 # if (OB_INTEGER_VERSION != 4010000L)
00026 # error ORBacus version mismatch!
00027 # endif
00028 #endif
00029
00030
00031
00032
00033 namespace POA_HxCorba
00034 {
00035
00036
00037
00038
00039 template<class T>
00040 class NJet_tie : virtual public NJet
00041 {
00042 T* ptr_;
00043 PortableServer::POA_ptr poa_;
00044 CORBA::Boolean rel_;
00045
00046 NJet_tie(const NJet_tie<T>&) { }
00047 void operator=(const NJet_tie<T>&) { }
00048
00049 public:
00050
00051 NJet_tie(T& t)
00052 : ptr_(&t), poa_(PortableServer::POA::_nil()), rel_(false)
00053 {
00054 }
00055
00056 NJet_tie(T& t, PortableServer::POA_ptr poa)
00057 : ptr_(&t), poa_(PortableServer::POA::_duplicate(poa)), rel_(false)
00058 {
00059 }
00060
00061 NJet_tie(T* p, CORBA::Boolean release = true)
00062 : ptr_(p), poa_(PortableServer::POA::_nil()), rel_(release)
00063 {
00064 }
00065
00066 NJet_tie(T* p, PortableServer::POA_ptr poa, CORBA::Boolean release = true)
00067 : ptr_(p), poa_(PortableServer::POA::_duplicate(poa)), rel_(release)
00068 {
00069 }
00070
00071 virtual
00072 ~NJet_tie()
00073 {
00074 if(rel_)
00075 delete ptr_;
00076
00077 CORBA::release(poa_);
00078 }
00079
00080 T*
00081 _tied_object()
00082 {
00083 return ptr_;
00084 }
00085
00086 void
00087 _tied_object(T& obj)
00088 {
00089 if(rel_)
00090 delete ptr_;
00091
00092 ptr_ = &obj;
00093 rel_ = false;
00094 }
00095
00096 void
00097 _tied_object(T* obj, CORBA::Boolean release = true)
00098 {
00099 if(rel_)
00100 delete ptr_;
00101
00102 ptr_ = obj;
00103 rel_ = release;
00104 }
00105
00106 CORBA::Boolean
00107 _is_owner()
00108 {
00109 return rel_;
00110 }
00111
00112 void
00113 _is_owner(CORBA::Boolean b)
00114 {
00115 rel_ = b;
00116 }
00117
00118 virtual CORBA::Long
00119 order()
00120 throw(CORBA::SystemException)
00121 {
00122 return ptr_ -> order();
00123 }
00124
00125 virtual CORBA::Double
00126 scale()
00127 throw(CORBA::SystemException)
00128 {
00129 return ptr_ -> scale();
00130 }
00131
00132 virtual CORBA::Long
00133 nrComponents()
00134 throw(CORBA::SystemException)
00135 {
00136 return ptr_ -> nrComponents();
00137 }
00138
00139 virtual CORBA::Boolean
00140 isColor()
00141 throw(CORBA::SystemException)
00142 {
00143 return ptr_ -> isColor();
00144 }
00145
00146 virtual HxCorba::ImageRep_ptr
00147 getLidx(CORBA::Long i)
00148 throw(CORBA::SystemException)
00149 {
00150 return ptr_ -> getLidx(i);
00151 }
00152
00153 virtual HxCorba::ImageRep_ptr
00154 getJidx(CORBA::Long i)
00155 throw(CORBA::SystemException)
00156 {
00157 return ptr_ -> getJidx(i);
00158 }
00159
00160 virtual HxCorba::ImageRep_ptr
00161 getMidx(CORBA::Long i)
00162 throw(CORBA::SystemException)
00163 {
00164 return ptr_ -> getMidx(i);
00165 }
00166
00167 virtual HxCorba::ImageRep_ptr
00168 xy(CORBA::Long x,
00169 CORBA::Long y)
00170 throw(CORBA::SystemException)
00171 {
00172 return ptr_ -> xy(x, y);
00173 }
00174
00175 virtual HxCorba::ImageRep_ptr
00176 xyz(CORBA::Long x,
00177 CORBA::Long y,
00178 CORBA::Long z)
00179 throw(CORBA::SystemException)
00180 {
00181 return ptr_ -> xyz(x, y, z);
00182 }
00183
00184 virtual HxCorba::ImageRep_ptr
00185 xyl(CORBA::Long x,
00186 CORBA::Long y,
00187 CORBA::Long l)
00188 throw(CORBA::SystemException)
00189 {
00190 return ptr_ -> xyl(x, y, l);
00191 }
00192
00193 virtual HxCorba::ImageRep_ptr
00194 xyzl(CORBA::Long x,
00195 CORBA::Long y,
00196 CORBA::Long z,
00197 CORBA::Long l)
00198 throw(CORBA::SystemException)
00199 {
00200 return ptr_ -> xyzl(x, y, z, l);
00201 }
00202
00203 virtual HxCorba::ImageList*
00204 getLList()
00205 throw(CORBA::SystemException)
00206 {
00207 return ptr_ -> getLList();
00208 }
00209
00210 virtual HxCorba::ImageList*
00211 getJList()
00212 throw(CORBA::SystemException)
00213 {
00214 return ptr_ -> getJList();
00215 }
00216
00217 virtual HxCorba::ImageList*
00218 getMList()
00219 throw(CORBA::SystemException)
00220 {
00221 return ptr_ -> getMList();
00222 }
00223
00224 virtual HxCorba::ImageList*
00225 getList()
00226 throw(CORBA::SystemException)
00227 {
00228 return ptr_ -> getList();
00229 }
00230
00231 virtual HxCorba::ImageRep_ptr
00232 getLw()
00233 throw(CORBA::SystemException)
00234 {
00235 return ptr_ -> getLw();
00236 }
00237
00238 virtual HxCorba::ImageRep_ptr
00239 getJw()
00240 throw(CORBA::SystemException)
00241 {
00242 return ptr_ -> getJw();
00243 }
00244
00245 virtual HxCorba::ImageRep_ptr
00246 getMw()
00247 throw(CORBA::SystemException)
00248 {
00249 return ptr_ -> getMw();
00250 }
00251
00252 PortableServer::POA_ptr _default_POA()
00253 {
00254 if(!CORBA::is_nil(poa_))
00255 return PortableServer::POA::_duplicate(poa_);
00256 else
00257 return NJet::_default_POA();
00258 }
00259 };
00260
00261
00262
00263
00264 template<class T>
00265 class NJetFactory_tie : virtual public NJetFactory
00266 {
00267 T* ptr_;
00268 PortableServer::POA_ptr poa_;
00269 CORBA::Boolean rel_;
00270
00271 NJetFactory_tie(const NJetFactory_tie<T>&) { }
00272 void operator=(const NJetFactory_tie<T>&) { }
00273
00274 public:
00275
00276 NJetFactory_tie(T& t)
00277 : ptr_(&t), poa_(PortableServer::POA::_nil()), rel_(false)
00278 {
00279 }
00280
00281 NJetFactory_tie(T& t, PortableServer::POA_ptr poa)
00282 : ptr_(&t), poa_(PortableServer::POA::_duplicate(poa)), rel_(false)
00283 {
00284 }
00285
00286 NJetFactory_tie(T* p, CORBA::Boolean release = true)
00287 : ptr_(p), poa_(PortableServer::POA::_nil()), rel_(release)
00288 {
00289 }
00290
00291 NJetFactory_tie(T* p, PortableServer::POA_ptr poa, CORBA::Boolean release = true)
00292 : ptr_(p), poa_(PortableServer::POA::_duplicate(poa)), rel_(release)
00293 {
00294 }
00295
00296 virtual
00297 ~NJetFactory_tie()
00298 {
00299 if(rel_)
00300 delete ptr_;
00301
00302 CORBA::release(poa_);
00303 }
00304
00305 T*
00306 _tied_object()
00307 {
00308 return ptr_;
00309 }
00310
00311 void
00312 _tied_object(T& obj)
00313 {
00314 if(rel_)
00315 delete ptr_;
00316
00317 ptr_ = &obj;
00318 rel_ = false;
00319 }
00320
00321 void
00322 _tied_object(T* obj, CORBA::Boolean release = true)
00323 {
00324 if(rel_)
00325 delete ptr_;
00326
00327 ptr_ = obj;
00328 rel_ = release;
00329 }
00330
00331 CORBA::Boolean
00332 _is_owner()
00333 {
00334 return rel_;
00335 }
00336
00337 void
00338 _is_owner(CORBA::Boolean b)
00339 {
00340 rel_ = b;
00341 }
00342
00343 virtual HxCorba::NJet_ptr
00344 makeNJet(HxCorba::ImageRep_ptr im,
00345 CORBA::Long N,
00346 CORBA::Double scale,
00347 CORBA::Double precision)
00348 throw(CORBA::SystemException)
00349 {
00350 return ptr_ -> makeNJet(im, N, scale, precision);
00351 }
00352
00353 PortableServer::POA_ptr _default_POA()
00354 {
00355 if(!CORBA::is_nil(poa_))
00356 return PortableServer::POA::_duplicate(poa_);
00357 else
00358 return NJetFactory::_default_POA();
00359 }
00360 };
00361
00362 }
00363
00364 #endif