MeshKit
1.0
|
00001 #ifndef MESHKIT_ITAPS_REL_HPP 00002 #define MESHKIT_ITAPS_REL_HPP 00003 00007 #include "iRel.h" 00008 #include <string.h> 00009 #include <stdlib.h> 00010 #include <vector> 00011 #include <limits> 00012 #include <string> 00013 #include <algorithm> 00014 #include "assert.h" 00015 00016 #define IRELI irelInstance->mInstance 00017 00018 typedef void* iBase_Instance; 00019 00032 class iRel { 00033 public: 00034 typedef iBase_ErrorType Error; 00035 00036 iRel( const char* options = 0 ); 00037 iRel( iRel_Instance instance ); 00038 00039 ~iRel(); 00040 00041 iRel_Instance instance() { return mInstance; } 00042 00043 enum IfaceType 00044 {IGEOM_IFACE = 0, 00045 IMESH_IFACE, 00046 IFIELD_IFACE, 00047 IREL_IFACE, 00048 FBIGEOM_IFACE}; 00049 00050 00051 enum RelationType 00052 {ENTITY = 0, 00053 SET, 00054 BOTH}; 00055 00056 enum RelationStatus 00057 {ACTIVE = 0, 00058 INACTIVE, 00059 NOTEXIST}; 00060 00061 inline iRel::IfaceType iface_type() const { 00062 return iRel::IREL_IFACE; 00063 } 00064 00070 class PairHandle 00071 { 00072 public: 00073 PairHandle(iRel *instance, 00074 iBase_Instance iface1 = NULL, 00075 RelationType rtype1 = ENTITY, 00076 IfaceType itype1 = IREL_IFACE, 00077 RelationStatus status1 = ACTIVE, 00078 iBase_Instance iface2 = NULL, 00079 RelationType rtype2 = ENTITY, 00080 IfaceType itype2 = IREL_IFACE, 00081 RelationStatus status2 = ACTIVE); 00082 00083 PairHandle(iRel *instance, iRel_PairHandle ph); 00084 00085 iRel_PairHandle instance() { return irelPair; } 00086 00087 ~PairHandle(); 00088 00089 friend class iRel; 00090 00091 iBase_Instance get_iface(int i); 00092 00093 IfaceType get_iface_type(int i); 00094 RelationType get_rel_type(int i); 00095 00096 Error changeType (RelationType ent_or_set1, 00097 RelationType ent_or_set2); 00098 00099 Error setEntEntRelation ( 00100 /*in*/ iBase_EntityHandle ent1, 00101 /*in*/ iBase_EntityHandle ent2); 00102 Error setEntSetRelation ( 00103 /*in*/ iBase_EntityHandle ent1, 00104 /*in*/ iBase_EntitySetHandle entset2); 00105 Error setSetEntRelation ( 00106 /*in*/ iBase_EntitySetHandle entset1, 00107 /*in*/ iBase_EntityHandle ent2); 00108 Error setSetSetRelation ( 00109 /*in*/ iBase_EntitySetHandle entset1, 00110 /*in*/ iBase_EntitySetHandle entset2); 00111 00112 Error setEntArrEntArrRelation ( 00113 /*in*/ iBase_EntityHandle *ent_array_1, 00114 /*in*/ int num_ent1, 00115 /*in*/ iBase_EntityHandle *ent_array_2, 00116 /*in*/ int num_ent2); 00117 Error setSetArrEntArrRelation ( 00118 /*in*/ iBase_EntitySetHandle *entset_array_1, 00119 /*in*/ int num_ent1, 00120 /*in*/ iBase_EntityHandle *ent_array_2, 00121 /*in*/ int num_ent2); 00122 Error setEntArrSetArrRelation ( 00123 /*in*/ iBase_EntityHandle *ent_array_1, 00124 /*in*/ int num_ent1, 00125 /*in*/ iBase_EntitySetHandle *entset_array_2, 00126 /*in*/ int num_ent2); 00127 Error setSetArrSetArrRelation ( 00128 /*in*/ iBase_EntitySetHandle *entset_array_1, 00129 /*in*/ int num_ent1, 00130 /*in*/ iBase_EntitySetHandle *entset_array_2, 00131 /*in*/ int num_ent2); 00132 00133 Error getEntEntRelation ( 00134 /*in*/ iBase_EntityHandle ent1, 00135 /*in*/ bool switch_order, 00136 /*out*/ iBase_EntityHandle &ent2); 00137 Error getEntSetRelation ( 00138 /*in*/ iBase_EntityHandle ent1, 00139 /*in*/ bool switch_order, 00140 /*out*/ iBase_EntitySetHandle &entset2); 00141 Error getSetEntRelation ( 00142 /*in*/ iBase_EntitySetHandle entset1, 00143 /*in*/ bool switch_order, 00144 /*out*/ iBase_EntityHandle &ent2); 00145 Error getSetSetRelation ( 00146 /*in*/ iBase_EntitySetHandle entset1, 00147 /*in*/ bool switch_order, 00148 /*out*/ iBase_EntitySetHandle &entset2); 00149 Error getEntSetIterRelation ( 00150 /*in*/ iBase_EntityHandle ent1, 00151 /*in*/ bool switch_order, 00152 /*out*/ iBase_EntityIterator &entset2); 00153 00154 Error getEntArrEntArrRelation ( 00155 /*in*/ iBase_EntityHandle *ent_array_1, 00156 /*in*/ int ent_array_1_size, 00157 /*in*/ bool switch_order, 00158 /*inout*/ std::vector<iBase_EntityHandle> &ent_array_2); 00159 Error getEntArrSetArrRelation ( 00160 /*in*/ iBase_EntityHandle *ent_array_1, 00161 /*in*/ int ent_array_1_size, 00162 /*in*/ bool switch_order, 00163 /*inout*/ std::vector<iBase_EntitySetHandle> &entset_array_2); 00164 Error getSetArrEntArrRelation ( 00165 /*in*/ iBase_EntitySetHandle *entset_array_1, 00166 /*in*/ int entset_array_1_size, 00167 /*in*/ bool switch_order, 00168 /*inout*/ std::vector<iBase_EntityHandle> &ent_array_2); 00169 Error getSetArrSetArrRelation ( 00170 /*in*/ iBase_EntitySetHandle *entset_array_1, 00171 /*in*/ int entset_array_1_size, 00172 /*in*/ bool switch_order, 00173 /*inout*/ std::vector<iBase_EntitySetHandle> &entset_array_2); 00174 Error getEntArrSetIterArrRelation ( 00175 /*in*/ iBase_EntityHandle *ent_array_1, 00176 /*in*/ int ent_array_1_size, 00177 /*in*/ bool switch_order, 00178 /*inout*/ std::vector<iBase_EntityIterator> &entiter); 00179 00180 Error inferAllRelations (); 00181 00182 Error inferAllRelationsAndType (); 00183 00184 Error inferEntRelations ( 00185 /*in*/ iBase_EntityHandle entity, 00186 /*in*/ int iface_no); 00187 Error inferSetRelations ( 00188 /*in*/ iBase_EntitySetHandle entity_set, 00189 /*in*/ int iface_no); 00190 00191 Error inferEntArrRelations ( 00192 /*in*/ iBase_EntityHandle *entities, 00193 /*in*/ int entities_size, 00194 /*in*/ int iface_no); 00195 Error inferSetArrRelations ( 00196 /*in*/ iBase_EntitySetHandle *entity_sets, 00197 /*in*/ int entities_size, 00198 /*in*/ int iface_no); 00199 00200 private: 00201 iRel *irelInstance; 00202 iBase_Instance iFaces[2]; 00203 IfaceType iFaceTypes[2]; 00204 RelationType relTypes[2]; 00205 RelationStatus relStatuses[2]; 00206 00207 iRel_PairHandle irelPair; 00208 00209 bool pairOwner; 00210 }; 00211 00212 Error getErrorType(); 00213 00214 std::string getDescription(); 00215 00216 Error createPair ( 00217 /*in*/ iBase_Instance iface1, 00218 /*in*/ const RelationType ent_or_set1, 00219 /*in*/ const IfaceType iface_type1, 00220 /*in*/ const RelationStatus status1, 00221 /*in*/ iBase_Instance iface2, 00222 /*in*/ const RelationType ent_or_set2, 00223 /*in*/ const IfaceType iface_type2, 00224 /*in*/ const RelationStatus status2, 00225 /*out*/ PairHandle *&pair); 00226 00227 template<typename T, typename U> 00228 Error createPair ( 00229 /*in*/ T &iface1, 00230 /*in*/ const RelationType ent_or_set1, 00231 /*in*/ const RelationStatus status1, 00232 /*in*/ U &iface2, 00233 /*in*/ const RelationType ent_or_set2, 00234 /*in*/ const RelationStatus status2, 00235 /*out*/ PairHandle *&pair); 00236 00237 Error findPairs ( 00238 /*in*/ iBase_Instance iface, 00239 /*inout*/ std::vector<PairHandle *> &pairs); 00240 00241 protected: 00242 00243 Error add_pair(PairHandle *pair); 00244 00245 Error remove_pair(PairHandle *pair); 00246 00247 private: 00248 iRel_Instance mInstance; 00249 00250 bool iRelInstanceOwner; 00251 00252 std::vector<PairHandle*> relPairs; 00253 00254 // prohibit copying 00255 iRel( const iRel& ) {} 00256 void operator=(const iRel&) {} 00257 }; 00258 00259 inline 00260 iRel::iRel( const char* options ) 00261 : iRelInstanceOwner(true) 00262 { 00263 int err, len = options ? strlen(options) : 0; 00264 iRel_create( options, &mInstance, &err, len ); 00265 if (iBase_SUCCESS != err) { 00266 mInstance = 0; 00267 iRelInstanceOwner = false; 00268 } 00269 } 00270 00271 inline 00272 iRel::iRel( iRel_Instance instance ) 00273 : iRelInstanceOwner(false) 00274 { 00275 mInstance = instance; 00276 } 00277 00278 inline iRel::~iRel() 00279 { 00280 if (iRelInstanceOwner) { 00281 int err; 00282 iRel_destroy( mInstance, &err ); 00283 } 00284 } 00285 00286 inline iRel::Error iRel::getErrorType() 00287 { 00288 int err; 00289 iRel_getErrorType(mInstance, &err ); 00290 return (Error)err; 00291 } 00292 00293 inline std::string iRel::getDescription() 00294 { 00295 std::vector<char> buffer(1024); 00296 iRel_getDescription(mInstance, &buffer[0], buffer.size() ); 00297 return std::string(&buffer[0]); 00298 } 00299 00300 inline iRel::Error iRel::createPair ( 00301 /*in*/ iBase_Instance iface1, 00302 /*in*/ const RelationType ent_or_set1, 00303 /*in*/ const IfaceType iface_type1, 00304 /*in*/ const RelationStatus status1, 00305 /*in*/ iBase_Instance iface2, 00306 /*in*/ const RelationType ent_or_set2, 00307 /*in*/ const IfaceType iface_type2, 00308 /*in*/ const RelationStatus status2, 00309 /*out*/ PairHandle *&pair) 00310 { 00311 pair = new PairHandle(this, iface1, ent_or_set1, iface_type1, status1, 00312 iface2, ent_or_set2, iface_type2, status2); 00313 return (Error)iBase_SUCCESS; 00314 } 00315 00316 template<typename T, typename U> 00317 inline iRel::Error iRel::createPair ( 00318 /*in*/ T &iface1, 00319 /*in*/ const RelationType ent_or_set1, 00320 /*in*/ const RelationStatus status1, 00321 /*in*/ U &iface2, 00322 /*in*/ const RelationType ent_or_set2, 00323 /*in*/ const RelationStatus status2, 00324 /*out*/ PairHandle *&pair) 00325 { 00326 pair = new PairHandle(this, iface1.instance(), ent_or_set1, 00327 iface1.iface_type(), status1, 00328 iface2.instance(), ent_or_set2, 00329 iface2.iface_type(), status2); 00330 return (Error)iBase_SUCCESS; 00331 } 00332 00333 00334 inline iRel::Error iRel::findPairs ( 00335 /*in*/ iBase_Instance iface, 00336 /*inout*/ std::vector<PairHandle *> &pairs) 00337 { 00338 for (std::vector<PairHandle*>::iterator vit = relPairs.begin(); vit != relPairs.end(); vit++) { 00339 if ((*vit)->iFaces[0] == iface || (*vit)->iFaces[1] == iface) 00340 pairs.push_back(*vit); 00341 } 00342 00343 return (Error)iBase_SUCCESS; 00344 } 00345 00346 inline iRel::Error iRel::add_pair(PairHandle *pair) 00347 { 00348 assert(std::find(relPairs.begin(), relPairs.end(), pair) == relPairs.end()); 00349 relPairs.push_back(pair); 00350 return (Error)iBase_SUCCESS; 00351 } 00352 00353 inline iRel::Error iRel::remove_pair(PairHandle *pair) 00354 { 00355 std::vector<PairHandle*>::iterator vit = std::find(relPairs.begin(), relPairs.end(), pair); 00356 if (vit == relPairs.end()) return (Error)iBase_FAILURE; 00357 else relPairs.erase(vit); 00358 return (Error)iBase_SUCCESS; 00359 } 00360 00361 inline iRel::PairHandle::PairHandle(iRel *instance, 00362 iBase_Instance iface1, 00363 RelationType rtype1, 00364 IfaceType itype1, 00365 RelationStatus status1, 00366 iBase_Instance iface2, 00367 RelationType rtype2, 00368 IfaceType itype2, 00369 RelationStatus status2) 00370 : irelInstance(instance), 00371 pairOwner(true) 00372 { 00373 iFaces[0] = iface1; 00374 iFaces[1] = iface2; 00375 iFaceTypes[0] = itype1; 00376 iFaceTypes[1] = itype2; 00377 relTypes[0] = rtype1; 00378 relTypes[1] = rtype2; 00379 relStatuses[0] = status1; 00380 relStatuses[1] = status2; 00381 00382 int err; 00383 iRel_createPair(IRELI, iface1, rtype1, itype1, status1, iface2, rtype2, 00384 itype2, status2, &irelPair, &err); 00385 instance->add_pair(this); 00386 } 00387 00388 inline iRel::PairHandle::PairHandle(iRel *instance, iRel_PairHandle ph) 00389 : irelInstance(instance), pairOwner(false) 00390 { 00391 int err; 00392 int rtype1, rtype2, itype1, itype2, status1, status2; 00393 iRel_getPairInfo(IRELI, ph, iFaces, &rtype1, &itype1, &status1, 00394 iFaces+1, &rtype2, &itype2, &status2, &err); 00395 if (iBase_SUCCESS == err) { 00396 iFaceTypes[0] = (IfaceType)itype1; 00397 iFaceTypes[1] = (IfaceType)itype2; 00398 relTypes[0] = (RelationType)rtype1; 00399 relTypes[1] = (RelationType)rtype2; 00400 relStatuses[0] = (RelationStatus)status1; 00401 relStatuses[1] = (RelationStatus)status2; 00402 } 00403 00404 instance->add_pair(this); 00405 } 00406 00407 inline iRel::PairHandle::~PairHandle() 00408 { 00409 irelInstance->remove_pair(this); 00410 00411 if (pairOwner) { 00412 int err; 00413 iRel_destroyPair(IRELI, irelPair, &err); 00414 } 00415 } 00416 00417 inline iBase_Instance iRel::PairHandle::get_iface(int i) 00418 { 00419 assert(i == 0 || i == 1); 00420 return iFaces[i]; 00421 } 00422 00423 inline iRel::IfaceType iRel::PairHandle::get_iface_type(int i) 00424 { 00425 assert(i == 0 || i == 1); 00426 return iFaceTypes[i]; 00427 } 00428 00429 inline iRel::RelationType iRel::PairHandle::get_rel_type(int i) 00430 { 00431 assert(i == 0 || i == 1); 00432 return relTypes[i]; 00433 } 00434 00435 inline iRel::Error iRel::PairHandle::changeType (RelationType ent_or_set1, 00436 RelationType ent_or_set2) 00437 { 00438 int err; 00439 iRel_changePairType(IRELI, irelPair, ent_or_set1, ent_or_set2, &err); 00440 return (Error)err; 00441 } 00442 00443 inline iRel::Error iRel::PairHandle::setEntEntRelation ( 00444 /*in*/ iBase_EntityHandle ent1, 00445 /*in*/ iBase_EntityHandle ent2) 00446 { 00447 int err; 00448 iRel_setEntEntRelation (IRELI, irelPair, ent1, ent2, &err); 00449 return (Error)err; 00450 } 00451 00452 inline iRel::Error iRel::PairHandle::setEntSetRelation ( 00453 /*in*/ iBase_EntityHandle ent1, 00454 /*in*/ iBase_EntitySetHandle entset2) 00455 { 00456 int err; 00457 iRel_setEntSetRelation (IRELI, irelPair, ent1, entset2, &err); 00458 return (Error)err; 00459 00460 } 00461 inline iRel::Error iRel::PairHandle::setSetEntRelation ( 00462 /*in*/ iBase_EntitySetHandle entset1, 00463 /*in*/ iBase_EntityHandle ent2) 00464 { 00465 int err; 00466 iRel_setSetEntRelation (IRELI, irelPair, entset1, ent2, &err); 00467 return (Error)err; 00468 } 00469 00470 inline iRel::Error iRel::PairHandle::setSetSetRelation ( 00471 /*in*/ iBase_EntitySetHandle entset1, 00472 /*in*/ iBase_EntitySetHandle entset2) 00473 { 00474 int err; 00475 iRel_setSetSetRelation (IRELI, irelPair, entset1, entset2, &err); 00476 return (Error)err; 00477 } 00478 00479 inline iRel::Error iRel::PairHandle::setEntArrEntArrRelation ( 00480 /*in*/ iBase_EntityHandle *ent_array_1, 00481 /*in*/ int num_ent1, 00482 /*in*/ iBase_EntityHandle *ent_array_2, 00483 /*in*/ int num_ent2) 00484 { 00485 int err; 00486 iRel_setEntArrEntArrRelation (IRELI, irelPair, ent_array_1, num_ent1, ent_array_2, num_ent2, &err); 00487 return (Error)err; 00488 } 00489 00490 inline iRel::Error iRel::PairHandle::setSetArrEntArrRelation ( 00491 /*in*/ iBase_EntitySetHandle *entset_array_1, 00492 /*in*/ int num_ent1, 00493 /*in*/ iBase_EntityHandle *ent_array_2, 00494 /*in*/ int num_ent2) 00495 { 00496 int err; 00497 iRel_setSetArrEntArrRelation (IRELI, irelPair, entset_array_1, num_ent1, ent_array_2, num_ent2, &err); 00498 return (Error)err; 00499 } 00500 00501 inline iRel::Error iRel::PairHandle::setEntArrSetArrRelation ( 00502 /*in*/ iBase_EntityHandle *ent_array_1, 00503 /*in*/ int num_ent1, 00504 /*in*/ iBase_EntitySetHandle *entset_array_2, 00505 /*in*/ int num_ent2) 00506 { 00507 int err; 00508 iRel_setEntArrSetArrRelation (IRELI, irelPair, ent_array_1, num_ent1, entset_array_2, num_ent2, &err); 00509 return (Error)err; 00510 } 00511 00512 inline iRel::Error iRel::PairHandle::setSetArrSetArrRelation ( 00513 /*in*/ iBase_EntitySetHandle *entset_array_1, 00514 /*in*/ int num_ent1, 00515 /*in*/ iBase_EntitySetHandle *entset_array_2, 00516 /*in*/ int num_ent2) 00517 { 00518 int err; 00519 iRel_setSetArrSetArrRelation (IRELI, irelPair, 00520 /*in*/ entset_array_1, num_ent1, entset_array_2, num_ent2, &err); 00521 return (Error)err; 00522 } 00523 00524 00525 inline iRel::Error iRel::PairHandle::getEntEntRelation ( 00526 /*in*/ iBase_EntityHandle ent1, 00527 /*in*/ bool switch_order, 00528 /*out*/ iBase_EntityHandle &ent2) 00529 { 00530 int err; 00531 iRel_getEntEntRelation (IRELI, irelPair, ent1, switch_order, &ent2, &err); 00532 return (Error)err; 00533 } 00534 00535 inline iRel::Error iRel::PairHandle::getEntSetRelation ( 00536 /*in*/ iBase_EntityHandle ent1, 00537 /*in*/ bool switch_order, 00538 /*out*/ iBase_EntitySetHandle &entset2) 00539 { 00540 int err; 00541 iRel_getEntSetRelation (IRELI, irelPair, ent1, switch_order, &entset2, &err); 00542 return (Error)err; 00543 } 00544 00545 inline iRel::Error iRel::PairHandle::getSetEntRelation ( 00546 /*in*/ iBase_EntitySetHandle entset1, 00547 /*in*/ bool switch_order, 00548 /*out*/ iBase_EntityHandle &ent2) 00549 { 00550 int err; 00551 iRel_getSetEntRelation (IRELI, irelPair, entset1, switch_order, &ent2, &err); 00552 return (Error)err; 00553 } 00554 00555 inline iRel::Error iRel::PairHandle::getSetSetRelation ( 00556 /*in*/ iBase_EntitySetHandle entset1, 00557 /*in*/ bool switch_order, 00558 /*out*/ iBase_EntitySetHandle &entset2) 00559 { 00560 int err; 00561 iRel_getSetSetRelation (IRELI, irelPair, entset1, switch_order, &entset2, &err); 00562 return (Error)err; 00563 } 00564 00565 inline iRel::Error iRel::PairHandle::getEntSetIterRelation ( 00566 /*in*/ iBase_EntityHandle ent1, 00567 /*in*/ bool switch_order, 00568 /*out*/ iBase_EntityIterator &entset2) 00569 { 00570 int err; 00571 iRel_getEntSetIterRelation (IRELI, irelPair, ent1, switch_order, &entset2, &err); 00572 return (Error)err; 00573 } 00574 00575 inline iRel::Error iRel::PairHandle::getEntArrEntArrRelation ( 00576 /*in*/ iBase_EntityHandle *ent_array_1, 00577 /*in*/ int ent_array_1_size, 00578 /*in*/ bool switch_order, 00579 /*inout*/ std::vector<iBase_EntityHandle> &ent_array_2) 00580 { 00581 int err; 00582 int dum1 = 0, dum2; 00583 iBase_EntityHandle *dum_ptr = NULL; 00584 iRel_getEntArrEntArrRelation (IRELI, irelPair, ent_array_1, ent_array_1_size, switch_order, 00585 &dum_ptr, &dum1, &dum2, &err); 00586 if (iBase_SUCCESS == err) { 00587 ent_array_2.resize(dum1); 00588 memcpy(&ent_array_2[0], dum_ptr, dum1*sizeof(iBase_EntityHandle)); 00589 } 00590 return (Error)err; 00591 00592 } 00593 inline iRel::Error iRel::PairHandle::getEntArrSetArrRelation ( 00594 /*in*/ iBase_EntityHandle *ent_array_1, 00595 /*in*/ int ent_array_1_size, 00596 /*in*/ bool switch_order, 00597 /*inout*/ std::vector<iBase_EntitySetHandle> &entset_array_2) 00598 { 00599 int err; 00600 int dum1 = 0, dum2; 00601 iBase_EntitySetHandle *dum_ptr = NULL; 00602 iRel_getEntArrSetArrRelation (IRELI, irelPair, ent_array_1, ent_array_1_size, switch_order, 00603 &dum_ptr, &dum1, &dum2, &err); 00604 if (iBase_SUCCESS == err) { 00605 entset_array_2.resize(dum1); 00606 memcpy(&entset_array_2[0], dum_ptr, dum1*sizeof(iBase_EntitySetHandle)); 00607 } 00608 return (Error)err; 00609 00610 } 00611 inline iRel::Error iRel::PairHandle::getSetArrEntArrRelation ( 00612 /*in*/ iBase_EntitySetHandle *entset_array_1, 00613 /*in*/ int entset_array_1_size, 00614 /*in*/ bool switch_order, 00615 /*inout*/ std::vector<iBase_EntityHandle> &ent_array_2) 00616 { 00617 int err; 00618 int dum1 = 0, dum2; 00619 iBase_EntityHandle *dum_ptr = NULL; 00620 iRel_getSetArrEntArrRelation (IRELI, irelPair, entset_array_1, entset_array_1_size, switch_order, 00621 &dum_ptr, &dum1, &dum2, &err); 00622 if (iBase_SUCCESS == err) { 00623 ent_array_2.resize(dum1); 00624 memcpy(&ent_array_2[0], dum_ptr, dum1*sizeof(iBase_EntityHandle)); 00625 } 00626 return (Error)err; 00627 00628 } 00629 inline iRel::Error iRel::PairHandle::getSetArrSetArrRelation ( 00630 /*in*/ iBase_EntitySetHandle *entset_array_1, 00631 /*in*/ int entset_array_1_size, 00632 /*in*/ bool switch_order, 00633 /*inout*/ std::vector<iBase_EntitySetHandle> &entset_array_2) 00634 { 00635 int err; 00636 int dum1 = 0, dum2; 00637 iBase_EntitySetHandle *dum_ptr = NULL; 00638 iRel_getSetArrSetArrRelation (IRELI, irelPair, entset_array_1, entset_array_1_size, switch_order, 00639 &dum_ptr, &dum1, &dum2, &err); 00640 if (iBase_SUCCESS == err) { 00641 entset_array_2.resize(dum1); 00642 memcpy(&entset_array_2[0], dum_ptr, dum1*sizeof(iBase_EntitySetHandle)); 00643 } 00644 return (Error)err; 00645 00646 } 00647 inline iRel::Error iRel::PairHandle::getEntArrSetIterArrRelation ( 00648 /*in*/ iBase_EntityHandle *ent_array_1, 00649 /*in*/ int ent_array_1_size, 00650 /*in*/ bool switch_order, 00651 /*inout*/ std::vector<iBase_EntityIterator> &entiter) 00652 { 00653 int err; 00654 int dum1 = 0, dum2; 00655 iBase_EntityIterator *dum_ptr = NULL; 00656 iRel_getEntArrSetIterArrRelation (IRELI, irelPair, ent_array_1, ent_array_1_size, switch_order, 00657 &dum_ptr, &dum1, &dum2, &err); 00658 if (iBase_SUCCESS == err) { 00659 entiter.resize(dum1); 00660 memcpy(&entiter[0], dum_ptr, dum1*sizeof(iBase_EntityIterator)); 00661 } 00662 return (Error)err; 00663 00664 } 00665 00666 inline iRel::Error iRel::PairHandle::inferAllRelations () 00667 { 00668 int err; 00669 iRel_inferAllRelations (IRELI, irelPair, &err); 00670 return (Error)err; 00671 } 00672 00673 inline iRel::Error iRel::PairHandle::inferAllRelationsAndType () 00674 { 00675 int err; 00676 iRel_inferAllRelationsAndType (IRELI, &irelPair, &err); 00677 return (Error)err; 00678 } 00679 00680 00681 inline iRel::Error iRel::PairHandle::inferEntRelations ( 00682 /*in*/ iBase_EntityHandle entity, 00683 /*in*/ int iface_no) 00684 { 00685 int err; 00686 iRel_inferEntRelations (IRELI, irelPair, entity, iface_no, &err); 00687 return (Error)err; 00688 } 00689 00690 inline iRel::Error iRel::PairHandle::inferSetRelations ( 00691 /*in*/ iBase_EntitySetHandle entity_set, 00692 /*in*/ int iface_no) 00693 { 00694 int err; 00695 iRel_inferSetRelations (IRELI, irelPair, entity_set, iface_no, &err); 00696 return (Error)err; 00697 } 00698 00699 inline iRel::Error iRel::PairHandle::inferEntArrRelations ( 00700 /*in*/ iBase_EntityHandle *entities, 00701 /*in*/ int entities_size, 00702 /*in*/ int iface_no) 00703 { 00704 int err; 00705 iRel_inferEntArrRelations (IRELI, irelPair, entities, entities_size, iface_no, &err); 00706 return (Error)err; 00707 } 00708 00709 inline iRel::Error iRel::PairHandle::inferSetArrRelations ( 00710 /*in*/ iBase_EntitySetHandle *entity_sets, 00711 /*in*/ int entities_size, 00712 /*in*/ int iface_no) 00713 { 00714 int err; 00715 iRel_inferSetArrRelations (IRELI, irelPair, entity_sets, entities_size, iface_no, &err); 00716 return (Error)err; 00717 } 00718 00719 #endif /* #ifndef ITAPS_REL_HH */ 00720