object/i/iobject.h Source File

iobject.h
Go to the documentation of this file.
1 #ifndef _IObject_H
2 #define _IObject_H
3 /**************************************************************************
4 Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5 All Rights Reserved.
6 
7 The coded instructions, statements, computer programs, and/or related
8 material (collectively the "Data") in these files contain unpublished
9 information proprietary to Autodesk, Inc. and/or its licensors, which is
10 protected by Canada and United States of America federal copyright law
11 and by international treaties.
12 
13 The Data may not be disclosed or distributed to third parties, in whole
14 or in part, without the prior written consent of Autodesk, Inc.
15 ("Autodesk").
16 
17 THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18 ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19 WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20 ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21 OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22 PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23 WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24 FREE.
25 
26 IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27 OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28 EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29 DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30 OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31 DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32 LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33 LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34 DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35 BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
40 #include <kaydara.h>
41 
42 #define IObjectID 0
43 #define IObjectDerived public IObject
44 
47 
49 typedef unsigned long kInterfaceID;
50 
52 #define FncDefine(PFNC,ISPURE) virtual PFNC##ISPURE
53 #define K_IMPLEMENTATION
54 #define IObjectImplement(ClassName,IObjectOwner) \
55  HIObject ClassName##::IQuery(kInterfaceID pInterfaceID,int IsLocal) {\
56  if ((IObjectOwner!=NULL) && (!IsLocal)) {\
57  return IObjectOwner->IQuery(pInterfaceID);\
58  }\
59  switch (pInterfaceID)
60 #define IObjectEnd return NULL; }
61 #define ILOCAL 1
62 
63 #define IQUERY(Object,Interface) ((H##Interface)((Object)->IQuery(Interface##ID,0)))
64 #define IQUERYLOCAL(Object,Interface) ( (H##Interface)((Object)->IQuery(Interface##ID,ILOCAL)))
65 
66 #define IQ(Object,Interface) IQUERY(Object,Interface)
67 #define IQT(Object,Interface) ((Object) ? IQUERY(Object,Interface):NULL)
68 #define IQL(Object,Interface) IQUERYLOCAL(Object,Interface)
69 
70 /*********************************************************************
71  * Class IObject
72  * This is the base class of all Important interfaces of the system
73  *********************************************************************/
74 
75 #define IObject_Declare(IsPure)\
76 public:\
77  virtual HIObject IQuery(kInterfaceID pInterfaceID, int IsLocal=0)IsPure;\
78  virtual void Destroy(int IsLocal=0)IsPure;\
79 
80 #define IQuery_Declare(IsPure)\
81 public:\
82  virtual HIObject IQuery (kInterfaceID pInterfaceID, int IsLocal=0)IsPure;\
83 
84 class IObject {
85  IObject_Declare(abstract);
86 };
87 
88 typedef HIObject (* kObjectCreatorFnc)(HIObject pOwner,const char *pName,void *pData);
89 
90 #ifdef KARCH_DEV_MSC
91  #define K_INTERFACE_SPECIAL __declspec(novtable)
92  #define NO_DLL __declspec() // Use for the Module parameter if the interface is not exported
93 #else
94  #define K_INTERFACE_SPECIAL
95  #define NO_DLL // Use for the Module parameter if the interface is not exported
96 #endif
97 
98 #define K_INTERFACE( Name,Id ) \
99 K_FORWARD( Name ); \
100 const int Name##ID = Id; \
101 class K_INTERFACE_SPECIAL Name : IObjectDerived { \
102  Name##_Declare(abstract); \
103 }
104 
105 #endif // Must be the last line of the include file
106 
107 
K_FORWARD(KStringList)
#define IObject_Declare(IsPure)
Definition: iobject.h:75
unsigned long kInterfaceID
other types
Definition: iobject.h:49
IObject * HIObject
Definition: iobject.h:46
HIObject(* kObjectCreatorFnc)(HIObject pOwner, const char *pName, void *pData)
Definition: iobject.h:88