MOAB: Mesh Oriented datABase  (version 5.5.0)
Lasso.hpp
Go to the documentation of this file.
1 #ifndef LASSO_HPP
2 #define LASSO_HPP
3 
4 #include "iRel.h"
5 
6 #include <set>
7 #include <vector>
8 #include <cstring>
9 
10 class AssocPair;
11 
12 class Lasso
13 {
14  public:
16  {
17  lastErrorDescription[0] = '\0';
18  }
19 
20  virtual ~Lasso();
21 
22  //! find a pair equivalent to these ifaces, passed as pointer to
23  //! SIDL interface or interface instance
24  AssocPair* find_pair( void* iface0, void* iface1, bool* switched = NULL );
25 
26  AssocPair* find_pair( iRel_IfaceType type1, iRel_IfaceType type2, bool* switched = NULL );
27 
28  void find_pairs( void* iface, std::vector< AssocPair* >& iface_pairs );
29 
30  int insert_pair( AssocPair* this_pair );
31  int erase_pair( AssocPair* this_pair );
32 
33  inline int set_last_error( int, const char* );
34 
37 
38  private:
39  std::set< AssocPair* > assocPairs;
40 };
41 
42 static inline Lasso* lasso_instance( iRel_Instance instance )
43 {
44  return reinterpret_cast< Lasso* >( instance );
45 }
46 #define LASSOI lasso_instance( instance )
47 
48 int Lasso::set_last_error( int code, const char* msg )
49 {
50  std::strncpy( lastErrorDescription, msg, sizeof( lastErrorDescription ) );
51  lastErrorDescription[sizeof( lastErrorDescription ) - 1] = '\0';
52  return ( lastErrorType = static_cast< iBase_ErrorType >( code ) );
53 }
54 
55 #endif // #ifndef LASSO_HPP