MOAB: Mesh Oriented datABase  (version 5.4.1)
Lasso.cpp
Go to the documentation of this file.
00001 #include "Lasso.hpp"
00002 #include "AssocPair.hpp"
00003 
00004 Lasso::~Lasso()
00005 {
00006     for( std::set< AssocPair* >::iterator i = assocPairs.begin(); i != assocPairs.end(); ++i )
00007         delete *i;
00008 }
00009 
00010 //! find a pair equivalent to these ifaces, passed as pointer to
00011 //! SIDL interface or interface instance
00012 AssocPair* Lasso::find_pair( void* iface0, void* iface1, bool* switched )
00013 {
00014     for( std::set< AssocPair* >::iterator i = assocPairs.begin(); i != assocPairs.end(); ++i )
00015     {
00016         if( ( *i )->equivalent( iface0, iface1, switched ) ) return *i;
00017     }
00018 
00019     return NULL;
00020 }
00021 
00022 //! find a pair with the right types
00023 AssocPair* Lasso::find_pair( iRel_IfaceType type1, iRel_IfaceType type2, bool* switched )
00024 {
00025     for( std::set< AssocPair* >::iterator i = assocPairs.begin(); i != assocPairs.end(); ++i )
00026     {
00027         if( ( *i )->equivalent( type1, type2, switched ) ) return *i;
00028     }
00029 
00030     return NULL;
00031 }
00032 
00033 void Lasso::find_pairs( void* iface, std::vector< AssocPair* >& iface_pairs )
00034 {
00035     for( std::set< AssocPair* >::iterator i = assocPairs.begin(); i != assocPairs.end(); ++i )
00036     {
00037         if( ( *i )->contains( iface ) ) iface_pairs.push_back( *i );
00038     }
00039 }
00040 
00041 int Lasso::insert_pair( AssocPair* this_pair )
00042 {
00043     assocPairs.insert( this_pair );
00044     return iBase_SUCCESS;
00045 }
00046 
00047 int Lasso::erase_pair( AssocPair* this_pair )
00048 {
00049     if( assocPairs.erase( this_pair ) == 0 ) return iBase_FAILURE;
00050 
00051     // If the pair was removed, then delete it too
00052     delete this_pair;
00053     return iBase_SUCCESS;
00054 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines