Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
Lasso.hpp
Go to the documentation of this file.
00001 #ifndef LASSO_HPP
00002 #define LASSO_HPP
00003 
00004 #include "iRel.h"
00005 
00006 #include <set>
00007 #include <vector>
00008 #include <cstring>
00009 
00010 class AssocPair;
00011 
00012 class Lasso
00013 {
00014   public:
00015     Lasso() : lastErrorType( iBase_SUCCESS )
00016     {
00017         lastErrorDescription[0] = '\0';
00018     }
00019 
00020     virtual ~Lasso();
00021 
00022     //! find a pair equivalent to these ifaces, passed as pointer to
00023     //! SIDL interface or interface instance
00024     AssocPair* find_pair( void* iface0, void* iface1, bool* switched = NULL );
00025 
00026     AssocPair* find_pair( iRel_IfaceType type1, iRel_IfaceType type2, bool* switched = NULL );
00027 
00028     void find_pairs( void* iface, std::vector< AssocPair* >& iface_pairs );
00029 
00030     int insert_pair( AssocPair* this_pair );
00031     int erase_pair( AssocPair* this_pair );
00032 
00033     inline int set_last_error( int, const char* );
00034 
00035     int lastErrorType;
00036     char lastErrorDescription[120];
00037 
00038   private:
00039     std::set< AssocPair* > assocPairs;
00040 };
00041 
00042 static inline Lasso* lasso_instance( iRel_Instance instance )
00043 {
00044     return reinterpret_cast< Lasso* >( instance );
00045 }
00046 #define LASSOI lasso_instance( instance )
00047 
00048 int Lasso::set_last_error( int code, const char* msg )
00049 {
00050     std::strncpy( lastErrorDescription, msg, sizeof( lastErrorDescription ) );
00051     lastErrorDescription[sizeof( lastErrorDescription ) - 1] = '\0';
00052     return ( lastErrorType = static_cast< iBase_ErrorType >( code ) );
00053 }
00054 
00055 #endif  // #ifndef LASSO_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines