MOAB: Mesh Oriented datABase  (version 5.3.1)
UnknownInterface.hpp
Go to the documentation of this file.
00001 /*  Filename   :     UnkonwnInterface.h
00002  *  Creator    :     Clinton Stimpson
00003  *
00004  *  Date       :     10 Jan 2002
00005  *
00006  *  Owner      :     Clinton Stimpson
00007  *
00008  *  Description:     Contains declarations for MBuuid which keeps
00009  *                   track of different interfaces.
00010  *                   Also contains the declaration for the base class
00011  *                   UknownInterface from which all interfaces are
00012  *                   derived from
00013  */
00014 
00015 #ifndef MOAB_UNKNOWN_INTERFACE_HPP
00016 #define MOAB_UNKNOWN_INTERFACE_HPP
00017 
00018 #include <memory.h>
00019 
00020 namespace moab
00021 {
00022 
00023 //!  struct that handles universally unique id's for the Mesh Database
00024 
00025 // note: this MBuuid is compliant with the windows GUID.
00026 // It is possible to do a memcpy() to copy the data from a MBuuid to a GUID
00027 // if we want to support dll registration
00028 struct MBuuid
00029 {
00030     //! default constructor that initializes to zero
00031     MBuuid()
00032     {
00033         memset( this, 0, sizeof( MBuuid ) );
00034     }
00035     //! constructor that takes initialization arguments
00036     MBuuid( unsigned l, unsigned short w1, unsigned short w2, unsigned char b1, unsigned char b2, unsigned char b3,
00037             unsigned char b4, unsigned char b5, unsigned char b6, unsigned char b7, unsigned char b8 )
00038     {
00039         data1    = l;
00040         data2    = w1;
00041         data3    = w2;
00042         data4[0] = b1;
00043         data4[1] = b2;
00044         data4[2] = b3;
00045         data4[3] = b4;
00046         data4[4] = b5;
00047         data4[5] = b6;
00048         data4[6] = b7;
00049         data4[7] = b8;
00050     }
00051     //! copy constructor
00052     MBuuid( const MBuuid& mdbuuid )
00053     {
00054         memcpy( this, &mdbuuid, sizeof( MBuuid ) );
00055     }
00056     //! sets this uuid equal to another one
00057     MBuuid& operator=( const MBuuid& orig )
00058     {
00059         memcpy( this, &orig, sizeof( MBuuid ) );
00060         return *this;
00061     }
00062     //! returns whether two uuid's are equal
00063     bool operator==( const MBuuid& orig ) const
00064     {
00065         return !memcmp( this, &orig, sizeof( MBuuid ) );
00066     }
00067     //! returns whether two uuid's are not equal
00068     bool operator!=( const MBuuid& orig ) const
00069     {
00070         return !( *this == orig );
00071     }
00072 
00073     //! uuid data storage
00074     unsigned data1;
00075     unsigned short data2;
00076     unsigned short data3;
00077     unsigned char data4[8];
00078 };
00079 
00080 //! uuid for an unknown interface
00081 //! this can be used to either return a default interface
00082 //! or a NULL interface
00083 static const MBuuid IDD_MBUnknown =
00084     MBuuid( 0xf4f6605e, 0x2a7e, 0x4760, 0xbb, 0x06, 0xb9, 0xed, 0x27, 0xe9, 0x4a, 0xec );
00085 
00086 //! base class for all interface classes
00087 class UnknownInterface
00088 {
00089   public:
00090     virtual int QueryInterface( const MBuuid&, UnknownInterface** ) = 0;
00091     virtual ~UnknownInterface() {}
00092 };
00093 
00094 }  // namespace moab
00095 
00096 #endif  // MOAB_UNKNOWN_INTERFACE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines