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