MOAB: Mesh Oriented datABase  (version 5.4.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,
00037             unsigned short w1,
00038             unsigned short w2,
00039             unsigned char b1,
00040             unsigned char b2,
00041             unsigned char b3,
00042             unsigned char b4,
00043             unsigned char b5,
00044             unsigned char b6,
00045             unsigned char b7,
00046             unsigned char b8 )
00047     {
00048         data1    = l;
00049         data2    = w1;
00050         data3    = w2;
00051         data4[0] = b1;
00052         data4[1] = b2;
00053         data4[2] = b3;
00054         data4[3] = b4;
00055         data4[4] = b5;
00056         data4[5] = b6;
00057         data4[6] = b7;
00058         data4[7] = b8;
00059     }
00060     //! copy constructor
00061     MBuuid( const MBuuid& mdbuuid )
00062     {
00063         memcpy( this, &mdbuuid, sizeof( MBuuid ) );
00064     }
00065     //! sets this uuid equal to another one
00066     MBuuid& operator=( const MBuuid& orig )
00067     {
00068         memcpy( this, &orig, sizeof( MBuuid ) );
00069         return *this;
00070     }
00071     //! returns whether two uuid's are equal
00072     bool operator==( const MBuuid& orig ) const
00073     {
00074         return !memcmp( this, &orig, sizeof( MBuuid ) );
00075     }
00076     //! returns whether two uuid's are not equal
00077     bool operator!=( const MBuuid& orig ) const
00078     {
00079         return !( *this == orig );
00080     }
00081 
00082     //! uuid data storage
00083     unsigned data1;
00084     unsigned short data2;
00085     unsigned short data3;
00086     unsigned char data4[8];
00087 };
00088 
00089 //! uuid for an unknown interface
00090 //! this can be used to either return a default interface
00091 //! or a NULL interface
00092 static const MBuuid IDD_MBUnknown =
00093     MBuuid( 0xf4f6605e, 0x2a7e, 0x4760, 0xbb, 0x06, 0xb9, 0xed, 0x27, 0xe9, 0x4a, 0xec );
00094 
00095 //! base class for all interface classes
00096 class UnknownInterface
00097 {
00098   public:
00099     virtual int QueryInterface( const MBuuid&, UnknownInterface** ) = 0;
00100     virtual ~UnknownInterface() {}
00101 };
00102 
00103 }  // namespace moab
00104 
00105 #endif  // MOAB_UNKNOWN_INTERFACE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines