AGX Dynamics 2.41.2.0
Loading...
Searching...
No Matches
Parameter.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGX_PARAMETER_H
18#define AGX_PARAMETER_H
19
20#ifdef _MSC_VER
21# pragma warning( disable: 4714 )// const' marked as __forceinline not inlined
22#endif
23
24
25#include <agx/Object.h>
26#include <agxData/Value.h>
27#include <agx/Pointer.h>
28#include <agxData/Buffer.h>
29#include <agxData/EntityModel.h>
31
32namespace agxData { class FunctionValue; }
33
34namespace agx
35{
36 class Task;
45
54
56
62 {
63 public:
65
70
73 {
80 UNRESOLVED
81 };
82
83 public:
87 agx::Task *getTask();
88 const agx::Task *getTask() const;
89
93 size_t getIndex() const;
94
98 MetaType getMetaType() const;
99
104
108 bool isRequired() const;
109
113 void setRequired(bool flag);
114
118 agxData::Format *getFormat();
119 const agxData::Format *getFormat() const;
120
124 virtual agxData::Type* getType();
125 virtual const agxData::Type* getType() const;
126
130 UInt8 getAccessMode() const;
131
135 const agx::Path& getBindPath() const;
136
140 // bool isValid() const;
141 virtual bool isValid() const = 0;
142
146 agx::Object *getBinding();
147 const agx::Object *getBinding() const;
148
149
153 void bind(agx::Object *binding);
154
158 void bind(const agx::Path& path);
159
163 void set(agx::Object *binding);
164
168 void unbind();
169
171 virtual bool hasGlobalResult() const;
172
173
174 virtual void rebind() override;
175 virtual Object *getResourceImpl(const Path& path, agx::Model *model) override;
176
177 virtual void update() = 0;
178 virtual void commit() = 0;
179
180 bool needUpdate();
181 bool needCommit();
182
183 protected:
184 Parameter(Model *model, MetaType type, const Name& name, agxData::Format *format, UInt8 accessMode, const Path& bindPath = Path());
185 virtual ~Parameter();
186 virtual void _bind(Object *binding) = 0;
187
188 private:
189 Parameter& operator=(const Parameter&) = delete;
190 friend class Task;
193 void setTask(Task *task, size_t index);
194
195 virtual void prepareGlobalResultSorting(size_t numJobs);
196
197 protected:
199 size_t m_index;
208 };
209
210 //---------------------------------------------------------------
211
216 {
217 public:
219
220 static UnresolvedParameter *load(TiXmlElement *eParameter, Device *device);
221 virtual void configure(TiXmlElement *eParameter) override;
222
223 public:
224 UnresolvedParameter(const agx::Name& name, const agx::String& expression);
225 UnresolvedParameter(const agx::Name& name, MetaType type, const agx::String& expression);
226
227 virtual bool isValid() const override;
228
230 const agxData::Type *getType() const override;
231
232 protected:
234 virtual void _bind(Object *binding) override;
235 virtual void update() override;
236 virtual void commit() override;
238 void init(const String& expression);
239
240 private:
241 UnresolvedParameter& operator=(const UnresolvedParameter&) = delete;
242
243 private:
244 agxData::TypeRef m_type;
246 agxData::ValueRef m_localValue;
247 };
248
249
250 //---------------------------------------------------------------
251
256 {
257 public:
259
260 static ScalarParameter *load(TiXmlElement *eParameter, Device *device);
261 virtual void configure(TiXmlElement *eParameter) override;
262
263 public:
264 ScalarParameter(const agx::Name& name, agxData::Format *format, UInt8 accessMode = agxData::READ, const String& expression = "");
265 ScalarParameter(const agx::Name& name, agxData::Format *format, UInt8 accessMode, agxData::Value *binding);
266
270 agxData::Value *getValue();
271 const agxData::Value *getValue() const;
272
273 template <typename T>
274 const T& get() const;
275
279 void set(agxData::Value *value);
280
281 template <typename T>
282 void set(const T& value);
283
285 template <typename T>
286 void write(const T& value, const Task* owner);
287
291 void setExpression(const String& expression);
292
293
294 // Only used by kernel dispatching
295 void *ptr();
296
297 virtual bool isValid() const override;
298 virtual Object *getResourceImpl(const Path& path, agx::Model *model) override;
299
300
301 void setReal( Real value );
302 Real getReal();
303
304 virtual void update() override;
305 virtual void commit() override;
306
307 protected:
309 virtual void _bind(Object *binding) override;
310
311 private:
312 ScalarParameter& operator=(const ScalarParameter&) = delete;
313 void init();
314 void triggerUpdateCallback(agxData::Value *value);
315
316 private:
317 // Parameter value is never replaced, binding the parameter will bind the value.
318 agxData::ValueRef m_value;
319
321 };
322
323 //---------------------------------------------------------------
324
329 {
330 public:
332
333
334 static ArrayParameter *load(TiXmlElement *eParameter, Device *device);
335 virtual void configure(TiXmlElement *eParameter) override;
336
337 public:
338 ArrayParameter(const agx::Name& name, agxData::Type *type, UInt8 accessMode = agxData::READ, const Path& bindPath = Path());
339 ArrayParameter(const agx::Name& name, agxData::Type *type, UInt8 accessMode, agxData::Buffer *binding);
340
341 ArrayParameter(const agx::Name& name, agxData::Format *format, UInt8 accessMode = agxData::READ, const Path& bindPath = Path());
342 ArrayParameter(const agx::Name& name, agxData::Format *format, UInt8 accessMode, agxData::Buffer *binding);
343
347 agxData::Type *getType() override;
348 const agxData::Type *getType() const override;
349
353 agxData::Buffer *getBuffer();
354 const agxData::Buffer *getBuffer() const;
355
359 template <typename T>
360 agxData::Array<T>& get();
361
362 template <typename T>
363 const agxData::Array<T>& get() const;
364
368 void setLocalSize(size_t numElements);
369
373 size_t getLocalSize() const;
374
378 size_t getNumElements() const;
379
380
385
389 UInt getGlobalResultMode() const;
390
394 GlobalResultBuffer *getGlobalResult();
395 const GlobalResultBuffer *getGlobalResult() const;
396
397 virtual bool hasGlobalResult() const override;
398
399
400 virtual bool isValid() const override;
401 virtual Object *getResourceImpl(const Path& path, agx::Model *model) override;
402
403 virtual void update() override;
404 virtual void commit() override;
405
406 protected:
408 virtual void _bind(Object *binding) override;
409 virtual void prepareGlobalResultSorting(size_t numJobs) override;
410
411 private:
412 ArrayParameter& operator=(const ArrayParameter&) = delete;
413 friend class Task;
414 void parentBindCallback(Parameter *parent);
415 void parentUnbindCallback(Parameter *parent);
416 void setBuffer(agxData::Buffer *buffer);
417
418 private:
419 static agxData::AbstractArray s_dummyArray;
420 agxData::TypeRef m_type;
422 size_t m_localMemorySize;
423 UInt m_globalResultMode;
424 GlobalResultBufferRef m_globalResult;
425 Parameter::Event::CallbackType m_parentBindCallback;
426 Parameter::Event::CallbackType m_parentUnbindCallback;
427 };
428
429 //---------------------------------------------------------------
430
434 class AGXCORE_EXPORT PointerParameter : public Parameter, public Object::EventListener
435 {
436 public:
438
439 static PointerParameter *load(TiXmlElement *eParameter, Device *device);
440 virtual void configure(TiXmlElement *eParameter) override;
441
442 public:
443 PointerParameter(const agx::Name& name, const Path& bindPath = Path());
444 PointerParameter(const agx::Name& name, Object *binding);
445
446 Object* get();
447 const Object* get() const;
448
449 template <typename T>
450 T* get();
451
452 template <typename T>
453 const T* get() const;
454
455 virtual bool isValid() const override;
456 virtual Object *getResourceImpl(const Path& path, agx::Model *model) override;
457
458 virtual void update() override;
459 virtual void commit() override;
460
461 protected:
463 virtual void _bind(Object *binding) override;
464
465 // From Object::EventListener
466 virtual void destroyCallback(agx::Object* object) override;
467
468 private:
469 PointerParameter& operator=(const PointerParameter&) = delete;
470 void init();
471 void triggerUpdateCallback(agxData::Value *value);
472
473 private:
475 };
476
477 //---------------------------------------------------------------
478
483 {
484 public:
486
487
488 static EntityDataParameter *load(TiXmlElement *eParameter, Device *device);
489 virtual void configure(TiXmlElement *eParameter) override;
490
491 public:
492 EntityDataParameter(const agx::Name& name, agxData::EntityModel *entity, const Path& bindPath);
493
496
500 agxData::EntityModel *getEntityModel();
501
505 agxData::EntityStorage *getStorage();
506
510 agxData::EntityData *getData();
511
512 template <typename T>
513 T& getData();
514
519
523 UInt getGlobalResultMode() const;
524
528 GlobalResultStorage *getGlobalResult();
529 const GlobalResultStorage *getGlobalResult() const;
530
531 // Only used by KernelGenerator for non-required parameters to set up a dummy binding
532 void setData(agxData::EntityData *dataSet);
533
534 const ParameterRefVector& getChildParameters() const;
535
536 virtual bool isValid() const override;
537 virtual Object *getResourceImpl(const Path& path, agx::Model *model) override;
538
539 virtual void update() override;
540 virtual void commit() override;
541
542 virtual bool hasGlobalResult() const override;
543
544 protected:
546 virtual void _bind(Object *binding) override;
547 virtual void prepareGlobalResultSorting(size_t numJobs) override;
548
549 // Protected because only Scalar- and ArrayParameters may be added.
550 void addChildParameter(Parameter* parameter);
551
552 private:
553 EntityDataParameter& operator=(const EntityDataParameter&) = delete;
554
555 private:
556 agxData::EntityModelRef m_entityModel;
558 agxData::EntityDataRef m_dataSet;
559 ParameterRefVector m_children;
560 UInt m_globalResultMode;
561 GlobalResultStorageRef m_globalResult;
562 bool m_childrenNeedCommit;
563 };
564
565
570 {
571 public:
573
574 static EntityPtrParameter *load(TiXmlElement *eParameter, Device *device);
575 virtual void configure(TiXmlElement *eParameter) override;
576
577 public:
579
581
583
587 agxData::EntityModel *getEntityModel();
588
592 agxData::EntityPtr getBinding();
593
594 template <typename T>
595 T getBinding();
596
597
598 virtual bool isValid() const override;
599
600 virtual void update() override;
601 virtual void commit() override;
602
603 protected:
605 virtual void _bind(Object *binding) override;
606
607 private:
608 EntityPtrParameter& operator=(EntityPtrParameter&) = delete;
609
610 private:
611 agxData::EntityModelRef m_entityModel;
612 agxData::EntityPtr m_ptr;
613
614 struct AttributeAccess
615 {
616 AttributeAccess() : attribute(nullptr), buffer(nullptr), mode(agx::InvalidIndex) {}
617 AttributeAccess(const agxData::Attribute *_attribute, agx::UInt8 _mode) : attribute(_attribute), buffer(nullptr), mode(_mode) {}
618
619 const agxData::Attribute *attribute;
620 agxData::Buffer *buffer;
621 agx::UInt8 mode;
622 };
623
624 VectorPOD<AttributeAccess> m_attributeAccessVector;
625 };
626
627
632 {
633 public:
635
636 static EntityInstanceParameter *load(TiXmlElement *eParameter, Device *device);
637 virtual void configure(TiXmlElement *eParameter) override;
638
639 public:
641
643
645
649 agxData::EntityModel *getEntityModel();
650
654 agxData::EntityInstance getBinding();
655
656 template <typename T>
657 T getBinding();
658
659
660 virtual bool isValid() const override;
661
662 virtual void update() override;
663 virtual void commit() override;
664
665 protected:
667 virtual void _bind(Object *binding) override;
668
669 private:
670 EntityInstanceParameter& operator=(const EntityInstanceParameter&) = delete;
671
672 private:
673 agxData::EntityModelRef m_entityModel;
674 agxData::EntityInstance m_instance;
675
676 struct AttributeAccess
677 {
678 AttributeAccess() : attribute(nullptr), buffer(nullptr), mode(agx::InvalidIndex) {}
679 AttributeAccess(const agxData::Attribute *_attribute, agx::UInt8 _mode) : attribute(_attribute), buffer(nullptr), mode(_mode) {}
680
681 const agxData::Attribute *attribute;
682 agxData::Buffer *buffer;
683 agx::UInt8 mode;
684 };
685
686 VectorPOD<AttributeAccess> m_attributeAccessVector;
687 };
688
689
690 //---------------------------------------------------------------
691
692
693 /* Implementation */
694
707 AGX_FORCE_INLINE const agxData::Type *Parameter::getType() const { return m_format ? m_format->getType() : nullptr; }
710
712
715
716 template <typename T>
718 {
719 agxAssertN(agxData::getFormat<T>() == m_format, "%s: Type mismatch, parameter is type %s, dereferencing using type %s", this->getPath().c_str(), m_format->fullName().c_str(), agxData::getFormat<T>()->fullName().c_str());
720 agxAssertN(m_value && m_value->isValid(), "%s: Can not dereference an unbound parameter", this->getPath().c_str());
721 return m_value->get<T>();
722 }
723
724 template <typename T>
726 {
727 if (m_binding.get() != m_value.get())
728 {
729 this->unbind();
730 m_binding = m_value;
731 }
732 m_value->set(value);
733 }
734
735 template <typename T>
736#ifdef AGX_DEBUG
737AGX_FORCE_INLINE void ScalarParameter::write(const T& value, const Task* owner)
738#else
739AGX_FORCE_INLINE void ScalarParameter::write(const T& value, const Task* /*owner*/)
740#endif
741 {
742 agxAssert(owner == this->getTask());
743 agxAssert(m_format->is(agxData::getFormat<T>()));
744 *(T*)this->ptr() = value;
745 }
746
748 {
749 return const_cast<void *>(m_value->ptr());
750 }
751
752
754 {
755 this->set( value );
756 }
757
759 {
760 return this->get<Real>();
761 }
762
764
769
770 template <typename T>
772 {
773 agxAssertN(!m_required || m_buffer, "%s: Can not dereference an unbound array parameter", this->getPath().c_str());
774 agxAssertN(agxData::getFormat<T>() == m_format, "%s: Type mismatch, parameter is type %s, dereferencing using type %s", this->getPath().c_str(), m_format->fullName().c_str(), agxData::getFormat<T>()->fullName().c_str());
775
776 return m_buffer ? m_buffer->getArray<T>() : static_cast<agxData::Array<T>&>(s_dummyArray);
777 }
778
779 template <typename T>
780 AGX_FORCE_INLINE const agxData::Array<T>& ArrayParameter::get() const { return const_cast<ArrayParameter *>(this)->get<T>(); }
781
782 AGX_FORCE_INLINE size_t ArrayParameter::getLocalSize() const { return m_localMemorySize; }
783
785 {
786 agxAssert(this->getBuffer());
787 return this->getBuffer()->size() / this->getBuffer()->getElementArraySize();
788 }
789
790
793
794 AGX_FORCE_INLINE UInt ArrayParameter::getGlobalResultMode() const { return m_globalResultMode; }
795
797
798 template <typename T>
800 {
801 agxAssertN(!this->isRequired() || dynamic_cast<T *>(m_binding.get()), "%s: Pointer parameter does not have a binding!", getPath().c_str());
802 return static_cast<T *>(m_binding.get());
803 }
804
807
808 template <typename T>
809 AGX_FORCE_INLINE const T* PointerParameter::get() const { return const_cast<PointerParameter *>(this)->get<T>(); }
810
811
813
816 AGX_FORCE_INLINE agxData::EntityData *EntityDataParameter::getData() { return m_dataSet; }
817
818 template <typename T>
819 AGX_FORCE_INLINE T& EntityDataParameter::getData() { agxAssert(m_dataSet); return *static_cast<T *>(m_dataSet.get()); }
820
822
823
826
828
830
833
834 template <typename T>
836
838
841
842 template <typename T>
844
845}
846
847
848#endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGXCORE_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
Arrays are fast accessors into the data, or a portion of it, held by a Buffer.
Definition: Array.h:37
Type-specific Array used for fast access into the data held by a Buffer.
Definition: Array.h:107
An abstract attribute description, part of an Entity.
Definition: Attribute.h:58
Abstract representation of a data buffer.
Definition: Buffer.h:56
size_t getElementArraySize() const
Definition: Buffer.h:466
size_t size() const
Definition: Buffer.h:459
Entity instance provides access to a single instance in an EntityStorage.
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
Definition: EntityModel.h:64
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:52
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:73
A format is an implementation of a agxData::Type.
Definition: Format.h:64
Abstracted type.
Definition: Type.h:98
Abstract representation of a value.
Definition: Value.h:49
Array parameter.
Definition: Parameter.h:329
agxData::Array< T > & get()
Access the data of the current buffer binding.
Definition: Parameter.h:771
ArrayParameter(const agx::Name &name, agxData::Type *type, UInt8 accessMode=agxData::READ, const Path &bindPath=Path())
virtual bool isValid() const override
virtual void prepareGlobalResultSorting(size_t numJobs) override
size_t getNumElements() const
Definition: Parameter.h:784
ArrayParameter(const agx::Name &name, agxData::Format *format, UInt8 accessMode=agxData::READ, const Path &bindPath=Path())
UInt getGlobalResultMode() const
Definition: Parameter.h:794
GlobalResultBuffer * getGlobalResult()
Definition: Parameter.h:791
virtual Object * getResourceImpl(const Path &path, agx::Model *model) override
ArrayParameter(const agx::Name &name, agxData::Format *format, UInt8 accessMode, agxData::Buffer *binding)
virtual void update() override
static agx::Model * ClassModel()
agxData::Buffer * getBuffer()
Definition: Parameter.h:765
void setLocalSize(size_t numElements)
Create a local memory allocation.
virtual void _bind(Object *binding) override
virtual void commit() override
virtual void configure(TiXmlElement *eParameter) override
size_t getLocalSize() const
Definition: Parameter.h:782
virtual bool hasGlobalResult() const override
virtual ~ArrayParameter()
void setGlobalResultMode(UInt mode)
Set the global result mode.
ArrayParameter(const agx::Name &name, agxData::Type *type, UInt8 accessMode, agxData::Buffer *binding)
static ArrayParameter * load(TiXmlElement *eParameter, Device *device)
agxData::Type * getType() override
Definition: Parameter.h:767
An agx::Device is an abstract representation of a device on which data can be stored and processed.
Definition: Device.h:58
Entity parameter.
Definition: Parameter.h:483
void addChildParameter(ArrayParameter *parameter)
agxData::EntityModel * getEntityModel()
Definition: Parameter.h:814
virtual void _bind(Object *binding) override
static EntityDataParameter * load(TiXmlElement *eParameter, Device *device)
virtual void commit() override
virtual void update() override
virtual void configure(TiXmlElement *eParameter) override
GlobalResultStorage * getGlobalResult()
Definition: Parameter.h:824
virtual void prepareGlobalResultSorting(size_t numJobs) override
void addChildParameter(ScalarParameter *parameter)
void setData(agxData::EntityData *dataSet)
void addChildParameter(Parameter *parameter)
EntityDataParameter(const agx::Name &name, agxData::EntityModel *entity, const Path &bindPath)
agxData::EntityData * getData()
Definition: Parameter.h:816
virtual Object * getResourceImpl(const Path &path, agx::Model *model) override
agxData::EntityStorage * getStorage()
Definition: Parameter.h:815
virtual bool hasGlobalResult() const override
UInt getGlobalResultMode() const
Definition: Parameter.h:827
virtual bool isValid() const override
static agx::Model * ClassModel()
void setGlobalResultMode(UInt mode)
Set the global result mode.
const ParameterRefVector & getChildParameters() const
Definition: Parameter.h:821
EntityInstance parameter.
Definition: Parameter.h:632
static EntityInstanceParameter * load(TiXmlElement *eParameter, Device *device)
virtual void configure(TiXmlElement *eParameter) override
void registerAttributeAccess(const agxData::Attribute *attribute, agx::UInt8 mode)
virtual void commit() override
void bind(agxData::EntityInstance instance)
agxData::EntityModel * getEntityModel()
Definition: Parameter.h:839
virtual bool isValid() const override
virtual void _bind(Object *binding) override
virtual void update() override
static agx::Model * ClassModel()
EntityInstanceParameter(const agx::Name &name, agxData::EntityModel *entity)
agxData::EntityInstance getBinding()
Definition: Parameter.h:840
EntityPtr parameter.
Definition: Parameter.h:570
agxData::EntityPtr getBinding()
Definition: Parameter.h:832
static EntityPtrParameter * load(TiXmlElement *eParameter, Device *device)
virtual void commit() override
virtual void configure(TiXmlElement *eParameter) override
void bind(agxData::EntityPtr ptr)
void registerAttributeAccess(const agxData::Attribute *attribute, agx::UInt8 mode)
virtual bool isValid() const override
virtual void update() override
EntityPtrParameter(const agx::Name &name, agxData::EntityModel *entity)
virtual void _bind(Object *binding) override
agxData::EntityModel * getEntityModel()
Definition: Parameter.h:831
static agx::Model * ClassModel()
An event with one argument.
Definition: Event.h:103
T CallbackType
Definition: Event.h:37
Inheritance with partial specialization due to bug with ref_ptr containers.
A model is an abstract representation of the class of an agx::Object.
Definition: Model.h:41
Representation of a name string.
Definition: Name.h:33
agx::Object is a refcounted object with a name.
Definition: Object.h:59
agx::Path getPath() const
A representation of a task/kernel parameter, which can be bound using a string path or explicitly to ...
Definition: Parameter.h:62
static agx::Model * ClassModel()
void bind(const agx::Path &path)
Set parameter bind path.
const agx::Path & getBindPath() const
Definition: Parameter.h:703
agx::Object * getBinding()
Definition: Parameter.h:704
agxData::FormatRef m_format
Definition: Parameter.h:200
Parameter(Model *model, MetaType type, const Name &name, agxData::Format *format, UInt8 accessMode, const Path &bindPath=Path())
MetaType getMetaType() const
Definition: Parameter.h:698
void setRequired(bool flag)
Set if the parameter is required, default is true.
UInt8 getAccessMode() const
Definition: Parameter.h:702
virtual void update()=0
size_t getIndex() const
Definition: Parameter.h:697
UInt8 m_metaType
Definition: Parameter.h:205
const agx::String & getMetaTypeName() const
void unbind()
Remove current binding and bind path.
virtual void _bind(Object *binding)=0
Event1< Parameter * > Event
Definition: Parameter.h:66
virtual bool isValid() const =0
virtual ~Parameter()
bool m_needCommit
Definition: Parameter.h:207
Event unbindEvent
Definition: Parameter.h:68
void bind(agx::Object *binding)
Set explicit binding.
MetaType
Specify which kind of parameter.
Definition: Parameter.h:73
Task * m_task
Definition: Parameter.h:198
Event updateEvent
Definition: Parameter.h:69
Event bindEvent
Definition: Parameter.h:67
bool isRequired() const
Definition: Parameter.h:699
ObjectObserver m_binding
Definition: Parameter.h:202
virtual bool hasGlobalResult() const
agx::Task * getTask()
Definition: Parameter.h:695
virtual Object * getResourceImpl(const Path &path, agx::Model *model) override
size_t m_index
Definition: Parameter.h:199
bool needCommit()
Definition: Parameter.h:709
bool needUpdate()
Definition: Parameter.h:708
agxData::Format * getFormat()
Definition: Parameter.h:700
virtual void commit()=0
virtual agxData::Type * getType()
Definition: Parameter.h:706
bool m_needUpdate
Definition: Parameter.h:206
const UInt8 m_accessMode
Definition: Parameter.h:203
virtual void rebind() override
void set(agx::Object *binding)
Set the parameter, alias for bind.
Representation of a path, a list of name components.
Definition: Path.h:33
Pointer parameter.
Definition: Parameter.h:435
virtual ~PointerParameter()
PointerParameter(const agx::Name &name, const Path &bindPath=Path())
virtual void _bind(Object *binding) override
static PointerParameter * load(TiXmlElement *eParameter, Device *device)
virtual void configure(TiXmlElement *eParameter) override
virtual void commit() override
virtual Object * getResourceImpl(const Path &path, agx::Model *model) override
virtual void update() override
virtual bool isValid() const override
virtual void destroyCallback(agx::Object *object) override
static agx::Model * ClassModel()
PointerParameter(const agx::Name &name, Object *binding)
Scalar parameter.
Definition: Parameter.h:256
virtual ~ScalarParameter()
virtual void commit() override
agxData::Value * getValue()
Definition: Parameter.h:713
void set(agxData::Value *value)
Set the parameter value.
static ScalarParameter * load(TiXmlElement *eParameter, Device *device)
static agx::Model * ClassModel()
virtual Object * getResourceImpl(const Path &path, agx::Model *model) override
void setExpression(const String &expression)
Set the parameter using an expression.
ScalarParameter(const agx::Name &name, agxData::Format *format, UInt8 accessMode, agxData::Value *binding)
virtual void _bind(Object *binding) override
void setReal(Real value)
Definition: Parameter.h:753
virtual void configure(TiXmlElement *eParameter) override
const T & get() const
Definition: Parameter.h:717
void write(const T &value, const Task *owner)
Only for internal use from the task containing this Parameter.
Definition: Parameter.h:737
ScalarParameter(const agx::Name &name, agxData::Format *format, UInt8 accessMode=agxData::READ, const String &expression="")
virtual void update() override
virtual bool isValid() const override
A representation of a generic task.
Definition: Task.h:58
Unresolved parameter.
Definition: Parameter.h:216
UnresolvedParameter(const agx::Name &name, const agx::String &expression)
static UnresolvedParameter * load(TiXmlElement *eParameter, Device *device)
virtual void configure(TiXmlElement *eParameter) override
void triggerUpdateCallback(agxData::Value *value)
agxData::Type * getType() override
const agxData::Type * getType() const override
virtual void _bind(Object *binding) override
virtual void update() override
UnresolvedParameter(const agx::Name &name, MetaType type, const agx::String &expression)
virtual void commit() override
void init(const String &expression)
virtual bool isValid() const override
static agx::Model * ClassModel()
T * get() const
Definition: observer_ptr.h:276
T * get() const
Definition: ref_ptr.h:256
bool isValid() const
Definition: ref_ptr.h:268
#define agxAssertN(expr, format,...)
Definition: debug.h:145
#define agxAssert(expr)
Definition: debug.h:143
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contains classes for low level data storage for AGX.
Definition: Container.h:23
@ READ
Definition: agxData.h:37
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint64_t UInt
Definition: Integer.h:27
double Real
Definition: Real.h:42
uint8_t UInt8
Definition: Integer.h:30
HashTable< String, UnresolvedParameterRef > ParameterTable
Definition: Parameter.h:55
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API.