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