Apama  10.0.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
functions.hpp File Reference

Contains free functions relating to data_t. More...

#include <sag_internal/convert_to.hpp>

Go to the source code of this file.

Functions

template<typename V >
V::result_type apply_visitor (const V &v, data_t &t)
 Apply a visitor (using the boost::static_visitor pattern) to the given data_t. More...
 
template<typename V >
V::result_type apply_visitor (const V &v, const data_t &t)
 Apply a visitor (using the boost::static_visitor pattern) to the given data_t. More...
 
template<typename T >
get_details::GetVisitor< const
T >::result_type 
get (const data_t &t)
 Get the contents of a data_t, given the type. More...
 
template<>
const data_tget< const data_t & > (const data_t &t)
 Specialization to be a pass-through, for use in a templated context. More...
 
template<typename T >
get_details::GetVisitor< T >
::result_type 
get (data_t &t)
 Get the contents of a data_t, given the type. More...
 
template<>
data_tget< data_t & > (data_t &t)
 Specialization to be a pass-through, for use in a templated context. More...
 
template<typename T >
get_details::GetVisitor
< custom_t< T > >::result_type 
get_custom (data_t &t)
 Get the contents of the data_t as a typed custom_t. More...
 
template<typename T >
get_details::GetVisitor< const
custom_t< T > >::result_type 
get_custom (const data_t &t)
 Get the contents of the data_t as a typed custom_t. More...
 
template<typename T >
convert_to (const data_t &d)
 Get a T from a data_t, parsing it from a string if necessary/possible. More...
 

Detailed Description

Contains free functions relating to data_t.

Function Documentation

template<typename V >
V::result_type apply_visitor ( const V &  v,
data_t t 
)
inline

Apply a visitor (using the boost::static_visitor pattern) to the given data_t.

This is the main mechanism for accessing the data if you don't know which type. Your visitor should implement operator() for each of the possible contained types and the appropriate method will be called, depending on which type is in the variant. If the variant is empty then the 0-args operator() will be used.

The return value of the operators will be returned from this method. Visitors must define a result_type member (or make use of boost::static_visitor, which provides this). Alternatively connectivity::visitor may be used when you only need to implement specific type visitation which also provides result_type.

template<typename V >
V::result_type apply_visitor ( const V &  v,
const data_t t 
)
inline

Apply a visitor (using the boost::static_visitor pattern) to the given data_t.

This is the main mechanism for accessing the data if you don't know which type. Your visitor should implement operator() for each of the possible contained types and the appropriate method will be called, depending on which type is in the variant. If the variant is empty then the 0-args operator() will be used.

The return value of the operators will be returned from this method. Visitors must define a result_type member (or make use of boost::static_visitor, which provides this). Alternatively connectivity::visitor may be used when you only need to implement specific type visitation which also provides result_type.

template<typename T >
T convert_to ( const data_t d)
inline

Get a T from a data_t, parsing it from a string if necessary/possible.

If it cannot be converted, or is not either T or a string, then will throw std::runtime_error.

Only the following types can be used with convert_to:

  • int64_t
  • double
  • bool
  • std::string
template<typename T >
get_details::GetVisitor<const T>::result_type get ( const data_t t)
inline

Get the contents of a data_t, given the type.

This is the primary way of accessing the contents of a data_t if you know which type it will be.

get is templated over one of the types the data_t can contain. If the data_t contains a value of that type then it will be returned. If not, get will throw std::runtime_error.

template<typename T >
get_details::GetVisitor<T>::result_type get ( data_t t)
inline

Get the contents of a data_t, given the type.

This is the primary way of accessing the contents of a data_t if you know which type it will be.

get is templated over one of the types the data_t can contain. If the data_t contains a value of that type then it will be returned. If not, get will throw std::runtime_error.

template<>
const data_t& get< const data_t & > ( const data_t t)
inline

Specialization to be a pass-through, for use in a templated context.

template<>
data_t& get< data_t & > ( data_t t)
inline

Specialization to be a pass-through, for use in a templated context.

template<typename T >
get_details::GetVisitor<custom_t<T> >::result_type get_custom ( data_t t)
inline

Get the contents of the data_t as a typed custom_t.

This is a shorthand for using get:

get_custom<T>(data) == get<custom_t<T> >(data)

template<typename T >
get_details::GetVisitor<const custom_t<T> >::result_type get_custom ( const data_t t)
inline

Get the contents of the data_t as a typed custom_t.

This is a shorthand for using get:

get_custom<T>(data) == get<custom_t<T> >(data)