OSSIA
Open Scenario System for Interactive Application
ossia::value Class Reference

The value class. More...

Detailed Description

The value class.

Core type of the ossia API. A value is a variant of multiple fundamental types.

A value can be in an "unset" state; it has to be checked for this. e.g. :

void f(ossia::value& v) {
if(v.valid())
{
auto maybe_int = v.target<Int>();
if(maybe_int)
std::cout << maybe_int->value;
else // we know for some reason that it is a float
std::cout << v.get<Float>().value;
}
}
The value class.
Definition: value.hpp:173

A generic operation can be applied safely to a value with a visitor. See for instance value_to_pretty_string.

Public Types

using value_type = value_variant
 

Public Member Functions

template<typename T >
 value (T *)=delete
 
 value (const char *txt)
 
OSSIA_INLINE value (impulse val) noexcept
 
OSSIA_INLINE value (bool val) noexcept
 
OSSIA_INLINE value (int val) noexcept
 
OSSIA_INLINE value (long val) noexcept
 
OSSIA_INLINE value (float val) noexcept
 
OSSIA_INLINE value (double val) noexcept
 
OSSIA_INLINE value (const std::string &val) noexcept
 
OSSIA_INLINE value (const std::vector< ossia::value > &val) noexcept
 
OSSIA_INLINE value (const value_map_type &val) noexcept
 
OSSIA_INLINE value (std::array< float, 2 > val) noexcept
 
OSSIA_INLINE value (std::array< float, 3 > val) noexcept
 
OSSIA_INLINE value (std::array< float, 4 > val) noexcept
 
OSSIA_INLINE value (std::string &&val) noexcept
 
OSSIA_INLINE value (std::vector< ossia::value > &&val) noexcept
 
OSSIA_INLINE value (value_map_type &&val) noexcept
 
template<typename T , typename... Args>
OSSIA_INLINE value (detail::dummy< T > t, Args &&... args) noexcept
 
OSSIA_INLINE valueoperator= (ossia::impulse val) noexcept
 
OSSIA_INLINE valueoperator= (const char *c) noexcept
 
OSSIA_INLINE valueoperator= (bool val) noexcept
 
OSSIA_INLINE valueoperator= (int32_t val) noexcept
 
OSSIA_INLINE valueoperator= (float val) noexcept
 
OSSIA_INLINE valueoperator= (const std::string &val) noexcept
 
OSSIA_INLINE valueoperator= (const std::vector< ossia::value > &val) noexcept
 
OSSIA_INLINE valueoperator= (const value_map_type &val) noexcept
 
OSSIA_INLINE valueoperator= (std::array< float, 2 > val) noexcept
 
OSSIA_INLINE valueoperator= (std::array< float, 3 > val) noexcept
 
OSSIA_INLINE valueoperator= (std::array< float, 4 > val) noexcept
 
OSSIA_INLINE valueoperator= (std::string &&val) noexcept
 
OSSIA_INLINE valueoperator= (std::vector< ossia::value > &&val) noexcept
 
OSSIA_INLINE valueoperator= (value_map_type &&val) noexcept
 
 value (const value &other) noexcept
 
 value (value &&other) noexcept
 
valueoperator= (const value &other) noexcept
 
valueoperator= (value &&other) noexcept
 
 operator value_type & ()
 
 operator const value_type & () const
 
template<typename T >
OSSIA_INLINE const T & get () const
 
template<typename T >
OSSIA_INLINE T & get ()
 
template<typename T >
OSSIA_INLINE const T * target () const noexcept
 
template<typename T >
OSSIA_INLINE T * target () noexcept
 
OSSIA_INLINE ossia::val_type get_type () const noexcept
 
bool valid () const noexcept
 
void reset () noexcept
 
template<typename Visitor >
auto apply (Visitor &&vis) -> decltype(auto)
 
template<typename Visitor >
auto apply (Visitor &&vis) const -> decltype(auto)
 

Static Public Member Functions

template<typename T , typename... Args>
static OSSIA_INLINE ossia::value make (Args &&... args) noexcept
 

Public Attributes

value_type v