CFx SDK Documentation  2023 SP0
TfObject.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, 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 Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 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 #ifndef __TF_OBJECT_H__
25 #define __TF_OBJECT_H__
26 
27 #include "TD_PackPush.h"
28 
29 #include "RxObject.h"
30 #include "RxIterator.h"
31 #include "TfVariant.h"
32 #include "TfObjectReactor.h"
33 #include "DbStubPtrArray.h"
34 #include "Gi/GiDrawable.h"
35 
36 #define ODTF_CREATE_ATTRIBUTE(Name, value) \
37  reuslt.push_back(::newOdTfAttribute(OD_T(#Name), pObject, value));
38 
39 #define ODTF_DEFINE_ATTRIBUTES_CONSTRUCTOR(Name, ATTRIBUTES_LIST) \
40  static OdArray<OdTfAttribute*> Name##AttributesConstructor( \
41  OdRxObject* pObject) { \
42  OdArray<OdTfAttribute*> result; \
43  ATTRIBUTES_LIST(ODTF_CREATE_ATTRIBUTE) \
44  return result; \
45  }
46 
47 #define ODTF_CREATE_PROPERTY_NO_ATTRS(PropertyName, type, gettterFn, setterFn, \
48  defaultItemFn) \
49  result.push_back(::newOdTfProperty( \
50  OD_T(#PropertyName), pClass, static_cast<OdTfVariant::Type>(type), NULL, \
51  defaultItemFn, gettterFn, setterFn));
52 
53 #define ODTF_DEFINE_PROPERTIES_CONSTRUCTOR(ClassName, PROPERTIES_LIST) \
54  static OdArray<OdTfProperty*> ClassName##propertiesConstructor( \
55  OdTfClass* pClass) { \
56  OdArray<OdTfProperty*> result; \
57  PROPERTIES_LIST(ODTF_CREATE_PROPERTY_NO_ATTRS); \
58  return result; \
59  }
60 
61 #define ODTF_DECLARE_MEMBERS(ClassName)\
62  ODRX_DECLARE_MEMBERS_GENERIC(OdTfClass, ClassName)
63 
64 #define ODTF_DEFINE_RTTI_MEMBERS(ClassName, ParentClass) \
65  ODRX_DEFINE_RTTI_MEMBERS_GENERIC(OdTfClass, ClassName, ParentClass)
66 
67 #define ODTF_DEFINE_INIT_MEMBERS(ClassName, ParentClass, attrsConsFn, \
68  propsConsFn, pseudoConsFn, szClassName) \
69  ODRX_DEFINE_INIT_MEMBERS_GENERIC( \
70  ClassName, (::newOdTfClass(szClassName, ParentClass::desc(), \
71  attrsConsFn, propsConsFn, pseudoConsFn)), \
72  (::newOdTfClass(szClassName, ParentClass::desc(), attrsConsFn, \
73  propsConsFn, pseudoConsFn)))
74 
75 #define ODTF_DEFINE_MEMBERS2(ClassName, ParentClass, attrsConsFn, propsConsFn, \
76  pseudoConsFn, szClassName) \
77  \
78  ODTF_DEFINE_RTTI_MEMBERS(ClassName, ParentClass) \
79  ODTF_DEFINE_INIT_MEMBERS(ClassName, ParentClass, attrsConsFn, propsConsFn, \
80  pseudoConsFn, szClassName)
81 
82 #define ODTF_NO_CONS_NO_ATTRS_NO_PROPS_DEFINE_MEMBERS(ClassName, ParentClass) \
83  \
84  ODTF_DEFINE_MEMBERS2(ClassName, ParentClass, NULL, NULL, NULL, \
85  OD_T(#ClassName)) \
86  \
87  ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName, EMPTY_CONSTR)
88 
89 #define ODTF_NO_CONS_NO_ATTRS_PROPS_DEFINE_MEMBERS(ClassName, ParentClass, \
90  PROPERTIES_LIST) \
91  ODTF_DEFINE_PROPERTIES_CONSTRUCTOR(ClassName, PROPERTIES_LIST) \
92  ODTF_DEFINE_MEMBERS2(ClassName, ParentClass, NULL, \
93  ClassName##propertiesConstructor, NULL, \
94  OD_T(#ClassName)) \
95  \
96  ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName, EMPTY_CONSTR)
97 
98 #define ODTF_CONS_NO_ATTRS_PROPS_DEFINE_MEMBERS(ClassName, ParentClass, \
99  PROPERTIES_LIST, DOCREATE) \
100  ODTF_DEFINE_PROPERTIES_CONSTRUCTOR(ClassName, PROPERTIES_LIST) \
101  ODTF_DEFINE_MEMBERS2(ClassName, ParentClass, NULL, \
102  ClassName##propertiesConstructor, \
103  ClassName::pseudoConstructor, OD_T(#ClassName)) \
104  \
105  ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName, DOCREATE)
106 
107 #define ODTF_CONS_NO_ATTRS_NO_PROPS_DEFINE_MEMBERS(ClassName, ParentClass, \
108  DOCREATE) \
109  ODTF_DEFINE_MEMBERS2(ClassName, ParentClass, NULL, NULL, \
110  ClassName::pseudoConstructor, OD_T(#ClassName)) \
111  \
112  ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName, DOCREATE)
113 
114 class OdTfClass;
115 class OdTfProperty;
116 class OdTfAttribute;
117 
120 public:
121  virtual OdRxObject* owner() const = 0;
122  virtual const OdTfAttribute* find(const OdString& name) const = 0;
123 };
125 
126 
129 public:
131 
132  virtual OdTfClass* owner() const = 0;
133  virtual size_type size() const = 0;
134  virtual bool contains(const OdTfProperty* pProp) const = 0;
135  virtual const OdTfProperty* find(size_type index) const = 0;
136  virtual const OdTfProperty* find(const OdString& name) const = 0;
137  virtual const OdTfProperty* find(const OdString& name,
138  const OdTfVariant::Type type) const = 0;
139  virtual size_type index(const OdTfProperty* pProp) const = 0;
140  virtual bool unique(const OdString& name) const = 0;
141  virtual bool unique(const OdString& name,
142  const OdTfVariant::Type type) const = 0;
143  virtual OdRxIteratorPtr iterator() const = 0;
144 };
146 
153 public:
154  virtual const OdTfAttributesContainerPtr attributes() const = 0;
155  virtual const OdTfPropertiesContainerPtr properties() const = 0;
156  virtual const OdTfPropertiesContainerPtr allProperties() const = 0;
157  virtual OdTfClass* tfParent() const = 0;
158 };
160 
167 public:
168  virtual OdTfClass* owner() const = 0;
169  virtual OdTfVariant::Type type() const = 0;
170  virtual OdString name() const = 0;
172  /*
173  Returns default value, that should be used for this property instead of
174  OdTfVariant::kEmpty.
175  For single property it returns value, that should be used in place of whole
176  property.
177  For array property it returns value, to replace empty items.
178  */
179  virtual OdTfVariant defaultItemValue() const = 0;
180  virtual OdResult getValue(const OdTfObject* pObject,
181  OdTfVariant& value) const = 0;
182  virtual OdResult setValue(OdTfObject* pObject,
183  const OdTfVariant& value) const = 0;
184 };
186 
193 public:
194  virtual OdRxObject* owner() const = 0;
195  virtual OdString name() const = 0;
196  virtual OdTfVariant value() const = 0;
197 };
199 
206 
207 public:
210 
214  virtual const OdTfObject* getOwner() const = 0;
215 
217  const OdTfProperty* pPI, OdTfVariant& value,
218  const ItemIndexType arrayIndex = -1) const = 0;
219 
221  const OdTfProperty* pPI, const OdTfVariant& value,
222  const ItemIndexType arrayIndex = -1) = 0;
223 
233  const OdString& name, OdTfVariant& value,
234  const ItemIndexType arrayIndex = -1,
235  const OdTfClass* pClass = NULL) const = 0;
245  const OdTfVariant& value,
246  const ItemIndexType arrayIndex = -1,
247  const OdTfClass* pClass = NULL) = 0;
257  const PropertyIndexType propertyIndex, OdTfVariant& value,
258  const ItemIndexType arrayIndex = -1) const = 0;
268  const PropertyIndexType propertyIndex, const OdTfVariant& value,
269  const ItemIndexType arrayIndex = -1) = 0;
270 
280  virtual void addReactor(OdTfObjectReactor* pReactor) = 0;
281 
291  virtual void removeReactor(OdTfObjectReactor* pReactor) = 0;
292 
306 
317 
324  virtual bool hasPersistentReactor(OdTfPersistentReactor*) const = 0;
325 
333 
339  virtual void getTransientReactors(OdTfObjectReactorArray& reactors) = 0;
340 };
342 
343 //
344 //
345 //
346 
350  OdTfVariant&);
352  const OdTfVariant&);
354 
356  const OdString& name, OdRxClass* pBaseClass,
357  OdTfAttributesConstructorType pAttrsConstr,
359  bool bRegister = true);
360 
362 
364  OdTfClass* pClass, const OdString& name, OdRxClass* pBaseClass,
365  const OdArray<OdTfAttribute*>& attributes,
366  const OdArray<OdTfProperty*>& properties, OdPseudoConstructorType pConstr,
367  bool bRegister = true);
368 
370  const OdString& name, OdTfClass* pOwner, OdTfVariant::Type type,
371  OdTfAttributesConstructorType pAttrsConstr,
372  OdTfVariantConstructorType pDefaultValueConstructor,
374 
376 
378  OdTfProperty* pProp, const OdString& name, OdTfClass* pOwner,
380  OdTfVariantConstructorType pDefaultValueConstructor,
382 
384  OdRxObject* pOwner,
385  const OdTfVariant& value);
386 
387 #endif // __TF_OBJECT_H__
#define NULL
Definition: GsProperties.h:177
int OdInt32
#define ODRX_ABSTRACT
OdResult
Definition: OdResult.h:29
OdRxObjectPtr(* OdPseudoConstructorType)()
Definition: RxObject.h:868
#define ODRX_DECLARE_MEMBERS(ClassName)
Definition: RxObject.h:131
#define TFCORE_EXPORT
Definition: TfExport.h:34
TFCORE_EXPORT OdTfClass * initOdTfClass(OdTfClass *pClass, const OdString &name, OdRxClass *pBaseClass, const OdArray< OdTfAttribute * > &attributes, const OdArray< OdTfProperty * > &properties, OdPseudoConstructorType pConstr, bool bRegister=true)
OdSmartPtr< OdTfAttribute > OdTfAttributePtr
Definition: TfObject.h:198
OdSmartPtr< OdTfProperty > OdTfPropertyPtr
Definition: TfObject.h:185
OdResult(* OdTfPropertySetterType)(OdTfObject *, const OdTfVariant &)
Definition: TfObject.h:351
OdSmartPtr< OdTfAttributesContainer > OdTfAttributesContainerPtr
Definition: TfObject.h:124
TFCORE_EXPORT OdTfProperty * createOdTfProperty()
TFCORE_EXPORT OdTfProperty * newOdTfProperty(const OdString &name, OdTfClass *pOwner, OdTfVariant::Type type, OdTfAttributesConstructorType pAttrsConstr, OdTfVariantConstructorType pDefaultValueConstructor, OdTfPropertyGetterType pGetter, OdTfPropertySetterType pSetter)
TFCORE_EXPORT OdTfClass * newOdTfClass(const OdString &name, OdRxClass *pBaseClass, OdTfAttributesConstructorType pAttrsConstr, OdTfPropertiesConstructorType pPropsConstr, OdPseudoConstructorType pConstr, bool bRegister=true)
TFCORE_EXPORT OdTfProperty * initOdTfProperty(OdTfProperty *pProp, const OdString &name, OdTfClass *pOwner, OdTfVariant::Type type, const OdArray< OdTfAttribute * > &attributes, OdTfVariantConstructorType pDefaultValueConstructor, OdTfPropertyGetterType pGetter, OdTfPropertySetterType pSetter)
OdArray< OdTfProperty * >(* OdTfPropertiesConstructorType)(OdTfClass *)
Definition: TfObject.h:347
OdSmartPtr< OdTfClass > OdTfClassPtr
Definition: TfObject.h:159
TFCORE_EXPORT OdTfClass * createOdTfClass()
OdSmartPtr< OdTfPropertiesContainer > OdTfPropertiesContainerPtr
Definition: TfObject.h:145
#define ODTF_DECLARE_MEMBERS(ClassName)
Definition: TfObject.h:61
OdResult(* OdTfPropertyGetterType)(const OdTfObject *, OdTfVariant &)
Definition: TfObject.h:349
TFCORE_EXPORT OdTfAttribute * newOdTfAttribute(const OdString &name, OdRxObject *pOwner, const OdTfVariant &value)
OdTfVariant(* OdTfVariantConstructorType)()
Definition: TfObject.h:353
OdSmartPtr< OdTfObject > OdTfObjectPtr
Definition: TfObject.h:341
OdArray< OdTfAttribute * >(* OdTfAttributesConstructorType)(OdRxObject *)
Definition: TfObject.h:348
A::size_type size_type
Definition: OdArray.h:593
virtual OdString name() const =0
virtual OdRxObject * owner() const =0
virtual OdTfVariant value() const =0
virtual const OdTfAttribute * find(const OdString &name) const =0
virtual OdRxObject * owner() const =0
virtual const OdTfPropertiesContainerPtr properties() const =0
virtual OdTfClass * tfParent() const =0
virtual const OdTfAttributesContainerPtr attributes() const =0
virtual const OdTfPropertiesContainerPtr allProperties() const =0
virtual bool hasPersistentReactor(OdTfPersistentReactor *) const =0
virtual OdResult setProperty(const OdString &name, const OdTfVariant &value, const ItemIndexType arrayIndex=-1, const OdTfClass *pClass=NULL)=0
virtual OdResult setProperty(const OdTfProperty *pPI, const OdTfVariant &value, const ItemIndexType arrayIndex=-1)=0
virtual OdResult getProperty(const PropertyIndexType propertyIndex, OdTfVariant &value, const ItemIndexType arrayIndex=-1) const =0
virtual void removePersistentReactor(OdTfPersistentReactor *)=0
virtual void removeReactor(OdTfObjectReactor *pReactor)=0
virtual void getPersistentReactors(OdTfPersistentReactorArray &elmIds)=0
OdTfPropertiesContainer::size_type PropertyIndexType
Definition: TfObject.h:208
OdTfVariantArray::size_type ItemIndexType
Definition: TfObject.h:209
virtual OdResult setProperty(const PropertyIndexType propertyIndex, const OdTfVariant &value, const ItemIndexType arrayIndex=-1)=0
virtual OdResult getProperty(const OdTfProperty *pPI, OdTfVariant &value, const ItemIndexType arrayIndex=-1) const =0
virtual const OdTfObject * getOwner() const =0
virtual void addReactor(OdTfObjectReactor *pReactor)=0
virtual void getTransientReactors(OdTfObjectReactorArray &reactors)=0
virtual OdResult getProperty(const OdString &name, OdTfVariant &value, const ItemIndexType arrayIndex=-1, const OdTfClass *pClass=NULL) const =0
virtual void addPersistentReactor(OdTfPersistentReactor *)=0
virtual const OdTfProperty * find(size_type index) const =0
virtual OdRxIteratorPtr iterator() const =0
virtual bool unique(const OdString &name, const OdTfVariant::Type type) const =0
virtual size_type index(const OdTfProperty *pProp) const =0
virtual const OdTfProperty * find(const OdString &name) const =0
virtual size_type size() const =0
virtual bool contains(const OdTfProperty *pProp) const =0
virtual OdTfClass * owner() const =0
virtual const OdTfProperty * find(const OdString &name, const OdTfVariant::Type type) const =0
virtual bool unique(const OdString &name) const =0
virtual OdTfAttributesContainerPtr attributes() const =0
virtual OdTfVariant defaultItemValue() const =0
virtual OdString name() const =0
virtual OdResult getValue(const OdTfObject *pObject, OdTfVariant &value) const =0
virtual OdTfClass * owner() const =0
virtual OdResult setValue(OdTfObject *pObject, const OdTfVariant &value) const =0
virtual OdTfVariant::Type type() const =0
GLuint index
Definition: gles2_ext.h:265
GLuint const GLchar * name
Definition: gles2_ext.h:265
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
GLsizei const GLfloat * value
Definition: gles2_ext.h:302