iobject.h

Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_IOBJECT_H_
00005 #define _FBXSDK_IOBJECT_H_
00006 /**************************************************************************
00007  Copyright © 1994 - 2007 Autodesk, Inc. and/or its licensors.
00008  All rights reserved.
00009 
00010  The coded instructions, statements, computer programs, and/or related material
00011  (collectively the "Data") in these files contain unpublished information
00012  proprietary to Autodesk, Inc. and/or its licensors, which is protected by
00013  Canada and United States of America federal copyright law and by international
00014  treaties.
00015 
00016  The Data may not be disclosed or distributed to third parties, in whole or in
00017  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00018 
00019  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00020  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00021  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00022  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE,
00023  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE.
00024  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00025  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE.
00026 
00027  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00028  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00029  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00030  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00031  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00032  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00033  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00034  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00035  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00036  OR DAMAGE.
00037 
00038 **************************************************************************/
00039 #include <kbaselib_h.h>
00040 
00041 #include <kbaselib_nsbegin.h>
00042 
00043     #ifdef K_PLUGIN
00044         #define IObject    IKObject
00045         #define HIObject   HIKObject
00046         #define IObjectID  IKObjectID
00047         #define IKObjectID 0
00048         #define IObjectDerived      public IKObject
00049     #else
00050         #define IObjectID  0
00051         #define IObjectDerived      public IObject
00052     #endif
00053 
00055     K_FORWARD( IObject )
00056 
00057     
00058     typedef unsigned long kInterfaceID;
00059 
00061     #define FncDefine(PFNC,ISPURE) virtual PFNC##ISPURE
00062     #define Pure           =0;
00063     #define Implementation ;
00064     #define IObjectImplement(ClassName,IObjectOwner) \
00065         HIObject ClassName##::IQuery(kInterfaceID pInterfaceID,int IsLocal) {\
00066             if ((IObjectOwner!=NULL) && (!IsLocal)) {\
00067                 return IObjectOwner->IQuery(pInterfaceID);\
00068             }\
00069             switch (pInterfaceID) 
00070     #define IObjectEnd return NULL; }
00071     #define ILOCAL          1
00072 
00073     #define IQUERY(Object,Interface) ((H##Interface)((Object)->IQuery(Interface##ID,0)))
00074     #define IQUERYLOCAL(Object,Interface) ( (H##Interface)((Object)->IQuery(Interface##ID,ILOCAL)))
00075 
00076     #define IQ(Object,Interface) IQUERY(Object,Interface)
00077     #define IQL(Object,Interface) IQUERYLOCAL(Object,Interface)
00078 
00079     /*********************************************************************
00080     *  Class IObject
00081     *    This is the base class of all Important interfaces of the system 
00082     *********************************************************************/
00083 
00084     #define IObject_Declare(IsPure)\
00085     public:\
00086         virtual HIObject    IQuery(kInterfaceID pInterfaceID, int IsLocal=0)IsPure\
00087         virtual void        Destroy(int IsLocal=0)IsPure\
00088 
00089     #define IQuery_Declare(IsPure)\
00090     public:\
00091         virtual HIObject IQuery (kInterfaceID pInterfaceID, int IsLocal=0)IsPure\
00092         
00093     class IObject {
00094         IObject_Declare(Pure)
00095     };
00096 
00097     typedef HIObject (* kObjectCreatorFnc)(HIObject pOwner,char *pName,void *pData);
00098 
00099     #ifdef KARCH_DEV_MSC
00100         #define K_INTERFACE_SPECIAL __declspec(novtable)
00101         #define NO_DLL              __declspec()        // Use for the Module parameter if the interface is not exported
00102     #else 
00103         #define K_INTERFACE_SPECIAL 
00104         #define NO_DLL                                  // Use for the Module parameter if the interface is not exported
00105     #endif
00106 
00107     #define K_INTERFACE( Name,Id ) \
00108     K_FORWARD( Name ) \
00109     const int Name##ID = Id; \
00110     class K_INTERFACE_SPECIAL Name : IObjectDerived { \
00111         Name##_Declare(Pure) \
00112     } 
00113 
00114 #include <kbaselib_nsend.h>
00115 
00116 #endif  // Must be the last line of the include file
00117 
00118