class ngraph::ValueAccessor¶
Overview¶
Provides access to an attribute of type AT as a value accessor type VAT. More…
#include <attribute_adapter.hpp>
template <typename VAT>
class ValueAccessor
{
public:
// methods
virtual const VAT& get() = 0;
virtual void set(const VAT& value) = 0;
};
// direct descendants
template <typename AT>
class DirectValueAccessor;
template <typename AT, typename VAT>
class IndirectScalarValueAccessor;
template <typename AT, typename VAT>
class IndirectVectorValueAccessor;
Detailed Documentation¶
Provides access to an attribute of type AT as a value accessor type VAT.
Provides access to values via get/set methods from an m_value, typically from ValueReference.
The m_buffer holds a VAT, which may be wider than the attribute AT. For example, serializers that only support int64_t integers would use a ValueAccessor<vector<int64_t>> to reference a vector<int8_t> attribute. Destruction moves the value back to the attribute if it was changed.
Parameters:
VAT |
The adapter value type; may be wider than the value being accessed. |
Methods¶
virtual const VAT& get() = 0
Returns the value.
virtual void set(const VAT& value) = 0
Sets the value.
class ngraph::ValueAccessor<void*>¶
#include <attribute_adapter.hpp>
template <>
class ValueAccessor<void*>: public ngraph::ValueAccessor<void>
{
public:
// methods
virtual void* get_ptr() = 0;
virtual size_t size() = 0;
};
Inherited Members¶
public:
// methods
virtual const DiscreteTypeInfo& get_type_info() const = 0;
class ngraph::ValueAccessor<void>¶
Overview¶
ValueAccessor<void> provides an accessor for values that do not have get/set methonds via AttributeVistor.on_adapter. More…
#include <attribute_adapter.hpp>
template <>
class ValueAccessor<void>
{
public:
// methods
virtual const DiscreteTypeInfo& get_type_info() const = 0;
};
// direct descendants
template <>
class ValueAccessor<void*>;
class VisitorAdapter;
Detailed Documentation¶
ValueAccessor<void> provides an accessor for values that do not have get/set methonds via AttributeVistor.on_adapter.
All ValueAccessors must be derived from ValueAccessor<void> so that an AttributeVisitor only needs to implement a subset of the on_adapter methods.
Methods¶
virtual const DiscreteTypeInfo& get_type_info() const = 0
type info enables identification of the value accessor, as well as is_type and as_type.