iobject.h
Go to the documentation of this file.00001
00004 #ifndef _FBXSDK_IOBJECT_H_
00005 #define _FBXSDK_IOBJECT_H_
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
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
00081
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