1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "Lasso.hpp"
#include "AssocPair.hpp"

Lasso::~Lasso()
{
    for( std::set< AssocPair* >::iterator i = assocPairs.begin(); i != assocPairs.end(); ++i )
        delete *i;
}

//! find a pair equivalent to these ifaces, passed as pointer to
//! SIDL interface or interface instance
AssocPair* Lasso::find_pair( void* iface0, void* iface1, bool* switched )<--- The function 'find_pair' is never used.
{
    for( std::set< AssocPair* >::iterator i = assocPairs.begin(); i != assocPairs.end(); ++i )
    {
        if( ( *i )->equivalent( iface0, iface1, switched ) ) return *i;
    }

    return NULL;
}

//! find a pair with the right types
AssocPair* Lasso::find_pair( iRel_IfaceType type1, iRel_IfaceType type2, bool* switched )
{
    for( std::set< AssocPair* >::iterator i = assocPairs.begin(); i != assocPairs.end(); ++i )
    {
        if( ( *i )->equivalent( type1, type2, switched ) ) return *i;
    }

    return NULL;
}

void Lasso::find_pairs( void* iface, std::vector< AssocPair* >& iface_pairs )
{
    for( std::set< AssocPair* >::iterator i = assocPairs.begin(); i != assocPairs.end(); ++i )
    {
        if( ( *i )->contains( iface ) ) iface_pairs.push_back( *i );
    }
}

int Lasso::insert_pair( AssocPair* this_pair )
{
    assocPairs.insert( this_pair );
    return iBase_SUCCESS;
}

int Lasso::erase_pair( AssocPair* this_pair )
{
    if( assocPairs.erase( this_pair ) == 0 ) return iBase_FAILURE;

    // If the pair was removed, then delete it too
    delete this_pair;
    return iBase_SUCCESS;
}