CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
DbClass.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24
25
26#ifndef _ODDBCLASS_INCLUDED_
27#define _ODDBCLASS_INCLUDED_
28
29#include "TD_PackPush.h"
30
31#include "RxObject.h"
32
34//OdRxClass* ClassName::saveAsClass(OdRxClass*) const
35//{
36// return PseudoBaseClass::saveAsClass(PseudoBaseClass::desc());
37//}
38//
44
45
49#define ODDB_PSEUDO_DECLARE_MEMBERS(ClassName) \
50public: \
51 ODRX_DECLARE_MEMBERS(ClassName); \
52 static OdPseudoConstructorType g_pMainConstr; \
53 OdRxClass* saveAsClass(OdRxClass* pClass) const
54
59#define ODDB_PSEUDO_DEFINE_INIT_MEMBERS(ClassName,ParentClass,pseudoConsFn,PseudoBaseClass) \
60 \
61/* Registers this class. */ \
62void ClassName::rxInit() \
63{ \
64 if (!ClassName::g_pDesc) \
65 { \
66 OdRxClass* pParent = ParentClass::desc(); \
67 OdRxClass* pPseudoBase = PseudoBaseClass::desc(); \
68 if (!pParent->isDerivedFrom(pPseudoBase)) \
69 { \
70 throw OdError(eNotThatKindOfClass); \
71 } \
72 ClassName::g_pDesc = PseudoBaseClass::desc(); \
73 g_pMainConstr = pPseudoBase->constructor(); \
74 pPseudoBase->setConstructor(ClassName::pseudoConstructor); \
75 } \
76 else \
77 { \
78 ODA_ASSERT(("Class ["#ClassName"] is already initialized.",0)); \
79 throw OdError(eExtendedError); \
80 } \
81} \
82 \
83/* Unregisters this class. */ \
84void ClassName::rxUninit() \
85{ \
86 if (ClassName::g_pDesc) \
87 { \
88 OdRxClass* pPseudoBase = PseudoBaseClass::desc(); \
89 pPseudoBase->setConstructor(g_pMainConstr); \
90 ClassName::g_pMainConstr = 0; \
91 ClassName::g_pDesc = 0; \
92 } \
93 else \
94 { \
95 ODA_ASSERT(("Class ["#ClassName"] is not initialized yet.",0)); \
96 throw OdError(eNotInitializedYet); \
97 } \
98}
99
103#define ODDB_PSEUDO_DEFINE_MEMBERS(ClassName,ParentClass,PseudoBaseClass,DOCREATE) \
104 \
105ODRX_DEFINE_RTTI_MEMBERS(ClassName,ParentClass) \
106 \
107ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE) \
108 \
109ODDB_PSEUDO_DEFINE_INIT_MEMBERS(ClassName,ParentClass,pseudoConsFn,PseudoBaseClass) \
110 \
111OdPseudoConstructorType ClassName::g_pMainConstr = 0; \
112 \
113OdRxClass* ClassName::saveAsClass(OdRxClass*) const \
114{ \
115 return PseudoBaseClass::saveAsClass(PseudoBaseClass::desc()); \
116}
117
118#include "TD_PackPop.h"
119
120#endif //_ODDBCLASS_INCLUDED_