17#ifndef AGXDATA_VALUE_H
18#define AGXDATA_VALUE_H
22# pragma warning(disable: 4251)
31namespace agxNet {
class Device; }
54 virtual void configure(agx::TiXmlElement *eValue)
override;
55 virtual void save(agx::TiXmlElement *eParent)
const override;
84 const void *ptr()
const;
99 void set(
const T& value);
105 template <
typename T>
106 void signal(
const T& value);
136 const Value *getBinding()
const;
163 void unbind(
bool removeAutoBindPath =
true);
173 bool isValid()
const;
185 void set(
Value *other);
198 virtual bool bind(Object *
object);
203 friend class agxNet::Device;
205 void set(
const void *value);
206 void setStorage(
void *ptr);
207 void propagateUpdate();
209 static void allocate(
Value *value);
210 static void deallocate(
Value *value);
214 void forceInvalidateDefaultFormatValue();
235 template <
typename T>
239 template <
typename T2>
250 operator const T& ()
const;
261 template <
typename T>
283 template <
typename T>
330 template <
typename T>
338 template <
typename T>
348 this->
set(
const_cast<const Value *
>(other));
361 template <
typename T>
365 this->
setFormat(agxData::getFormat<T>());
368 this->
set((
const void *)&value);
371 template <
typename T>
405 template <
typename T>
template <
typename T2>
408 const Value *value =
dynamic_cast<const Value *
>(object);
409 return value ? value->
getFormat() == agxData::getFormat<T>() :
false;
413 template <
typename T>
419 template <
typename T>
425 template <
typename T>
431 template <
typename T>
437 template <
typename T>
440 template <
typename T>
446 template <
typename T>
453 template <
typename T>
456 agxAssertN(this->isValid(),
"Can not dereference an invalid value (%s)!", this->getPath().c_str());
460 template <
typename T>
463 this->operator=(value.
get());
467 template <
typename T>
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGX_DECLARE_VECTOR_TYPES(type)
Abstract representation of a scalar variable.
Only use as member allocated variable.
Val(const agx::Name &name, const T &value)
Val(const agx::Name &name)
Val< T > & operator=(const Val< T > &value)
const T * operator->() const
Templated value-reference.
agx::ref_ptr< ValueT< T > > RefT
ValueT< T > * operator->() const
ValueT< T > & operator*() const
ValueRefT(ValueT< T > *val)
static bool ValidateCast(const agx::Referenced *object)
ValueT(const T &value=T())
void signal(const T &value)
ValueT(const agx::Name &name, const T &value)
ValueT< T > & operator=(const ValueT< T > &value)
ValueT(const agx::Name &name)
Abstract representation of a value.
void setFormat(agxData::Format *format)
void unbind(bool removeAutoBindPath=true)
Unbind, also disables auto-binding.
void bind(Value *binding)
Explicit binding, also disables auto-binding.
virtual void rebind() override
Rebind with the current auto-bind path.
static agx::Model * ClassModel()
Value(const agx::Name &name, const agxData::Format *format)
virtual void buildNavigationTree(agxJson::Value &eNode) const override
Event updateEvent
Triggered when the value is updated.
void setDefaultValue()
Set the default value of the format.
static void copy(Value *target, const Value *source)
EventListener m_bindingListener
Value(const agxData::Type *type)
agx::UInt32 m_allocationIndex
virtual void configure(agx::TiXmlElement *eValue) override
agxData::Format * getFormat()
virtual void snapshot(agx::TiXmlNode *eParent, const agx::String &directory) const override
virtual agxData::Data * getData()
agxData::Type * getType()
virtual bool bind(Object *object)
virtual void save(agx::TiXmlElement *eParent) const override
ValuePtrVector m_children
void setExpression(const agx::String &expression)
Configure value using an expression.
Value(const agxData::Format *format)
const Value * getRootBinding() const
void addListener(EventListener *listener)
void signal(const T &value)
Wrapper for this->getRootBinding()->set()
static Value * load(agx::TiXmlElement *eValue, agx::Device *device)
EventDispatch m_eventDispatch
void set(const Value *other)
Explicitly set the value, removes active binding and disables autobinding.
const agx::Path & getBindPath() const
void removeListener(EventListener *listener)
bool hasListener(EventListener *listener)
agx::String toString() const
agx::Event1< Value * > Event
void bind(const agx::Path &path)
Set bind path which will auto-bind when resolved.
Value(const agx::Name &name, const agxData::Type *type)
bool isTypeCompatible(const Value *other)
An agx::Device is an abstract representation of a device on which data can be stored and processed.
An event with one argument.
Inheritance with partial specialization due to bug with ref_ptr containers.
A model is an abstract representation of the class of an agx::Object.
Representation of a name string.
agx::Object is a refcounted object with a name.
const agx::Name & getName() const
agx::Object * getContext()
Representation of a path, a list of name components.
Base class providing referencing counted objects.
void reference(void *ptr=nullptr) const
Explicitly increment the reference count by one, indicating that this object has another pointer whic...
ValueT< T > * get() const
#define agxAssertN(expr, format,...)
bool AGXCORE_EXPORT isShutdown()
Contains classes for low level data storage for AGX.
AGXCORE_EXPORT Format * getFormat(const agx::String &typeFormatName)
AGXCORE_EXPORT Type * getType(const agx::String &name)
std::ostream & operator<<(std::ostream &output, const Attribute &attribute)
agx::HashTable< agx::String, ValueRef > ValueTable
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
Containins classes for sending/reading data over sockets as well as compression functionality.