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