MOAB: Mesh Oriented datABase  (version 5.2.1)
AssocPair.cpp
Go to the documentation of this file.
00001 #include "AssocPair.hpp"
00002 
00003 #include <cstdlib>
00004 
00005 #include "Lasso.hpp"
00006 
00007 #ifdef ENABLE_IGEOM
00008 #include "GeomAssocPairSide.hpp"
00009 #endif
00010 #ifdef ENABLE_FBIGEOM
00011 #include "FBGeomAssocPairSide.hpp"
00012 #endif
00013 #ifdef ENABLE_IMESH
00014 #include "MeshAssocPairSide.hpp"
00015 #endif
00016 
00017 int AssocPair::currId = 0;
00018 
00019 AssocPair::AssocPair( iRel_Instance p_instance, iBase_Instance iface0, iRel_RelationType ent_or_set0,
00020                       iRel_IfaceType type0, iRel_RelationStatus p_status0, iBase_Instance iface1,
00021                       iRel_RelationType ent_or_set1, iRel_IfaceType type1, iRel_RelationStatus p_status1 )
00022     : instance( p_instance )
00023 {
00024     pairId = currId++;
00025 
00026     iBase_Instance ifaces[] = { iface0, iface1 };
00027     iRel_IfaceType types[]  = { type0, type1 };
00028     for( int i = 0; i < 2; i++ )
00029     {
00030         switch( types[i] )
00031         {
00032 #ifdef ENABLE_IGEOM
00033             case iRel_IGEOM_IFACE:
00034                 relSides[i] = new GeomAssocPairSide( instance, ifaces[i], pairId );
00035                 break;
00036 #endif
00037 #ifdef ENABLE_FBIGEOM
00038             case iRel_FBIGEOM_IFACE:
00039                 relSides[i] = new FBGeomAssocPairSide( instance, ifaces[i], pairId );
00040                 break;
00041 #endif
00042 #ifdef ENABLE_IMESH
00043             case iRel_IMESH_IFACE:
00044                 relSides[i] = new MeshAssocPairSide( instance, ifaces[i], pairId );
00045                 break;
00046 #endif
00047             default:
00048                 relSides[i] = NULL;
00049         }
00050     }
00051 
00052     entOrSet[0]  = ent_or_set0;
00053     entOrSet[1]  = ent_or_set1;
00054     relStatus[0] = p_status0;
00055     relStatus[1] = p_status1;
00056 }
00057 
00058 AssocPair::~AssocPair()
00059 {
00060     for( int i = 0; i < 2; i++ )
00061         delete relSides[i];
00062 }
00063 
00064 int AssocPair::get_all_entities( int iface_no, int dimension, iBase_EntityHandle** entities, int* entities_alloc,
00065                                  int* entities_size )
00066 {
00067     return relSides[iface_no]->get_all_entities( dimension, entities, entities_alloc, entities_size );
00068 }
00069 
00070 int AssocPair::get_all_sets( int iface_no, iBase_EntitySetHandle** sets, int* sets_alloc, int* sets_size )
00071 {
00072     return relSides[iface_no]->get_all_sets( sets, sets_alloc, sets_size );
00073 }
00074 
00075 int AssocPair::get_entities( int iface_no, int dimension, iBase_EntitySetHandle set_handle,
00076                              iBase_EntityHandle** entities, int* entities_alloc, int* entities_size )
00077 {
00078     return relSides[iface_no]->get_entities( dimension, set_handle, entities, entities_alloc, entities_size );
00079 }
00080 
00081 int AssocPair::get_ents_dims( int iface_no, iBase_EntityHandle* entities, int entities_size, int** ent_types,
00082                               int* ent_types_alloc, int* ent_types_size )
00083 {
00084     return relSides[iface_no]->get_ents_dims( entities, entities_size, ent_types, ent_types_alloc, ent_types_size );
00085 }
00086 
00087 int AssocPair::set_relation( iBase_EntityHandle ent1, iBase_EntityHandle ent2 )
00088 {
00089     if( entOrSet[0] == iRel_SET || entOrSet[1] == iRel_SET ) ERRORR( iBase_FAILURE, "Invalid relation type" );
00090 
00091     // check that if we're passing in an ent for a 'both'-type
00092     // assoc, there's already a set associated to the other ent
00093     iBase_EntityHandle tmp_ent;
00094     if( entOrSet[0] == iRel_BOTH && relSides[1]->get_relation_side( &ent2, 1, &tmp_ent ) != iBase_SUCCESS )
00095         ERRORR( iBase_FAILURE, "Couldn't find associated set on left side" );
00096     if( entOrSet[1] == iRel_BOTH && relSides[0]->get_relation_side( &ent1, 1, &tmp_ent ) != iBase_SUCCESS )
00097         ERRORR( iBase_FAILURE, "Couldn't find associated set on right side" );
00098 
00099     // set ent1 => ent2
00100     if( relStatus[0] == iRel_ACTIVE ) CHK_ERRORR( relSides[0]->set_relation_side( &ent1, 1, &ent2 ) );
00101 
00102     // set ent1 <= ent2
00103     if( relStatus[1] == iRel_ACTIVE ) CHK_ERRORR( relSides[1]->set_relation_side( &ent2, 1, &ent1 ) );
00104 
00105     RETURNR( iBase_SUCCESS );
00106 }
00107 
00108 int AssocPair::set_relation( iBase_EntityHandle ent1, iBase_EntitySetHandle set2 )
00109 {
00110     if( entOrSet[0] == iRel_SET || entOrSet[1] == iRel_ENTITY ) ERRORR( iBase_FAILURE, "Invalid relation type" );
00111 
00112     // check that if we're passing in an ent for a 'both'-type
00113     // assoc, there's already a set associated to the other ent
00114     iBase_EntityHandle tmp_ent;
00115     if( entOrSet[0] == iRel_BOTH && relSides[1]->get_relation_side( &set2, 1, &tmp_ent ) != iBase_SUCCESS )
00116         ERRORR( iBase_FAILURE, "Couldn't find associated set on left side" );
00117 
00118     // set ent1 => set2
00119     if( relStatus[0] == iRel_ACTIVE ) CHK_ERRORR( relSides[0]->set_relation_side( &ent1, 1, &set2 ) );
00120 
00121     // set ent1 <= set2
00122     if( relStatus[1] == iRel_ACTIVE ) CHK_ERRORR( relSides[1]->set_relation_side( &set2, 1, &ent1 ) );
00123 
00124     // if the right side is a 'both'-type association, set the contents of set2
00125     // to point to ent1 as well
00126     if( entOrSet[1] == iRel_BOTH ) CHK_ERRORR( populate_recursive( 1, set2, ent1 ) );
00127 
00128     RETURNR( iBase_SUCCESS );
00129 }
00130 
00131 int AssocPair::set_relation( iBase_EntitySetHandle set1, iBase_EntityHandle ent2 )
00132 {
00133     if( entOrSet[0] == iRel_ENTITY || entOrSet[1] == iRel_SET ) ERRORR( iBase_FAILURE, "Invalid relation type" );
00134 
00135     // check that if we're passing in an ent for a 'both'-type
00136     // assoc, there's already a set associated to the other ent
00137     iBase_EntityHandle tmp_ent;
00138     if( entOrSet[1] == iRel_BOTH && relSides[0]->get_relation_side( &set1, 1, &tmp_ent ) != iBase_SUCCESS )
00139         ERRORR( iBase_FAILURE, "Couldn't find associated set on right side" );
00140 
00141     // set set1 => ent2
00142     if( relStatus[0] == iRel_ACTIVE ) CHK_ERRORR( relSides[0]->set_relation_side( &set1, 1, &ent2 ) );
00143 
00144     // set ent1 <= set2
00145     if( relStatus[1] == iRel_ACTIVE ) CHK_ERRORR( relSides[1]->set_relation_side( &ent2, 1, &set1 ) );
00146 
00147     // if the left side is a 'both'-type association, set the contents of set1
00148     // to point to ent2 as well
00149     if( entOrSet[0] == iRel_BOTH ) CHK_ERRORR( populate_recursive( 0, set1, ent2 ) );
00150 
00151     RETURNR( iBase_SUCCESS );
00152 }
00153 
00154 int AssocPair::set_relation( iBase_EntitySetHandle set1, iBase_EntitySetHandle set2 )
00155 {
00156     if( entOrSet[0] == iRel_ENTITY || entOrSet[1] == iRel_ENTITY ) ERRORR( iBase_FAILURE, "Invalid relation type" );
00157 
00158     // set set1 => set2
00159     if( relStatus[0] == iRel_ACTIVE ) CHK_ERRORR( relSides[0]->set_relation_side( &set1, 1, &set2 ) );
00160 
00161     // set set1 <= set2
00162     if( relStatus[1] == iRel_ACTIVE ) CHK_ERRORR( relSides[1]->set_relation_side( &set2, 1, &set1 ) );
00163 
00164     // if either side is a 'both'-type association, set the contents of set1
00165     // to point to set2 as well (and/or vice-versa)
00166     if( entOrSet[0] == iRel_BOTH ) CHK_ERRORR( populate_recursive( 0, set1, set2 ) );
00167     if( entOrSet[1] == iRel_BOTH ) CHK_ERRORR( populate_recursive( 1, set2, set1 ) );
00168 
00169     RETURNR( iBase_SUCCESS );
00170 }
00171 
00172 int AssocPair::get_relation( int iface_no, iBase_EntityHandle* entities, int num_entities,
00173                              iBase_EntityHandle* tag_values )
00174 {
00175     if( relStatus[iface_no] == iRel_NOTEXIST ) ERRORR( iBase_FAILURE, "Relation does not exist on this side" );
00176     if( entOrSet[!iface_no] != iRel_ENTITY )  // other iface is sets
00177         ERRORR( iBase_INVALID_ENTITY_HANDLE, "Expected EntitySet, got Entity" );
00178 
00179     return relSides[iface_no]->get_relation_side( entities, num_entities, tag_values );
00180 }
00181 
00182 int AssocPair::get_relation( int iface_no, iBase_EntitySetHandle* sets, int num_sets, iBase_EntityHandle* tag_values )
00183 {
00184     if( relStatus[iface_no] == iRel_NOTEXIST ) ERRORR( iBase_FAILURE, "Relation does not exist on this side" );
00185     if( entOrSet[!iface_no] != iRel_ENTITY )  // other iface is sets
00186         ERRORR( iBase_INVALID_ENTITY_HANDLE, "Expected EntitySet, got Entity" );
00187 
00188     return relSides[iface_no]->get_relation_side( sets, num_sets, tag_values );
00189 }
00190 
00191 int AssocPair::get_relation( int iface_no, iBase_EntityHandle* entities, int num_entities,
00192                              iBase_EntitySetHandle* tag_values )
00193 {
00194     if( relStatus[iface_no] == iRel_NOTEXIST ) ERRORR( iBase_FAILURE, "Relation does not exist on this side" );
00195     if( entOrSet[!iface_no] == iRel_ENTITY )  // other iface is not sets
00196         ERRORR( iBase_INVALID_ENTITY_HANDLE, "Expected Entity, got EntitySet" );
00197 
00198     return relSides[iface_no]->get_relation_side( entities, num_entities, tag_values );
00199 }
00200 
00201 int AssocPair::get_relation( int iface_no, iBase_EntitySetHandle* sets, int num_sets,
00202                              iBase_EntitySetHandle* tag_values )
00203 {
00204     if( relStatus[iface_no] == iRel_NOTEXIST ) ERRORR( iBase_FAILURE, "Relation does not exist on this side" );
00205     if( entOrSet[!iface_no] == iRel_ENTITY )  // other iface is not sets
00206         ERRORR( iBase_INVALID_ENTITY_HANDLE, "Expected Entity, got EntitySet" );
00207 
00208     return relSides[iface_no]->get_relation_side( sets, num_sets, tag_values );
00209 }
00210 
00211 int AssocPair::get_relation( int iface_no, iBase_EntityHandle* entities, int num_entities,
00212                              iBase_EntityIterator* tag_values )
00213 {
00214     std::vector< iBase_EntitySetHandle > sets( num_entities );CHK_ERRORR( get_relation( iface_no, entities, num_entities, &sets[0] ) );
00215 
00216     for( int i = 0; i < num_entities; i++ )
00217         CHK_ERRORR( relSides[i]->get_iterator( sets[i], &tag_values[i] ) );
00218 
00219     RETURNR( iBase_SUCCESS );
00220 }
00221 
00222 int AssocPair::get_relation( int iface_no, iBase_EntitySetHandle* sets, int num_sets, iBase_EntityIterator* tag_values )
00223 {
00224     std::vector< iBase_EntitySetHandle > sets2( num_sets );CHK_ERRORR( get_relation( iface_no, sets, num_sets, &sets2[0] ) );
00225 
00226     for( int i = 0; i < num_sets; i++ )
00227         CHK_ERRORR( relSides[iface_no]->get_iterator( sets2[i], &tag_values[i] ) );
00228 
00229     RETURNR( iBase_SUCCESS );
00230 }
00231 
00232 int AssocPair::rmv_relation( int iface_no, iBase_EntityHandle* entities, int num_entities )
00233 {
00234     if( relStatus[iface_no] == iRel_NOTEXIST ) ERRORR( iBase_FAILURE, "Relation does not exist on this side" );
00235 
00236     // TODO: handle "both" case
00237 
00238     // Remove the opposite side first
00239     if( relStatus[!iface_no] == iRel_ACTIVE )
00240     {
00241         if( entOrSet[!iface_no] == iRel_ENTITY )
00242         {
00243             std::vector< iBase_EntityHandle > other_entities( num_entities );CHK_ERRORR( get_relation( iface_no, entities, num_entities, &other_entities[0] ) );CHK_ERRORR( relSides[!iface_no]->rmv_relation_side( &other_entities[0], num_entities ) );
00244         }
00245         else
00246         {
00247             std::vector< iBase_EntitySetHandle > other_sets( num_entities );CHK_ERRORR( get_relation( iface_no, entities, num_entities, &other_sets[0] ) );CHK_ERRORR( relSides[!iface_no]->rmv_relation_side( &other_sets[0], num_entities ) );
00248         }
00249     }
00250 
00251     return relSides[iface_no]->rmv_relation_side( entities, num_entities );
00252 }
00253 
00254 int AssocPair::rmv_relation( int iface_no, iBase_EntitySetHandle* sets, int num_sets )
00255 {
00256     if( relStatus[iface_no] == iRel_NOTEXIST ) ERRORR( iBase_FAILURE, "Relation does not exist on this side" );
00257 
00258     // TODO: handle "both" case
00259 
00260     // Remove the opposite side first
00261     if( relStatus[!iface_no] == iRel_ACTIVE )
00262     {
00263         if( entOrSet[!iface_no] == iRel_ENTITY )
00264         {
00265             std::vector< iBase_EntityHandle > other_entities( num_sets );CHK_ERRORR( get_relation( iface_no, sets, num_sets, &other_entities[0] ) );CHK_ERRORR( relSides[!iface_no]->rmv_relation_side( &other_entities[0], num_sets ) );
00266         }
00267         else
00268         {
00269             std::vector< iBase_EntitySetHandle > other_sets( num_sets );CHK_ERRORR( get_relation( iface_no, sets, num_sets, &other_sets[0] ) );CHK_ERRORR( relSides[!iface_no]->rmv_relation_side( &other_sets[0], num_sets ) );
00270         }
00271     }
00272 
00273     return relSides[iface_no]->rmv_relation_side( sets, num_sets );
00274 }
00275 
00276 int AssocPair::get_gids( int iface_no, iBase_EntityHandle* entities, int num_entities, int* tag_values )
00277 {
00278     return relSides[iface_no]->get_gids( entities, num_entities, tag_values );
00279 }
00280 
00281 int AssocPair::get_gids( int iface_no, iBase_EntitySetHandle* sets, int num_sets, int* tag_values )
00282 {
00283     return relSides[iface_no]->get_gids( sets, num_sets, tag_values );
00284 }
00285 
00286 int AssocPair::get_dims( int iface_no, iBase_EntityHandle* entities, int num_entities, int* tag_values )
00287 {
00288     return relSides[iface_no]->get_dims( entities, num_entities, tag_values );
00289 }
00290 
00291 int AssocPair::get_dims( int iface_no, iBase_EntitySetHandle* sets, int num_sets, int* tag_values )
00292 {
00293     return relSides[iface_no]->get_dims( sets, num_sets, tag_values );
00294 }
00295 
00296 int AssocPair::change_type( int iface_no, iRel_RelationType type )
00297 {
00298     if( entOrSet[iface_no] == type ) RETURNR( iBase_SUCCESS );
00299     if( entOrSet[iface_no] == iRel_ENTITY || type == iRel_ENTITY )
00300         ERRORR( iBase_FAILURE, "Can only change type from \"set\" to \"both\", or "
00301                                "vice-versa" );
00302 
00303     entOrSet[iface_no] = type;
00304     if( relStatus[iface_no] != iRel_ACTIVE ) RETURNR( iBase_SUCCESS );
00305 
00306     iBase_EntitySetHandle* sets = NULL;
00307     int set_alloc               = 0, set_size;CHK_ERRORR( relSides[iface_no]->get_related_sets( &sets, &set_alloc, &set_size ) );
00308     if( type == iRel_BOTH )
00309     {
00310         if( entOrSet[!iface_no] == iRel_ENTITY )
00311         {
00312             std::vector< iBase_EntityHandle > related_ents( set_size );CHK_ERRORR( relSides[iface_no]->get_relation_side( sets, set_size, &related_ents[0] ) );
00313 
00314             for( int i = 0; i < set_size; i++ )
00315                 CHK_ERRORR( populate_recursive( iface_no, sets[i], related_ents[i] ) );
00316         }
00317         else
00318         {
00319             std::vector< iBase_EntitySetHandle > related_sets( set_size );CHK_ERRORR( relSides[iface_no]->get_relation_side( sets, set_size, &related_sets[0] ) );
00320 
00321             for( int i = 0; i < set_size; i++ )
00322                 CHK_ERRORR( populate_recursive( iface_no, sets[i], related_sets[i] ) );
00323         }
00324     }
00325     else if( type == iRel_SET )
00326     {
00327         for( int i = 0; i < set_size; i++ )
00328             CHK_ERRORR( unpopulate_recursive( iface_no, sets[i] ) );
00329     }
00330 
00331     free( sets );
00332     RETURNR( iBase_SUCCESS );
00333 }
00334 
00335 int AssocPair::change_status( int iface_no, iRel_RelationStatus status )
00336 {
00337     if( relStatus[iface_no] == status ) RETURNR( iBase_SUCCESS );
00338 
00339     relStatus[iface_no] = status;
00340 
00341     if( status == iRel_NOTEXIST )
00342     {
00343         // Destroy the assoc tag
00344         CHK_ERRORR( relSides[iface_no]->destroy_relation_side() );
00345     }
00346     else if( status == iRel_INACTIVE )
00347     {
00348         // Create the assoc tag
00349         CHK_ERRORR( relSides[iface_no]->create_relation_side() );
00350     }
00351     // Update the assoc tag
00352     else if( status == iRel_ACTIVE )
00353     {
00354         CHK_ERRORR( relSides[iface_no]->destroy_relation_side() );CHK_ERRORR( relSides[iface_no]->create_relation_side() );
00355 
00356         if( entOrSet[!iface_no] == iRel_ENTITY )
00357         {
00358             iBase_EntityHandle* entities = NULL;
00359             int ent_alloc                = 0, ent_size;
00360 
00361             CHK_ERRORR( relSides[!iface_no]->get_related_ents( &entities, &ent_alloc, &ent_size ) );
00362             if( entOrSet[iface_no] == iRel_ENTITY )
00363             {
00364                 std::vector< iBase_EntityHandle > related_ents( ent_size );
00365                 int result = relSides[!iface_no]->get_relation_side( entities, ent_size, &related_ents[0] );
00366 
00367                 if( result == iBase_SUCCESS )
00368                 {
00369                     if( iface_no == 0 )
00370                         for( int i = 0; i < ent_size; i++ )
00371                             CHK_ERRORR( set_relation( related_ents[i], entities[i] ) );
00372                     else
00373                         for( int i = 0; i < ent_size; i++ )
00374                             CHK_ERRORR( set_relation( entities[i], related_ents[i] ) );
00375                 }
00376             }
00377             else
00378             {
00379                 std::vector< iBase_EntitySetHandle > related_sets( ent_size );
00380                 int result = relSides[!iface_no]->get_relation_side( entities, ent_size, &related_sets[0] );
00381 
00382                 if( result == iBase_SUCCESS )
00383                 {
00384                     if( iface_no == 0 )
00385                         for( int i = 0; i < ent_size; i++ )
00386                             CHK_ERRORR( set_relation( related_sets[i], entities[i] ) );
00387                     else
00388                         for( int i = 0; i < ent_size; i++ )
00389                             CHK_ERRORR( set_relation( entities[i], related_sets[i] ) );
00390                 }
00391             }
00392 
00393             free( entities );
00394         }
00395         else
00396         {
00397             iBase_EntitySetHandle* sets = NULL;
00398             int set_alloc               = 0, set_size;
00399 
00400             CHK_ERRORR( relSides[!iface_no]->get_related_sets( &sets, &set_alloc, &set_size ) );
00401             if( entOrSet[iface_no] == iRel_ENTITY )
00402             {
00403                 std::vector< iBase_EntityHandle > related_ents( set_size );
00404                 int result = relSides[!iface_no]->get_relation_side( sets, set_size, &related_ents[0] );
00405 
00406                 if( result == iBase_SUCCESS )
00407                 {
00408                     if( iface_no == 0 )
00409                         for( int i = 0; i < set_size; i++ )
00410                             CHK_ERRORR( set_relation( related_ents[i], sets[i] ) );
00411                     else
00412                         for( int i = 0; i < set_size; i++ )
00413                             CHK_ERRORR( set_relation( sets[i], related_ents[i] ) );
00414                 }
00415             }
00416             else
00417             {
00418                 std::vector< iBase_EntitySetHandle > related_sets( set_size );
00419                 int result = relSides[!iface_no]->get_relation_side( sets, set_size, &related_sets[0] );
00420 
00421                 if( result == iBase_SUCCESS )
00422                 {
00423                     if( iface_no == 0 )
00424                         for( int i = 0; i < set_size; i++ )
00425                             CHK_ERRORR( set_relation( related_sets[i], sets[i] ) );
00426                     else
00427                         for( int i = 0; i < set_size; i++ )
00428                             CHK_ERRORR( set_relation( sets[i], related_sets[i] ) );
00429                 }
00430             }
00431 
00432             free( sets );
00433         }
00434     }
00435     else
00436     {
00437         ERRORR( iBase_INVALID_ARGUMENT, "Invalid argument for relation status" );
00438     }
00439 
00440     RETURNR( iBase_SUCCESS );
00441 }
00442 
00443 bool AssocPair::equivalent( iBase_Instance iface0, iBase_Instance iface1, bool* order_switched )
00444 {
00445     if( iface0 == relSides[0]->instance() && iface1 == relSides[1]->instance() )
00446     {
00447         if( order_switched ) *order_switched = false;
00448         return true;
00449     }
00450     else if( iface0 == relSides[1]->instance() && iface1 == relSides[0]->instance() )
00451     {
00452         if( order_switched ) *order_switched = true;
00453         return true;
00454     }
00455     else
00456         return false;
00457 }
00458 
00459 bool AssocPair::equivalent( iRel_IfaceType type0, iRel_IfaceType type1, bool* order_switched )
00460 {
00461     if( type0 == relSides[0]->type() && type1 == relSides[1]->type() )
00462     {
00463         if( order_switched ) *order_switched = false;
00464         return true;
00465     }
00466     else if( type0 == relSides[1]->type() && type1 == relSides[0]->type() )
00467     {
00468         if( order_switched ) *order_switched = true;
00469         return true;
00470     }
00471     else
00472         return false;
00473 }
00474 
00475 bool AssocPair::contains( iBase_Instance iface )
00476 {
00477     return ( iface == relSides[0]->instance() || iface == relSides[1]->instance() );
00478 }
00479 
00480 int AssocPair::populate_recursive( int iface_no, iBase_EntitySetHandle set, iBase_EntityHandle related_ent )
00481 {
00482     iBase_EntityHandle* entities = NULL;
00483     int entities_alloc           = 0, entities_size;
00484 
00485     CHK_ERRORR( relSides[iface_no]->get_entities( -1, set, &entities, &entities_alloc, &entities_size ) );
00486 
00487     for( int i = 0; i < entities_size; i++ )
00488         CHK_ERRORR( relSides[iface_no]->set_relation_side( entities + i, 1, &related_ent ) );
00489 
00490     free( entities );
00491     RETURNR( iBase_SUCCESS );
00492 }
00493 
00494 int AssocPair::populate_recursive( int iface_no, iBase_EntitySetHandle set, iBase_EntitySetHandle related_set )
00495 {
00496     iBase_EntityHandle* entities = NULL;
00497     int entities_alloc, entities_size;
00498 
00499     CHK_ERRORR( relSides[iface_no]->get_entities( -1, set, &entities, &entities_alloc, &entities_size ) );
00500 
00501     for( int i = 0; i < entities_size; i++ )
00502         CHK_ERRORR( relSides[iface_no]->set_relation_side( entities + i, 1, &related_set ) );
00503 
00504     free( entities );
00505     RETURNR( iBase_SUCCESS );
00506 }
00507 
00508 int AssocPair::unpopulate_recursive( int iface_no, iBase_EntitySetHandle set )
00509 {
00510     iBase_EntityHandle* entities = NULL;
00511     int entities_alloc           = 0, entities_size;
00512 
00513     CHK_ERRORR( relSides[iface_no]->get_entities( -1, set, &entities, &entities_alloc, &entities_size ) );CHK_ERRORR( relSides[iface_no]->rmv_relation_side( entities, entities_size ) );
00514 
00515     free( entities );
00516     RETURNR( iBase_SUCCESS );
00517 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines