ALPSCore reference
Public Types | Public Member Functions | Friends | List of all members
alps::params_ns::dict_value Class Reference

#include <dict_value.hpp>

Collaboration diagram for alps::params_ns::dict_value:
Collaboration graph

Public Types

typedef boost::make_variant_over< detail::dict_all_types >::type value_type
 
typedef detail::None None
 "Empty value" type More...
 

Public Member Functions

 dict_value ()
 Constructs the empty nameless value. More...
 
 dict_value (const std::string &name)
 Constructs the empty value. More...
 
bool empty () const
 whether the value contains None More...
 
template<typename X >
bool isType () const
 check the type of the containing value More...
 
template<typename T >
const T & operator= (const T &rhs)
 Assignment operator (with conversion) More...
 
const char * operator= (const char *rhs)
 Assignment operator (with conversion from const char*) More...
 
template<typename T >
as () const
 Shortcut for explicit conversion to a target type. More...
 
template<typename T , typename std::enable_if< detail::is_allowed< T >::value, int >::type = 0>
 operator T () const
 Conversion to a target type, explicit or implicit. More...
 
void clear ()
 Reset to an empty value. More...
 
template<typename T >
int compare (const T &rhs) const
 Comparison. More...
 
int compare (const dict_value &rhs) const
 
bool equals (const dict_value &rhs) const
 Returns true if the objects hold the same type and value, false otherwise. More...
 
void save (alps::hdf5::archive &ar) const
 Saves the value to an archive. More...
 
void load (alps::hdf5::archive &ar)
 Loads the value from an archive. More...
 
template<typename F >
F::result_type apply_visitor (F &visitor) const
 Const-access visitor to the bound value. More...
 
template<typename F >
F::result_type apply_visitor (const F &visitor) const
 Const-access visitor to the bound value. More...
 

Friends

std::ostream & print (std::ostream &, const dict_value &, bool terse)
 Print the value, possibly together with type, in a human-readable format. More...
 

Detailed Description

Definition at line 62 of file dict_value.hpp.

Member Typedef Documentation

typedef detail::None alps::params_ns::dict_value::None

"Empty value" type

Definition at line 66 of file dict_value.hpp.

typedef boost::make_variant_over<detail::dict_all_types>::type alps::params_ns::dict_value::value_type

Definition at line 65 of file dict_value.hpp.

Constructor & Destructor Documentation

alps::params_ns::dict_value::dict_value ( )
inline

Constructs the empty nameless value.

Definition at line 76 of file dict_value.hpp.

alps::params_ns::dict_value::dict_value ( const std::string &  name)
inlineexplicit

Constructs the empty value.

Definition at line 79 of file dict_value.hpp.

Member Function Documentation

template<typename F >
F::result_type alps::params_ns::dict_value::apply_visitor ( F &  visitor) const

Const-access visitor to the bound value.

Parameters
visitorfunctor should be callable as R result=visitor(bound_value_const_ref)

The functor type F must define typename F::result_type.

Definition at line 368 of file dict_value_impl.hpp.

template<typename F >
F::result_type alps::params_ns::dict_value::apply_visitor ( const F &  visitor) const

Const-access visitor to the bound value.

Parameters
visitorfunctor should be callable as R result=visitor(bound_value_const_ref)

The functor type F must define typename F::result_type.

Definition at line 373 of file dict_value_impl.hpp.

template<typename T >
T alps::params_ns::dict_value::as ( ) const
inline

Shortcut for explicit conversion to a target type.

Definition at line 398 of file dict_value_impl.hpp.

void alps::params_ns::dict_value::clear ( )
inline

Reset to an empty value.

Definition at line 416 of file dict_value_impl.hpp.

template<typename T >
int alps::params_ns::dict_value::compare ( const T &  rhs) const
inline

Comparison.

a.compare(b) returns 0 if a==b, !=0 if a!=b. if well-ordered, returns -1 if a<b, +1 if a>b.

Definition at line 419 of file dict_value_impl.hpp.

int alps::params_ns::dict_value::compare ( const dict_value rhs) const

Definition at line 98 of file dict_value.cpp.

bool alps::params_ns::dict_value::empty ( ) const
inline

whether the value contains None

Definition at line 377 of file dict_value_impl.hpp.

bool alps::params_ns::dict_value::equals ( const dict_value rhs) const

Returns true if the objects hold the same type and value, false otherwise.

Definition at line 110 of file dict_value.cpp.

template<typename X >
bool alps::params_ns::dict_value::isType ( ) const
inline

check the type of the containing value

Definition at line 382 of file dict_value_impl.hpp.

void alps::params_ns::dict_value::load ( alps::hdf5::archive ar)

Loads the value from an archive.

Definition at line 120 of file dict_value.cpp.

template<typename T , typename std::enable_if< detail::is_allowed< T >::value, int >::type = 0>
alps::params_ns::dict_value::operator T ( ) const
inline

Conversion to a target type, explicit or implicit.

Definition at line 105 of file dict_value.hpp.

template<typename T >
const T & alps::params_ns::dict_value::operator= ( const T &  rhs)
inline

Assignment operator (with conversion)

Definition at line 387 of file dict_value_impl.hpp.

const char * alps::params_ns::dict_value::operator= ( const char *  rhs)
inline

Assignment operator (with conversion from const char*)

Definition at line 392 of file dict_value_impl.hpp.

void alps::params_ns::dict_value::save ( alps::hdf5::archive ar) const

Saves the value to an archive.

Definition at line 115 of file dict_value.cpp.

Friends And Related Function Documentation

std::ostream& print ( std::ostream &  s,
const dict_value dv,
bool  terse 
)
friend

Print the value, possibly together with type, in a human-readable format.

Definition at line 186 of file dict_value.cpp.


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