17 #ifndef AGXDATA_VALUE_H
18 #define AGXDATA_VALUE_H
25 namespace agxNet {
class Device; }
48 virtual void configure(agx::TiXmlElement *eValue)
override;
49 virtual void save(agx::TiXmlElement *eParent)
const override;
50 virtual void snapshot(agx::TiXmlNode *eParent,
const agx::String& directory)
const override;
63 void addListener(EventListener *listener);
64 void removeListener(EventListener *listener);
65 bool hasListener(EventListener *listener);
78 const void *ptr()
const;
89 void set(
const Value *other);
93 void set(
const T& value);
100 void signal(
const T& value);
106 void setDefaultValue();
130 const Value *getBinding()
const;
135 Value *getRootBinding();
136 const Value *getRootBinding()
const;
152 void bind(
Value *binding);
157 void unbind(
bool removeAutoBindPath =
true);
162 virtual void rebind()
override;
167 bool isValid()
const;
173 bool isTypeCompatible(
const Value *other);
175 Value *clone()
const;
176 static void copy(
Value *target,
const Value *source);
179 void set(
Value *other);
188 virtual void buildNavigationTree(agxJson::Value& eNode)
const override;
192 virtual bool bind(Object *
object);
197 friend class agxNet::Device;
199 void set(
const void *value);
200 void setStorage(
void *ptr);
201 void propagateUpdate();
203 static void allocate(
Value *value);
204 static void deallocate(
Value *value);
208 void forceInvalidateDefaultFormatValue();
229 template <
typename T>
233 template <
typename T2>
238 ValueT(
const T& value = T());
244 operator const T& ()
const;
246 void set(
const T& value);
247 void signal(
const T& value);
248 const T&
get()
const;
255 template <
typename T>
277 template <
typename T>
324 template <
typename T>
332 template <
typename T>
342 this->
set(const_cast<const Value *>(other));
347 this->
set(const_cast<const Value *>(other.
get()));
352 this->
set(const_cast<const Value *>(other.
get()));
355 template <
typename T>
359 this->
setFormat(agxData::getFormat<T>());
362 this->
set((
const void *)&value);
365 template <
typename T>
399 template <
typename T>
template <
typename T2>
402 const Value *value =
dynamic_cast<const Value *
>(object);
403 return value ? value->
getFormat() == agxData::getFormat<T>() :
false;
407 template <
typename T>
413 template <
typename T>
419 template <
typename T>
425 template <
typename T>
431 template <
typename T>
434 template <
typename T>
440 template <
typename T>
447 template <
typename T>
450 agxAssertN(this->isValid(),
"Can not dereference an invalid value (%s)!", this->getPath().c_str());
454 template <
typename T>
457 this->operator=(value.
get());
461 template <
typename T>
Representation of a path, a list of name components.
agxData::Format * getFormat()
AGXCORE_EXPORT Type * getType(const agx::String &name)
void setFormat(agxData::Format *format)
const T * operator->() const
EventListener m_bindingListener
Val< T > & operator=(const Val< T > &value)
A model is an abstract representation of the class of an agx::Object.
Abstract representation of a value.
AGXCORE_EXPORT Format * getFormat(const agx::String &typeFormatName)
#define agxAssertN(expr, format,...)
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
agxData::Type * getType()
#define AGX_DECLARE_POINTER_TYPES(type)
Representation of a name string.
ValueT(const agx::Name &name)
Templated value-reference.
agx::HashTable< agx::String, ValueRef > ValueTable
const agx::Name & getName() const
Abstract representation of a scalar variable.
ValueT< T > & operator=(const ValueT< T > &value)
Base class providing referencing counted objects.
Only use as member allocated variable.
void signal(const T &value)
Val(const agx::Name &name, const T &value)
AGX_DECLARE_VECTOR_TYPES(BinaryData)
agx::ref_ptr< ValueT< T > > RefT
ValueRefT(ValueT< T > *val)
Representation of a session on disk created by the FileFrameWriter.
const agx::Path & getBindPath() const
Event updateEvent
Triggered when the value is updated.
ValueT< T > & operator*() const
agx::UInt32 m_allocationIndex
static bool ValidateCast(const agx::Referenced *object)
EventDispatch m_eventDispatch
Val(const agx::Name &name)
std::ostream & operator<<(std::ostream &output, const Attribute &attribute)
ValuePtrVector m_children
agx::Event1< Value * > Event
void signal(const T &value)
Wrapper for this->getRootBinding()->set()
bool AGXCORE_EXPORT isShutdown()
Inheritance with partial specialization due to bug with ref_ptr containers.
void reference(void *ptr=nullptr) const
Explicitly increment the reference count by one, indicating that this object has another pointer whic...
An agx::Device is an abstract representation of a device on which data can be stored and processed...
agx::Object * getContext()
ValueT< T > * operator->() const
void set(const Value *other)
Explicitly set the value, removes active binding and disables autobinding.
agx::Object is a refcounted object with a name.