00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ___HxCorbaRgbBuffer_tie_h__
00016 #define ___HxCorbaRgbBuffer_tie_h__
00017
00018 #include <HxCorbaRgbBuffer_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 RgbBuffer_tie : virtual public RgbBuffer
00041 {
00042 T* ptr_;
00043 PortableServer::POA_ptr poa_;
00044 CORBA::Boolean rel_;
00045
00046 RgbBuffer_tie(const RgbBuffer_tie<T>&) { }
00047 void operator=(const RgbBuffer_tie<T>&) { }
00048
00049 public:
00050
00051 RgbBuffer_tie(T& t)
00052 : ptr_(&t), poa_(PortableServer::POA::_nil()), rel_(false)
00053 {
00054 }
00055
00056 RgbBuffer_tie(T& t, PortableServer::POA_ptr poa)
00057 : ptr_(&t), poa_(PortableServer::POA::_duplicate(poa)), rel_(false)
00058 {
00059 }
00060
00061 RgbBuffer_tie(T* p, CORBA::Boolean release = true)
00062 : ptr_(p), poa_(PortableServer::POA::_nil()), rel_(release)
00063 {
00064 }
00065
00066 RgbBuffer_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 ~RgbBuffer_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 size()
00120 throw(CORBA::SystemException)
00121 {
00122 return ptr_ -> size();
00123 }
00124
00125 virtual HxCorba::RgbSeq*
00126 getRgb()
00127 throw(CORBA::SystemException)
00128 {
00129 return ptr_ -> getRgb();
00130 }
00131
00132 virtual void
00133 setRgb(const HxCorba::RgbSeq& pixels)
00134 throw(CORBA::SystemException)
00135 {
00136 ptr_ -> setRgb(pixels);
00137 }
00138
00139 PortableServer::POA_ptr _default_POA()
00140 {
00141 if(!CORBA::is_nil(poa_))
00142 return PortableServer::POA::_duplicate(poa_);
00143 else
00144 return RgbBuffer::_default_POA();
00145 }
00146 };
00147
00148
00149
00150
00151 template<class T>
00152 class RgbBufferFactory_tie : virtual public RgbBufferFactory
00153 {
00154 T* ptr_;
00155 PortableServer::POA_ptr poa_;
00156 CORBA::Boolean rel_;
00157
00158 RgbBufferFactory_tie(const RgbBufferFactory_tie<T>&) { }
00159 void operator=(const RgbBufferFactory_tie<T>&) { }
00160
00161 public:
00162
00163 RgbBufferFactory_tie(T& t)
00164 : ptr_(&t), poa_(PortableServer::POA::_nil()), rel_(false)
00165 {
00166 }
00167
00168 RgbBufferFactory_tie(T& t, PortableServer::POA_ptr poa)
00169 : ptr_(&t), poa_(PortableServer::POA::_duplicate(poa)), rel_(false)
00170 {
00171 }
00172
00173 RgbBufferFactory_tie(T* p, CORBA::Boolean release = true)
00174 : ptr_(p), poa_(PortableServer::POA::_nil()), rel_(release)
00175 {
00176 }
00177
00178 RgbBufferFactory_tie(T* p, PortableServer::POA_ptr poa, CORBA::Boolean release = true)
00179 : ptr_(p), poa_(PortableServer::POA::_duplicate(poa)), rel_(release)
00180 {
00181 }
00182
00183 virtual
00184 ~RgbBufferFactory_tie()
00185 {
00186 if(rel_)
00187 delete ptr_;
00188
00189 CORBA::release(poa_);
00190 }
00191
00192 T*
00193 _tied_object()
00194 {
00195 return ptr_;
00196 }
00197
00198 void
00199 _tied_object(T& obj)
00200 {
00201 if(rel_)
00202 delete ptr_;
00203
00204 ptr_ = &obj;
00205 rel_ = false;
00206 }
00207
00208 void
00209 _tied_object(T* obj, CORBA::Boolean release = true)
00210 {
00211 if(rel_)
00212 delete ptr_;
00213
00214 ptr_ = obj;
00215 rel_ = release;
00216 }
00217
00218 CORBA::Boolean
00219 _is_owner()
00220 {
00221 return rel_;
00222 }
00223
00224 void
00225 _is_owner(CORBA::Boolean b)
00226 {
00227 rel_ = b;
00228 }
00229
00230 virtual HxCorba::RgbBuffer_ptr
00231 createRgbBuffer(CORBA::Long size)
00232 throw(CORBA::SystemException)
00233 {
00234 return ptr_ -> createRgbBuffer(size);
00235 }
00236
00237 PortableServer::POA_ptr _default_POA()
00238 {
00239 if(!CORBA::is_nil(poa_))
00240 return PortableServer::POA::_duplicate(poa_);
00241 else
00242 return RgbBufferFactory::_default_POA();
00243 }
00244 };
00245
00246
00247
00248
00249 template<class T>
00250 class RgbSource_tie : virtual public RgbSource
00251 {
00252 T* ptr_;
00253 PortableServer::POA_ptr poa_;
00254 CORBA::Boolean rel_;
00255
00256 RgbSource_tie(const RgbSource_tie<T>&) { }
00257 void operator=(const RgbSource_tie<T>&) { }
00258
00259 public:
00260
00261 RgbSource_tie(T& t)
00262 : ptr_(&t), poa_(PortableServer::POA::_nil()), rel_(false)
00263 {
00264 }
00265
00266 RgbSource_tie(T& t, PortableServer::POA_ptr poa)
00267 : ptr_(&t), poa_(PortableServer::POA::_duplicate(poa)), rel_(false)
00268 {
00269 }
00270
00271 RgbSource_tie(T* p, CORBA::Boolean release = true)
00272 : ptr_(p), poa_(PortableServer::POA::_nil()), rel_(release)
00273 {
00274 }
00275
00276 RgbSource_tie(T* p, PortableServer::POA_ptr poa, CORBA::Boolean release = true)
00277 : ptr_(p), poa_(PortableServer::POA::_duplicate(poa)), rel_(release)
00278 {
00279 }
00280
00281 virtual
00282 ~RgbSource_tie()
00283 {
00284 if(rel_)
00285 delete ptr_;
00286
00287 CORBA::release(poa_);
00288 }
00289
00290 T*
00291 _tied_object()
00292 {
00293 return ptr_;
00294 }
00295
00296 void
00297 _tied_object(T& obj)
00298 {
00299 if(rel_)
00300 delete ptr_;
00301
00302 ptr_ = &obj;
00303 rel_ = false;
00304 }
00305
00306 void
00307 _tied_object(T* obj, CORBA::Boolean release = true)
00308 {
00309 if(rel_)
00310 delete ptr_;
00311
00312 ptr_ = obj;
00313 rel_ = release;
00314 }
00315
00316 CORBA::Boolean
00317 _is_owner()
00318 {
00319 return rel_;
00320 }
00321
00322 void
00323 _is_owner(CORBA::Boolean b)
00324 {
00325 rel_ = b;
00326 }
00327
00328 virtual HxCorba::RgbSeq*
00329 getRgb()
00330 throw(CORBA::SystemException)
00331 {
00332 return ptr_ -> getRgb();
00333 }
00334
00335 virtual void
00336 fillRgb(HxCorba::RgbBuffer_ptr buffer)
00337 throw(CORBA::SystemException)
00338 {
00339 ptr_ -> fillRgb(buffer);
00340 }
00341
00342 PortableServer::POA_ptr _default_POA()
00343 {
00344 if(!CORBA::is_nil(poa_))
00345 return PortableServer::POA::_duplicate(poa_);
00346 else
00347 return RgbSource::_default_POA();
00348 }
00349 };
00350
00351 }
00352
00353 #endif