CAF 0.17.6
Loading...
Searching...
No Matches
Public Member Functions | Related Symbols | List of all members
caf::type_erased_value Class Referenceabstract

Represents a single type-erased value. More...

#include <type_erased_value.hpp>

Inheritance diagram for caf::type_erased_value:
caf::detail::type_erased_value_impl< T >

Public Member Functions

virtual voidget_mutable ()=0
 Returns a mutable pointer to the stored value.
 
virtual error load (deserializer &source)=0
 Load the content for the stored value from source.
 
virtual rtti_pair type () const =0
 Returns the type number and type information object for the stored value.
 
virtual const voidget () const =0
 Returns a pointer to the stored value.
 
virtual error save (serializer &sink) const =0
 Saves the content of the stored value to sink.
 
virtual std::string stringify () const =0
 Converts the stored value to a string.
 
virtual type_erased_value_ptr copy () const =0
 Returns a copy of the stored value.
 
bool matches (uint16_t nr, const std::type_info *ptr) const
 Checks whether the type of the stored value matches the type nr and type info object.
 
uint16_t type_nr () const
 Returns the type number for the stored value.
 
bool matches (const rtti_pair &rtti) const
 Checks whether the type of the stored value matches rtti.
 
template<class T >
const T & get_as () const
 Convenience function for reinterpret_cast<const T*>(get()).
 
template<class T >
T & get_mutable_as ()
 Convenience function for reinterpret_cast<T*>(get_mutable()).
 

Related Symbols

(Note that these are not member symbols.)

template<class T , class... Ts>
type_erased_value_ptr make_type_erased_value (Ts &&... xs)
 Creates a type-erased value of type T from xs.
 
template<class T >
detail::type_erased_value_impl< std::reference_wrapper< T > > make_type_erased_view (T &x)
 Creates a type-erased view for x.
 

Detailed Description

Represents a single type-erased value.

Member Function Documentation

◆ copy()

virtual type_erased_value_ptr caf::type_erased_value::copy ( ) const
pure virtual

Returns a copy of the stored value.

Implemented in caf::detail::type_erased_value_impl< T >.

◆ get()

virtual const void * caf::type_erased_value::get ( ) const
pure virtual

Returns a pointer to the stored value.

Implemented in caf::detail::type_erased_value_impl< T >.

◆ get_mutable()

virtual void * caf::type_erased_value::get_mutable ( )
pure virtual

Returns a mutable pointer to the stored value.

Implemented in caf::detail::type_erased_value_impl< T >.

◆ load()

virtual error caf::type_erased_value::load ( deserializer source)
pure virtual

Load the content for the stored value from source.

Implemented in caf::detail::type_erased_value_impl< T >.

◆ save()

virtual error caf::type_erased_value::save ( serializer sink) const
pure virtual

Saves the content of the stored value to sink.

Implemented in caf::detail::type_erased_value_impl< T >.

◆ stringify()

virtual std::string caf::type_erased_value::stringify ( ) const
pure virtual

Converts the stored value to a string.

Implemented in caf::detail::type_erased_value_impl< T >.

◆ type()

virtual rtti_pair caf::type_erased_value::type ( ) const
pure virtual

Returns the type number and type information object for the stored value.

Implemented in caf::detail::type_erased_value_impl< T >.


The documentation for this class was generated from the following files: