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>
302 const T *operator-> ()
const {
return &this->
get(); }
305 this->operator=(value.
get());
324 template <
typename T>
328 agxAssertN(this->isValid(),
"Can not dereference an invalid value! Value \'%s\' in component \'%s\'", this->getName().c_str(), this->getContext() ? this->getContext()->getName().c_str() :
"nullptr");
329 return *(
const T *)m_value.ptr();
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>
368 this->getRootBinding()->set(value);
373 return m_format ? m_format->getType() :
nullptr;
378 return m_format ? m_format->getType() :
nullptr;
388 return m_value.ptr() !=
nullptr;
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>
443 Value::signal(value);
447 template <
typename T>
450 agxAssertN(this->isValid(),
"Can not dereference an invalid value (%s)!", this->getPath().c_str());
451 return *(
const T*)Value::ptr();
454 template <
typename T>
457 this->operator=(value.
get());
461 template <
typename T>
Name space containing classes for sending/reading data over sockets.
Representation of a path, a list of name components.
agxData::Format * getFormat()
AGXCORE_EXPORT Type * getType(const agx::String &name)
std::ostream & operator<<(std::ostream &stream, const IPAddress &adr)
EventListener m_bindingListener
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.
#define AGX_DECLARE_POINTER_TYPES(type)
Representation of a name string.
Templated value-reference.
agx::HashTable< agx::String, ValueRef > ValueTable
Abstract representation of a scalar variable.
ValueT< T > * operator->() const
ValueT< T > & operator*() const
Base class providing referencing counted objects.
Only use as member allocated variable.
Val(const agx::Name &name, const T &value)
agx::ref_ptr< ValueT< T > > RefT
ValueRefT(ValueT< T > *val)
Contains classes for low level data storage for AGX.
Event updateEvent
Triggered when the value is updated.
agx::UInt32 m_allocationIndex
AGX_DECLARE_VECTOR_TYPES(Socket)
EventDispatch m_eventDispatch
Val(const agx::Name &name)
ValuePtrVector m_children
agx::Event1< Value * > Event
bool AGXCORE_EXPORT isShutdown()
Inheritance with partial specialization due to bug with ref_ptr containers.
An agx::Device is an abstract representation of a device on which data can be stored and processed...
agx::Object is a refcounted object with a name.