17 #ifndef AGX_PARAMETER_H
18 #define AGX_PARAMETER_H
21 # pragma warning( disable: 4714 )// const' marked as __forceinline not inlined
32 namespace agxData {
class FunctionValue; }
93 size_t getIndex()
const;
98 MetaType getMetaType()
const;
108 bool isRequired()
const;
113 void setRequired(
bool flag);
141 virtual bool isValid()
const = 0;
171 virtual bool hasGlobalResult()
const;
174 virtual void rebind()
override;
177 virtual void update() = 0;
178 virtual void commit() = 0;
186 virtual void _bind(
Object *binding) = 0;
193 void setTask(
Task *task,
size_t index);
195 virtual void prepareGlobalResultSorting(
size_t numJobs);
221 virtual void configure(TiXmlElement *eParameter)
override;
227 virtual bool isValid()
const override;
234 virtual void _bind(
Object *binding)
override;
235 virtual void update()
override;
236 virtual void commit()
override;
261 virtual void configure(TiXmlElement *eParameter)
override;
273 template <
typename T>
274 const T&
get()
const;
281 template <
typename T>
282 void set(
const T& value);
285 template <
typename T>
286 void write(
const T& value,
const Task* owner);
291 void setExpression(
const String& expression);
297 virtual bool isValid()
const override;
301 void setReal(
Real value );
304 virtual void update()
override;
305 virtual void commit()
override;
309 virtual void _bind(
Object *binding)
override;
335 virtual void configure(TiXmlElement *eParameter)
override;
359 template <
typename T>
362 template <
typename T>
368 void setLocalSize(
size_t numElements);
373 size_t getLocalSize()
const;
378 size_t getNumElements()
const;
384 void setGlobalResultMode(
UInt mode);
389 UInt getGlobalResultMode()
const;
397 virtual bool hasGlobalResult()
const override;
400 virtual bool isValid()
const override;
403 virtual void update()
override;
404 virtual void commit()
override;
408 virtual void _bind(
Object *binding)
override;
409 virtual void prepareGlobalResultSorting(
size_t numJobs)
override;
414 void parentBindCallback(
Parameter *parent);
415 void parentUnbindCallback(
Parameter *parent);
422 size_t m_localMemorySize;
423 UInt m_globalResultMode;
440 virtual void configure(TiXmlElement *eParameter)
override;
447 const Object*
get()
const;
449 template <
typename T>
452 template <
typename T>
453 const T*
get()
const;
455 virtual bool isValid()
const override;
458 virtual void update()
override;
459 virtual void commit()
override;
463 virtual void _bind(
Object *binding)
override;
466 virtual void destroyCallback(
agx::Object*
object)
override;
489 virtual void configure(TiXmlElement *eParameter)
override;
510 agxData::EntityData *getData();
512 template <
typename T>
518 void setGlobalResultMode(
UInt mode);
523 UInt getGlobalResultMode()
const;
532 void setData(agxData::EntityData *dataSet);
534 const ParameterRefVector& getChildParameters()
const;
536 virtual bool isValid()
const override;
539 virtual void update()
override;
540 virtual void commit()
override;
542 virtual bool hasGlobalResult()
const override;
546 virtual void _bind(
Object *binding)
override;
547 virtual void prepareGlobalResultSorting(
size_t numJobs)
override;
550 void addChildParameter(
Parameter* parameter);
558 agxData::EntityDataRef m_dataSet;
559 ParameterRefVector m_children;
560 UInt m_globalResultMode;
562 bool m_childrenNeedCommit;
575 virtual void configure(TiXmlElement *eParameter)
override;
594 template <
typename T>
598 virtual bool isValid()
const override;
600 virtual void update()
override;
601 virtual void commit()
override;
605 virtual void _bind(
Object *binding)
override;
614 struct AttributeAccess
616 AttributeAccess() : attribute(
nullptr), buffer(
nullptr), mode(
agx::InvalidIndex) {}
637 virtual void configure(TiXmlElement *eParameter)
override;
656 template <
typename T>
660 virtual bool isValid()
const override;
662 virtual void update()
override;
663 virtual void commit()
override;
667 virtual void _bind(
Object *binding)
override;
676 struct AttributeAccess
678 AttributeAccess() : attribute(
nullptr), buffer(
nullptr), mode(
agx::InvalidIndex) {}
716 template <
typename T>
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());
721 return m_value->
get<T>();
724 template <
typename T>
735 template <
typename T>
743 agxAssert(m_format->is(agxData::getFormat<T>()));
744 *(T*)this->ptr() = value;
749 return const_cast<void *
>(m_value->ptr());
760 return this->get<Real>();
770 template <
typename T>
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());
776 return m_buffer ? m_buffer->getArray<T>() :
static_cast<agxData::Array<T>&
>(s_dummyArray);
779 template <
typename T>
798 template <
typename T>
808 template <
typename T>
818 template <
typename T>
834 template <
typename T>
842 template <
typename T>
Representation of a path, a list of name components.
AGXCORE_EXPORT agx::UInt getAccessMode(const agx::String &modeName)
UInt getGlobalResultMode() const
void AGXPHYSICS_EXPORT init()
Initialize agx.
AGXCORE_EXPORT Type * getType(const agx::String &name)
const ParameterRefVector & getChildParameters() const
MetaType
Specify which kind of parameter.
size_t getElementArraySize() const
agxData::EntityModel * getEntityModel()
MetaType getMetaType() const
Data storage for a collection of entity instances of a specified EntityModel.
A model is an abstract representation of the class of an agx::Object.
Abstract representation of a value.
void set(agxData::Value *value)
Set the parameter value.
size_t getNumElements() const
AGXCORE_EXPORT Format * getFormat(const agx::String &typeFormatName)
#define agxAssertN(expr, format,...)
agxData::EntityModel * getEntityModel()
agxData::FormatRef m_format
Entity instance provides access to a single instance in an EntityStorage.
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
agx::String fullName() const
#define AGX_DECLARE_POINTER_TYPES(type)
A representation of a generic task.
Representation of a name string.
Arrays are fast accessors into the data, or a portion of it, held by a Buffer.
GlobalResultStorage * getGlobalResult()
agxData::EntityInstance getBinding()
agxData::Type * getType() override
Type-specific Array used for fast access into the data held by a Buffer.
agxData::Buffer * getBuffer()
const char * c_str() const
size_t getLocalSize() const
Templated callback with one argument.
virtual agxData::Type * getType()
A representation of a task/kernel parameter, which can be bound using a string path or explicitly to ...
agxData::EntityPtr getBinding()
An abstract attribute description, part of an Entity.
Abstract representation of a data buffer.
UInt8 getAccessMode() const
agxData::Array< T > & get()
Access the data of the current buffer binding.
UInt getGlobalResultMode() const
EntityInstance parameter.
bool AGXPHYSICS_EXPORT write(const std::string &filename, const agxStream::Serializable *data)
Write a Serializable object to a file.
void unbind()
Remove current binding and bind path.
agx::Path getPath() const
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
agxData::Value * getValue()
HashTable< String, UnresolvedParameterRef > ParameterTable
AGXTERRAIN_EXPORT TimingStorage & getStorage()
agxData::EntityStorage * getStorage()
void write(const T &value, const Task *owner)
Only for internal use from the task containing this Parameter.
GlobalResultBuffer * getGlobalResult()
agxData::EntityData * getData()
Inheritance with partial specialization due to bug with ref_ptr containers.
Event1< Parameter * > Event
agxData::EntityModel * getEntityModel()
An agx::Device is an abstract representation of a device on which data can be stored and processed...
agxData::Format * getFormat()
agx::Object * getBinding()
const agx::Path & getBindPath() const
agx::Object is a refcounted object with a name.
AGX_DECLARE_VECTOR_TYPES(Clock)