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