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