00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ___HxCorbaVxStructure_tie_h__
00016 #define ___HxCorbaVxStructure_tie_h__
00017
00018 #include <HxCorbaVxStructure_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 VxStructure_tie : virtual public VxStructure
00041 {
00042 T* ptr_;
00043 PortableServer::POA_ptr poa_;
00044 CORBA::Boolean rel_;
00045
00046 VxStructure_tie(const VxStructure_tie<T>&) { }
00047 void operator=(const VxStructure_tie<T>&) { }
00048
00049 public:
00050
00051 VxStructure_tie(T& t)
00052 : ptr_(&t), poa_(PortableServer::POA::_nil()), rel_(false)
00053 {
00054 }
00055
00056 VxStructure_tie(T& t, PortableServer::POA_ptr poa)
00057 : ptr_(&t), poa_(PortableServer::POA::_duplicate(poa)), rel_(false)
00058 {
00059 }
00060
00061 VxStructure_tie(T* p, CORBA::Boolean release = true)
00062 : ptr_(p), poa_(PortableServer::POA::_nil()), rel_(release)
00063 {
00064 }
00065
00066 VxStructure_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 ~VxStructure_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::StringSeq*
00119 getLevelNames()
00120 throw(CORBA::SystemException)
00121 {
00122 return ptr_ -> getLevelNames();
00123 }
00124
00125 virtual CORBA::Boolean
00126 exist(const char* levelId)
00127 throw(CORBA::SystemException)
00128 {
00129 return ptr_ -> exist(levelId);
00130 }
00131
00132 virtual CORBA::Long
00133 size(const char* levelId)
00134 throw(CORBA::SystemException)
00135 {
00136 return ptr_ -> size(levelId);
00137 }
00138
00139 virtual CORBA::Boolean
00140 push(const char* level,
00141 HxCorba::VxSegmentation_ptr seg)
00142 throw(CORBA::SystemException)
00143 {
00144 return ptr_ -> push(level, seg);
00145 }
00146
00147 virtual CORBA::Boolean
00148 pushFromFile(const char* level,
00149 const char* filename)
00150 throw(CORBA::SystemException)
00151 {
00152 return ptr_ -> pushFromFile(level, filename);
00153 }
00154
00155 virtual HxCorba::VxSegmentation_ptr
00156 get(const char* levelId)
00157 throw(CORBA::SystemException)
00158 {
00159 return ptr_ -> get(levelId);
00160 }
00161
00162 virtual HxCorba::VxSegment_ptr
00163 getSegment(const char* levelId,
00164 CORBA::Long index)
00165 throw(CORBA::SystemException)
00166 {
00167 return ptr_ -> getSegment(levelId, index);
00168 }
00169
00170 virtual HxCorba::VxSegment_ptr
00171 mapsToSegment(const char* levelId,
00172 CORBA::Long timeSpan)
00173 throw(CORBA::SystemException)
00174 {
00175 return ptr_ -> mapsToSegment(levelId, timeSpan);
00176 }
00177
00178 virtual HxCorba::VxSegmentation_ptr
00179 getFromInterval(const char* levelId,
00180 const HxCorba::VxTimeSpan& timeSpan,
00181 CORBA::Boolean complete)
00182 throw(CORBA::SystemException)
00183 {
00184 return ptr_ -> getFromInterval(levelId, timeSpan, complete);
00185 }
00186
00187 virtual HxCorba::VxSegmentation_ptr
00188 getWhereInt(const char* levelId,
00189 const char* strType,
00190 CORBA::Long val)
00191 throw(CORBA::SystemException)
00192 {
00193 return ptr_ -> getWhereInt(levelId, strType, val);
00194 }
00195
00196 virtual HxCorba::VxSegmentation_ptr
00197 getWhereString(const char* levelId,
00198 const char* strType,
00199 const char* val)
00200 throw(CORBA::SystemException)
00201 {
00202 return ptr_ -> getWhereString(levelId, strType, val);
00203 }
00204
00205 virtual HxCorba::VxSegmentation_ptr
00206 getShots()
00207 throw(CORBA::SystemException)
00208 {
00209 return ptr_ -> getShots();
00210 }
00211
00212 virtual HxCorba::VxSegmentation_ptr
00213 getEffects()
00214 throw(CORBA::SystemException)
00215 {
00216 return ptr_ -> getEffects();
00217 }
00218
00219 virtual CORBA::Long
00220 mapsToIndex(const char* levelId,
00221 const HxCorba::VxTimeSpan& timeSpan)
00222 throw(CORBA::SystemException)
00223 {
00224 return ptr_ -> mapsToIndex(levelId, timeSpan);
00225 }
00226
00227 virtual CORBA::Long
00228 mapsToIndexInt(const char* levelId,
00229 CORBA::Long timeSpan)
00230 throw(CORBA::SystemException)
00231 {
00232 return ptr_ -> mapsToIndexInt(levelId, timeSpan);
00233 }
00234
00235 virtual HxCorba::LongSeq*
00236 getSegmentBoundaries(const char* levelId,
00237 const HxCorba::VxTimeSpan& timeSpan)
00238 throw(CORBA::SystemException)
00239 {
00240 return ptr_ -> getSegmentBoundaries(levelId, timeSpan);
00241 }
00242
00243 virtual CORBA::Boolean
00244 isContinuous(const char* levelId)
00245 throw(CORBA::SystemException)
00246 {
00247 return ptr_ -> isContinuous(levelId);
00248 }
00249
00250 virtual CORBA::Boolean
00251 isSequential(const char* levelId)
00252 throw(CORBA::SystemException)
00253 {
00254 return ptr_ -> isSequential(levelId);
00255 }
00256
00257 virtual CORBA::Boolean
00258 isParentOf(const char* levelId1,
00259 const char* levelId2)
00260 throw(CORBA::SystemException)
00261 {
00262 return ptr_ -> isParentOf(levelId1, levelId2);
00263 }
00264
00265 virtual CORBA::Boolean
00266 isChildOf(const char* levelId1,
00267 const char* levelId2)
00268 throw(CORBA::SystemException)
00269 {
00270 return ptr_ -> isChildOf(levelId1, levelId2);
00271 }
00272
00273 virtual HxCorba::VxStructureEval
00274 compare(const char* levelId,
00275 HxCorba::VxSegmentation_ptr foundTruth)
00276 throw(CORBA::SystemException)
00277 {
00278 return ptr_ -> compare(levelId, foundTruth);
00279 }
00280
00281 PortableServer::POA_ptr _default_POA()
00282 {
00283 if(!CORBA::is_nil(poa_))
00284 return PortableServer::POA::_duplicate(poa_);
00285 else
00286 return VxStructure::_default_POA();
00287 }
00288 };
00289
00290
00291
00292
00293 template<class T>
00294 class VxStructureFactory_tie : virtual public VxStructureFactory
00295 {
00296 T* ptr_;
00297 PortableServer::POA_ptr poa_;
00298 CORBA::Boolean rel_;
00299
00300 VxStructureFactory_tie(const VxStructureFactory_tie<T>&) { }
00301 void operator=(const VxStructureFactory_tie<T>&) { }
00302
00303 public:
00304
00305 VxStructureFactory_tie(T& t)
00306 : ptr_(&t), poa_(PortableServer::POA::_nil()), rel_(false)
00307 {
00308 }
00309
00310 VxStructureFactory_tie(T& t, PortableServer::POA_ptr poa)
00311 : ptr_(&t), poa_(PortableServer::POA::_duplicate(poa)), rel_(false)
00312 {
00313 }
00314
00315 VxStructureFactory_tie(T* p, CORBA::Boolean release = true)
00316 : ptr_(p), poa_(PortableServer::POA::_nil()), rel_(release)
00317 {
00318 }
00319
00320 VxStructureFactory_tie(T* p, PortableServer::POA_ptr poa, CORBA::Boolean release = true)
00321 : ptr_(p), poa_(PortableServer::POA::_duplicate(poa)), rel_(release)
00322 {
00323 }
00324
00325 virtual
00326 ~VxStructureFactory_tie()
00327 {
00328 if(rel_)
00329 delete ptr_;
00330
00331 CORBA::release(poa_);
00332 }
00333
00334 T*
00335 _tied_object()
00336 {
00337 return ptr_;
00338 }
00339
00340 void
00341 _tied_object(T& obj)
00342 {
00343 if(rel_)
00344 delete ptr_;
00345
00346 ptr_ = &obj;
00347 rel_ = false;
00348 }
00349
00350 void
00351 _tied_object(T* obj, CORBA::Boolean release = true)
00352 {
00353 if(rel_)
00354 delete ptr_;
00355
00356 ptr_ = obj;
00357 rel_ = release;
00358 }
00359
00360 CORBA::Boolean
00361 _is_owner()
00362 {
00363 return rel_;
00364 }
00365
00366 void
00367 _is_owner(CORBA::Boolean b)
00368 {
00369 rel_ = b;
00370 }
00371
00372 virtual HxCorba::VxStructure_ptr
00373 makeVxStructure(const char* base,
00374 const HxCorba::StringSeq& extLevels)
00375 throw(CORBA::SystemException)
00376 {
00377 return ptr_ -> makeVxStructure(base, extLevels);
00378 }
00379
00380 PortableServer::POA_ptr _default_POA()
00381 {
00382 if(!CORBA::is_nil(poa_))
00383 return PortableServer::POA::_duplicate(poa_);
00384 else
00385 return VxStructureFactory::_default_POA();
00386 }
00387 };
00388
00389 }
00390
00391 #endif