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