type erasure for POD data
#include <value.hpp>
|
template<typename T , typename S > |
T | _get () const |
| return value More...
|
|
template<typename S , typename T > |
void | _set (const T &v) const |
| set value More...
|
|
template<typename T , typename = typename enable_primitive<T>::type>
pni::core::value::value |
( |
T |
v | ) |
|
|
inlineexplicit |
This constructor accepts all primitive types from libpnicore.
- Template Parameters
-
- Parameters
-
v | value to store in the type erasure |
template<typename T , typename S >
T pni::core::value::_get |
( |
| ) |
const |
|
inlineprivate |
Return the value of the variable the reference refers to. T denotes the data type requested by the user. S denotes the type of the variable the reference points to.
- Exceptions
-
- Template Parameters
-
T | target type |
S | source type |
- Returns
- value as T
template<typename S , typename T >
void pni::core::value::_set |
( |
const T & |
v | ) |
const |
|
inlineprivate |
Sets the value of the variable the reference points to.
- Exceptions
-
type_error | if the conversion is not possible |
range_error | if the passed value does not fit in the target type |
- Template Parameters
-
S | type of the variable |
T | type of the value the user passed |
- Parameters
-
template<typename T >
T pni::core::value::as |
( |
| ) |
const |
Return the stored value as type T. If the value instance has not been initialized before an exception is thrown. In addition, if the data type passed as a template parameter does not fit the type used to store the data an exception will be thrown.
- Exceptions
-
memory_not_allocate_error | if value is uninitialized |
type_error | if T does not match the original data type |
range_error | if the value stored does not fit into the requested type. |
- Returns
- value of type T
template<typename VT >
value & pni::core::value::operator= |
( |
const VT & |
v | ) |
|
- Parameters
-
v | reference to the new value |
- Returns
- instance of value
type_id_t pni::core::value::type_id |
( |
| ) |
const |
Returns the ID of the stored data type.
- Exceptions
-
- Returns
- type ID.
The documentation for this class was generated from the following file: