17 #ifndef AGXDATA_VALUE_H 18 #define AGXDATA_VALUE_H 21 # pragma warning(push) 22 # pragma warning(disable: 4251) // warning C4251: class X needs to have dll-interface to be used by clients of class Y 31 namespace agxNet {
class Device; }
54 virtual void configure(agx::TiXmlElement *eValue)
override;
55 virtual void save(agx::TiXmlElement *eParent)
const override;
56 virtual void snapshot(agx::TiXmlNode *eParent,
const agx::String& directory)
const override;
69 void addListener(EventListener *listener);
70 void removeListener(EventListener *listener);
71 bool hasListener(EventListener *listener);
84 const void *ptr()
const;
95 void set(
const Value *other);
99 void set(
const T& value);
105 template <
typename T>
106 void signal(
const T& value);
112 void setDefaultValue();
136 const Value *getBinding()
const;
141 Value *getRootBinding();
142 const Value *getRootBinding()
const;
158 void bind(
Value *binding);
163 void unbind(
bool removeAutoBindPath =
true);
168 virtual void rebind()
override;
173 bool isValid()
const;
179 bool isTypeCompatible(
const Value *other);
181 Value *clone()
const;
182 static void copy(
Value *target,
const Value *source);
185 void set(
Value *other);
194 virtual void buildNavigationTree(agxJson::Value& eNode)
const override;
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>
244 ValueT(
const T& value = T());
250 operator const T& ()
const;
252 void set(
const T& value);
253 void signal(
const T& value);
254 const T&
get()
const;
261 template <
typename T>
283 template <
typename T>
308 const T *operator-> ()
const {
return &this->
get(); }
311 this->operator=(value.
get());
330 template <
typename T>
334 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");
335 return *(
const T *)m_value.ptr();
338 template <
typename T>
348 this->
set(
const_cast<const Value *
>(other));
353 this->
set(
const_cast<const Value *
>(other.
get()));
358 this->
set(
const_cast<const Value *
>(other.
get()));
361 template <
typename T>
365 this->setFormat(agxData::getFormat<T>());
368 this->
set((
const void *)&value);
371 template <
typename T>
374 this->getRootBinding()->set(value);
379 return m_format ? m_format->getType() :
nullptr;
384 return m_format ? m_format->getType() :
nullptr;
394 return m_value.ptr() !=
nullptr;
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>
449 Value::signal(value);
453 template <
typename T>
456 agxAssertN(this->isValid(),
"Can not dereference an invalid value (%s)!", this->getPath().c_str());
457 return *(
const T*)Value::ptr();
460 template <
typename T>
463 this->operator=(value.
get());
467 template <
typename T>
480 # pragma warning(pop) Containins classes for sending/reading data over sockets as well as compression functionality.
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.
Vector containing 'raw' data.
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
EventDispatch m_eventDispatch
Val(const agx::Name &name)
ValuePtrVector m_children
agx::Event1< Value * > Event
#define AGX_DECLARE_VECTOR_TYPES(type)
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.