moab
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 
00023 
00024 // note: this MBuuid is compliant with the windows GUID.  
00025 // It is possible to do a memcpy() to copy the data from a MBuuid to a GUID
00026 // if we want to support dll registration
00027 struct MBuuid
00028 {
00030    MBuuid()
00031    {
00032       memset( this, 0, sizeof(MBuuid) );
00033    }
00035    MBuuid( unsigned l, unsigned short w1, unsigned short w2, 
00036          unsigned char b1, unsigned char b2, unsigned char b3, 
00037          unsigned char b4, unsigned char b5, unsigned char b6, 
00038          unsigned char b7, unsigned char b8 )
00039    {
00040       data1 = l;
00041       data2 = w1;
00042       data3 = w2;
00043       data4[0] = b1;
00044       data4[1] = b2;
00045       data4[2] = b3;
00046       data4[3] = b4;
00047       data4[4] = b5;
00048       data4[5] = b6;
00049       data4[6] = b7;
00050       data4[7] = b8;
00051    }
00053    MBuuid( const MBuuid& mdbuuid )
00054    {
00055       memcpy( this, &mdbuuid, sizeof(MBuuid));
00056    }
00058    MBuuid &operator=(const MBuuid& orig)
00059    {
00060       memcpy( this, &orig, sizeof(MBuuid));
00061       return *this;
00062    }
00064    bool operator==(const MBuuid& orig) const
00065    {
00066       return !memcmp(this, &orig, sizeof(MBuuid));
00067    }
00069    bool operator!=(const MBuuid& orig) const
00070    {
00071       return!(*this == orig);
00072    }
00073 
00075    unsigned   data1;
00076    unsigned short data2;
00077    unsigned short data3;
00078    unsigned char  data4[8];
00079 };
00080   
00084 static const MBuuid IDD_MBUnknown = MBuuid( 0xf4f6605e, 0x2a7e, 0x4760, 
00085    0xbb, 0x06, 0xb9, 0xed, 0x27, 0xe9, 0x4a, 0xec );
00086 
00087 
00089 class UnknownInterface
00090 {
00091 public:
00092    virtual int QueryInterface
00093       ( const MBuuid&, UnknownInterface** ) = 0;
00094    virtual ~UnknownInterface() {}
00095 };
00096 
00097 } // namespace moab 
00098 
00099 #endif  // MOAB_UNKNOWN_INTERFACE_HPP
00100 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines