piranha  0.10
Public Member Functions | List of all members
piranha::boost_s11n_key_wrapper< Key > Struct Template Reference

Wrapper for the serialization of keys via Boost. More...

#include <piranha/s11n.hpp>

Public Member Functions

 boost_s11n_key_wrapper (Key &k, const symbol_fset &ss)
 Constructor from key and piranha::symbol_fset. More...
 
 boost_s11n_key_wrapper (const Key &k, const symbol_fset &ss)
 Constructor from const key and piranha::symbol_fset. More...
 
Key & key ()
 Reference to the key. More...
 
const Key & key () const
 Const reference to the key. More...
 
const symbol_fsetss () const
 Const reference to the symbol set. More...
 

Detailed Description

template<typename Key>
struct piranha::boost_s11n_key_wrapper< Key >

Wrapper for the serialization of keys via Boost.

This is a simple struct that stores a reference to a key (possibly const-qualified) and a const reference to a piranha::symbol_fset. The Boost serialization routines of piranha::series will save/load keys via this wrapper rather than trying to save/load keys directly. The reason for this is that keys might need external information (in the form of the series' piranha::symbol_fset) in order for the (de)serialization to be successful.

Consequently, rather that implementing specialisations of piranha::boost_save_impl and piranha::boost_load_impl for key types, specialisations of piranha::boost_save_impl and piranha::boost_load_impl for this wrapper structure should be provided instead.

This class requires Key to satisfy piranha::is_key, otherwise a compile-time error will be produced.

Definition at line 514 of file s11n.hpp.

Constructor & Destructor Documentation

◆ boost_s11n_key_wrapper() [1/2]

template<typename Key >
piranha::boost_s11n_key_wrapper< Key >::boost_s11n_key_wrapper ( Key &  k,
const symbol_fset ss 
)
inlineexplicit

Constructor from key and piranha::symbol_fset.

Parameters
kthe input key.
ssthe reference piranha::symbol_fset.

Definition at line 524 of file s11n.hpp.

◆ boost_s11n_key_wrapper() [2/2]

template<typename Key >
piranha::boost_s11n_key_wrapper< Key >::boost_s11n_key_wrapper ( const Key &  k,
const symbol_fset ss 
)
inlineexplicit

Constructor from const key and piranha::symbol_fset.

Parameters
kthe input key.
ssthe reference piranha::symbol_fset.

Definition at line 533 of file s11n.hpp.

Member Function Documentation

◆ key() [1/2]

template<typename Key >
Key& piranha::boost_s11n_key_wrapper< Key >::key ( )
inline

Reference to the key.

This method will return a mutable reference to the key used as a construction argument. If this was constructed from a const key instance, calling this method will raise an exception.

Returns
a mutable reference to the key used as a construction argument.
Exceptions
std::runtime_errorif this was constructed from a const key instance.

Definition at line 546 of file s11n.hpp.

◆ key() [2/2]

template<typename Key >
const Key& piranha::boost_s11n_key_wrapper< Key >::key ( ) const
inline

Const reference to the key.

Returns
a const reference to the key used as a construction argument.

Definition at line 558 of file s11n.hpp.

◆ ss()

template<typename Key >
const symbol_fset& piranha::boost_s11n_key_wrapper< Key >::ss ( ) const
inline

Const reference to the symbol set.

Returns
a const reference to the piranha::symbol_fset used as a construction argument.

Definition at line 566 of file s11n.hpp.


The documentation for this struct was generated from the following file: