CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
RxProperty.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.
24// Examples:
25//
26// R/W Property
27// ODRX_DECLARE_RX_PROPERTY_START(OdDbDatabase, Splinetype, int)
28// ODRX_DECLARE_RX_PROPERTY_GET_BY_VAL(OdDbDatabase, getSPLINETYPE, int);
29// ODRX_DECLARE_RX_PROPERTY_SET_BY_VAL(OdDbDatabase, setPLINETYPE, int);
30// ODRX_DECLARE_RX_PROPERTY_END;
31//
32// R/O Property
33// ODRX_DECLARE_RX_PROPERTY_START(OdDbDatabase, Splinetype, int)
34// ODRX_DECLARE_RX_PROPERTY_GET_BY_VAL(OdDbDatabase, getPLINETYPE, int);
35// ODRX_DECLARE_RX_PROPERTY_READONLY;
36// ODRX_DECLARE_RX_PROPERTY_END;
37//
38// R/W Property with subproperty
39// ODRX_DECLARE_RX_PROPERTY_START(OdDbDatabase, Pextmin, OdGePoint3d)
40// ODRX_DECLARE_RX_PROPERTY_GET_BY_VAL(OdDbDatabase, getPEXTMIN, OdGePoint3d);
41// ODRX_DECLARE_RX_PROPERTY_SET_BY_VAL(OdDbDatabase, setPEXTMIN, OdGePoint3d);
42// ODRX_DECLARE_RX_PROPERTY_SUBCHILDREN_START
43// ODRX_DECLARE_RX_PROPERTY_SUBCHILDREN_ADD(X, double);
44// ODRX_DECLARE_RX_PROPERTY_SUBCHILDREN_ADD(Y, double);
45// ODRX_DECLARE_RX_PROPERTY_SUBCHILDREN_ADD(Z, double);
46// ODRX_DECLARE_RX_PROPERTY_SUBCHILDREN_END;
47// ODRX_DECLARE_RX_PROPERTY_END;
48//
50
51#ifndef _RXPROPERTY_H_INCLUDED_
52#define _RXPROPERTY_H_INCLUDED_
53
54#include "RxMember.h"
55#include "RxObjectImpl.h"
56
57class OdRxPropertyBaseImpl;
58class OdRxValueIteratorImpl;
59class OdRxPropertyIteratorImpl;
60class OdRxDictionaryPropertyImpl;
61class OdRxPropertyImpl;
62class OdRxCollectionPropertyImpl;
63class OdRxIndexedPropertyImpl;
64
71{
72public:
74 virtual bool isReadOnly(const OdRxObject* pO) const;
75protected:
76 OdRxPropertyBase(OdRxPropertyBaseImpl*);
77};
78
80
86{
87public:
90
98
108protected:
113 virtual OdResult subGetValue(const OdRxObject* pO, OdRxValue& value) const;
114
119 virtual OdResult subSetValue(OdRxObject* pO, const OdRxValue& value) const;
120 friend class OdRxPropertyImpl;
122 OdRxProperty(OdRxPropertyImpl*);
123};
124
126
132{
133public:
135 virtual OdResult getValue(const OdRxProperty* pProp, const OdRxObject* pO, OdRxValue& value) const;
136 virtual OdResult setValue(const OdRxProperty* pProp, OdRxObject* pO, const OdRxValue& value) const;
137};
138
139
146{
147public:
149};
150
156{
162 virtual bool done() = 0;
167 virtual bool next() = 0;
172 virtual OdRxValue current() const = 0;
173};
174
176
181{
182public:
185 OdResult tryGetCount(const OdRxObject* pO, int& count) const;
187protected:
189 virtual OdResult subTryGetCount(const OdRxObject* pO, int& count) const;
190 using OdRxMember::init;
191 friend class OdRxCollectionPropertyImpl;
193 OdRxCollectionProperty(OdRxCollectionPropertyImpl* pImpl);
194};
195
197
202{
203public:
206 virtual OdResult tryGetCount(const OdRxCollectionProperty* pProp, const OdRxObject* pO, int& count) const;
207};
208
213{
214public:
221protected:
222 virtual OdResult subGetValue(const OdRxObject* pO, int index, OdRxValue& value) const { return eNotApplicable; }
223 virtual OdResult subSetValue(OdRxObject* pO, int index, const OdRxValue& value) const { return eNotApplicable; }
224 virtual OdResult subInsertValue(OdRxObject* pO, int index, const OdRxValue& value) const { return eNotApplicable; }
225 virtual OdResult subRemoveValue(OdRxObject* pO, int index) const { return eNotApplicable; }
227 friend class OdRxIndexedPropertyImpl;
228 OdRxIndexedProperty(OdRxIndexedPropertyImpl* pImpl);
229};
230
231
233
238{
239public:
241 OdResult getValue(const OdRxObject* pO, const OdString& key, OdRxValue& value) const;
242 OdResult setValue(OdRxObject* pO, const OdString& key, const OdRxValue& value) const;
244protected:
245 virtual OdResult subGetValue(const OdRxObject* pO, const OdString& key, OdRxValue& value) const { return eNotApplicable; }
246 virtual OdResult subSetValue(OdRxObject* pO, const OdString& key, const OdRxValue& value) const { return eNotApplicable; }
248 friend class OdRxDictionaryPropertyImpl;
249 OdRxDictionaryProperty(OdRxDictionaryPropertyImpl* pImpl);
250};
251
252#define ODRX_DECLARE_RX_PROPERTY_RO(Object, Name, Type) struct Object ## Name ## Property : OdRxProperty {\
253 static OdRxMemberPtr createObject(const OdRxClass* owner)\
254 {\
255 OdRxMemberPtr res = OdRxObjectImpl<Object ## Name ## Property>::createObject();\
256 ((Object ## Name ## Property*)res.get())->init(__OD_T(#Name), &OdRxValueType::Desc<Type>::value(), owner);\
257 return res;\
258 }\
259 virtual OdResult subGetValue(const OdRxObject* pO, OdRxValue& value) const ODRX_OVERRIDE;\
260 virtual bool isReadOnly(const OdRxObject*) const ODRX_OVERRIDE { return true; }\
261}
262
263#define ODRX_DECLARE_RX_PROPERTY(Object, Name, Type) struct Object ## Name ## Property : OdRxProperty {\
264 static OdRxMemberPtr createObject(const OdRxClass* owner)\
265 {\
266 OdRxMemberPtr res = OdRxObjectImpl<Object ## Name ## Property>::createObject();\
267 ((Object ## Name ## Property*)res.get())->init(__OD_T(#Name), &OdRxValueType::Desc<Type>::value(), owner);\
268 return res;\
269 }\
270 virtual OdResult subGetValue(const OdRxObject* pO, OdRxValue& value) const ODRX_OVERRIDE;\
271 virtual OdResult subSetValue(OdRxObject* pO, const OdRxValue& value) const ODRX_OVERRIDE;\
272}
273
274#define ODRX_DECLARE_RX_INDEXED_PROPERTY(Object, Name, Type) \
275struct Object ## Name ## Property : OdRxIndexedProperty {\
276 static OdRxMemberPtr createObject(const OdRxClass* owner)\
277 {\
278 OdRxMemberPtr res = OdRxObjectImpl<Object ## Name ## Property>::createObject();\
279 ((Object ## Name ## Property*)res.get())->init(__OD_T(#Name), &OdRxValueType::Desc<Type>::value(), owner);\
280 return res;\
281 }\
282 virtual OdResult subGetValue(const OdRxObject* pO, int index, OdRxValue& value) const ODRX_OVERRIDE; \
283 virtual OdResult subSetValue(OdRxObject* pO, int index, const OdRxValue& value) const ODRX_OVERRIDE; \
284 virtual OdResult subInsertValue(OdRxObject* pO, int index, const OdRxValue& value) const ODRX_OVERRIDE; \
285 virtual OdResult subRemoveValue(OdRxObject* pO, int index) const ODRX_OVERRIDE; \
286 virtual OdRxValueIteratorPtr subNewValueIterator(const OdRxObject* pO) const ODRX_OVERRIDE;\
287 virtual OdResult subTryGetCount(const OdRxObject* pO, int& count) const ODRX_OVERRIDE;\
288}
289
290#define ODRX_DECLARE_RX_CPLX_INDEXED_PROPERTY(Object, Name, Type) \
291struct Object ## Name ## Property : OdRxIndexedProperty {\
292 static OdRxMemberPtr createObject(const OdRxClass* owner)\
293 {\
294 OdRxMemberPtr res = OdRxObjectImpl<Object ## Name ## Property>::createObject();\
295 ((Object ## Name ## Property*)res.get())->init(__OD_T(#Name), &OdRxValueType::Desc<Type>::value(), owner);\
296 return res;\
297 }\
298 virtual OdResult subGetValue(const OdRxObject* pO, int index, OdRxValue& value) const ODRX_OVERRIDE; \
299 virtual OdResult subSetValue(OdRxObject* pO, int index, const OdRxValue& value) const ODRX_OVERRIDE; \
300 virtual OdResult subInsertValue(OdRxObject* pO, int index, const OdRxValue& value) const ODRX_OVERRIDE; \
301 virtual OdResult subRemoveValue(OdRxObject* pO, int index) const ODRX_OVERRIDE; \
302 virtual OdRxValueIteratorPtr subNewValueIterator(const OdRxObject* pO) const ODRX_OVERRIDE;\
303 virtual OdResult subTryGetCount(const OdRxObject* pO, int& count) const ODRX_OVERRIDE;\
304 virtual OdResult subChildren(OdArray<OdRxMemberPtr>& children) const ODRX_OVERRIDE;\
305}
306
307#define ODRX_DECLARE_RX_PROPERTY_START(Object, Name, Type) struct Object ## Name ## Property : OdRxProperty {\
308 static OdRxMemberPtr createObject(const OdRxClass* owner)\
309 {\
310 OdRxMemberPtr res = OdRxObjectImpl<Object ## Name ## Property>::createObject();\
311 ((Object ## Name ## Property*)res.get())->init(__OD_T(#Name), &OdRxValueType::Desc<Type>::value(), owner);\
312 return res;\
313 }
314
315#define ODRX_DECLARE_RX_PROPERTY_END }
316
317#define ODRX_DECLARE_RX_PROPERTY_READONLY virtual bool isReadOnly(const OdRxObject*) const ODRX_OVERRIDE { return true; }
318
319#define ODRX_DECLARE_RX_PROPERTY_GET_BY_VAL(Object, ObjGetMemberName, Type) \
320 virtual OdResult subGetValue(const OdRxObject* pO, OdRxValue& value) const ODRX_OVERRIDE\
321 {\
322 Object ## Ptr pObj = Object::cast(pO);\
323 if (pObj.isNull()) return eNotApplicable;\
324 value = static_cast<Type>(pObj->ObjGetMemberName());\
325 return eOk;\
326 }
327
328#define ODRX_DECLARE_RX_PROPERTY_SET_BY_VAL(Object, ObjSetMemberName, Type) \
329 virtual OdResult subSetValue(OdRxObject* pO, const OdRxValue& value) const ODRX_OVERRIDE\
330 {\
331 Object ## Ptr pObj = Object::cast(pO);\
332 if (pObj.isNull()) return eNotApplicable;\
333 pObj->ObjSetMemberName(*rxvalue_cast<Type>(&value));\
334 return eOk;\
335 }
336
337#define ODRX_DECLARE_RX_PROPERTY_SUBCHILDREN_START \
338 virtual OdResult subChildren(OdArray<OdRxMemberPtr>& children) const {
339
340#define ODRX_DECLARE_RX_PROPERTY_SUBCHILDREN_END return eOk; }
341
342#define ODRX_DECLARE_RX_PROPERTY_SUBCHILDREN_ADD(Name, Type) \
343 children.append(OdRxSubProperty::createObject(__OD_T(#Name), OdRxValueType::Desc<Type>::value(), this))
344
345// Subproperty allows access to the individual components of a complex type
346
351{
352protected:
354public:
355 static OdRxMemberPtr createObject(const OdString& memberName, const OdRxValueType& type, const OdRxProperty* owner);
356 virtual bool isReadOnly(const OdRxObject* pO) const ODRX_OVERRIDE;
359};
360
365{
366protected:
368public:
369 static OdRxMemberPtr createObject(const OdString& memberName, const OdRxValueType& type, const OdRxIndexedProperty* owner);
372};
373
378{
379protected:
381public:
382 static OdRxMemberPtr createObject(const OdString& memberName, const OdRxValueType& type, const OdRxProperty* owner);
388 virtual OdResult subTryGetCount(const OdRxObject* pO, int& count) const ODRX_OVERRIDE;
389};
390
391
392
393#endif
#define ODRX_ABSTRACT
#define ODRX_OVERRIDE
OdResult
Definition: OdResult.h:29
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
OdSmartPtr< OdRxPropertyBase > OdRxPropertyBasePtr
Definition: RxProperty.h:79
OdSmartPtr< OdRxProperty > OdRxPropertyPtr
Definition: RxProperty.h:125
OdSmartPtr< OdRxValueIterator > OdRxValueIteratorPtr
Definition: RxProperty.h:175
OdSmartPtr< OdRxCollectionProperty > OdRxCollectionPropertyPtr
Definition: RxProperty.h:196
OdSmartPtr< OdRxIndexedProperty > OdRxIndexedPropertyPtr
Definition: RxProperty.h:232
virtual OdResult subTryGetCount(const OdRxObject *pO, int &count) const
ODRX_DECLARE_MEMBERS(OdRxCollectionProperty)
OdRxCollectionProperty(OdRxCollectionPropertyImpl *pImpl)
OdRxValueIteratorPtr newValueIterator(const OdRxObject *pO) const
OdResult tryGetCount(const OdRxObject *pO, int &count) const
virtual OdRxValueIteratorPtr subNewValueIterator(const OdRxObject *pO) const
ODRX_DECLARE_MEMBERS(OdRxCollectionPropertyOverrule)
virtual OdResult tryGetCount(const OdRxCollectionProperty *pProp, const OdRxObject *pO, int &count) const
virtual OdRxValueIterator * newValueIterator(const OdRxCollectionProperty *pProp, const OdRxObject *pO) const
OdResult setValue(OdRxObject *pO, const OdString &key, const OdRxValue &value) const
OdRxDictionaryProperty(OdRxDictionaryPropertyImpl *pImpl)
ODRX_DECLARE_MEMBERS(OdRxDictionaryProperty)
static OdRxCollectionPropertyPtr createObject(const OdString &name, const OdRxValueType &type, const OdRxObject *owner=NULL)
OdResult getValue(const OdRxObject *pO, const OdString &key, OdRxValue &value) const
virtual OdResult subSetValue(OdRxObject *pO, const OdString &key, const OdRxValue &value) const
Definition: RxProperty.h:246
virtual OdResult subGetValue(const OdRxObject *pO, const OdString &key, OdRxValue &value) const
Definition: RxProperty.h:245
OdResult getValue(const OdRxObject *pO, int index, OdRxValue &value) const
OdResult removeValue(OdRxObject *pO, int index) const
OdRxIndexedProperty(OdRxIndexedPropertyImpl *pImpl)
virtual OdResult subGetValue(const OdRxObject *pO, int index, OdRxValue &value) const
Definition: RxProperty.h:222
OdResult setValue(OdRxObject *pO, int index, const OdRxValue &value) const
virtual OdResult subSetValue(OdRxObject *pO, int index, const OdRxValue &value) const
Definition: RxProperty.h:223
virtual OdResult subRemoveValue(OdRxObject *pO, int index) const
Definition: RxProperty.h:225
static OdRxCollectionPropertyPtr createObject(const OdString &name, const OdRxValueType &type, const OdRxObject *owner=NULL)
virtual OdResult subInsertValue(OdRxObject *pO, int index, const OdRxValue &value) const
Definition: RxProperty.h:224
OdResult insertValue(OdRxObject *pO, int index, const OdRxValue &value) const
ODRX_DECLARE_MEMBERS(OdRxIndexedProperty)
virtual OdResult subRemoveValue(OdRxObject *pO, int index) const ODRX_OVERRIDE
virtual OdResult subGetValue(const OdRxObject *pO, int index, OdRxValue &value) const ODRX_OVERRIDE
virtual OdResult subSetValue(OdRxObject *pO, int index, const OdRxValue &value) const ODRX_OVERRIDE
virtual OdResult subInsertValue(OdRxObject *pO, int index, const OdRxValue &value) const ODRX_OVERRIDE
static OdRxMemberPtr createObject(const OdString &memberName, const OdRxValueType &type, const OdRxProperty *owner)
virtual OdRxValueIteratorPtr subNewValueIterator(const OdRxObject *pO) const ODRX_OVERRIDE
virtual OdResult subTryGetCount(const OdRxObject *pO, int &count) const ODRX_OVERRIDE
void init(const OdString &name, const OdRxValueType *type, const OdRxObject *owner=0)
ODRX_DECLARE_MEMBERS(OdRxPromotingQueryContext)
ODRX_DECLARE_MEMBERS(OdRxPropertyBase)
virtual bool isReadOnly(const OdRxObject *pO) const
OdRxPropertyBase(OdRxPropertyBaseImpl *)
OdResult setValue(OdRxObject *pO, const OdRxValue &value) const
OdResult getValue(const OdRxObject *pO, OdRxValue &value) const
OdRxProperty(OdRxPropertyImpl *)
ODRX_DECLARE_MEMBERS(OdRxProperty)
virtual OdResult subSetValue(OdRxObject *pO, const OdRxValue &value) const
virtual OdResult subGetValue(const OdRxObject *pO, OdRxValue &value) const
ODRX_DECLARE_MEMBERS(OdRxPropertyOverrule)
virtual OdResult getValue(const OdRxProperty *pProp, const OdRxObject *pO, OdRxValue &value) const
virtual OdResult setValue(const OdRxProperty *pProp, OdRxObject *pO, const OdRxValue &value) const
virtual bool isReadOnly(const OdRxObject *pO) const ODRX_OVERRIDE
virtual OdResult subGetValue(const OdRxObject *pO, OdRxValue &value) const ODRX_OVERRIDE
virtual OdResult subSetValue(OdRxObject *pO, const OdRxValue &value) const ODRX_OVERRIDE
static OdRxMemberPtr createObject(const OdString &memberName, const OdRxValueType &type, const OdRxProperty *owner)
virtual OdResult subSetValue(OdRxObject *pO, int index, const OdRxValue &value) const ODRX_OVERRIDE
static OdRxMemberPtr createObject(const OdString &memberName, const OdRxValueType &type, const OdRxIndexedProperty *owner)
virtual OdResult subGetValue(const OdRxObject *pO, int index, OdRxValue &value) const ODRX_OVERRIDE
GLuint index
Definition: gles2_ext.h:265
GLuint const GLchar * name
Definition: gles2_ext.h:265
GLsizei GLsizei * count
Definition: gles2_ext.h:276
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
ODRX_DECLARE_MEMBERS(OdRxValueIterator)
virtual bool done()=0
virtual OdRxValue current() const =0
virtual bool next()=0