userver: userver/dump/common_containers.hpp File Reference
Loading...
Searching...
No Matches
common_containers.hpp File Reference

Detailed Description

Dump support for C++ Standard Library and Boost containers, std::optional, utils::StrongTypedef, std::{unique,shared}_ptr

Note
There are no traits in CachingComponentBase. If T is writable/readable, we have to generate the code for dumps regardless of dump: enabled. So it's important that all Read-Write operations for containers are SFINAE-correct.

Definition in file common_containers.hpp.

Go to the source code of this file.

#include <cstddef>
#include <memory>
#include <optional>
#include <type_traits>
#include <typeinfo>
#include <utility>
#include <variant>
#include <userver/utils/constexpr_indices.hpp>
#include <userver/utils/lazy_prvalue.hpp>
#include <userver/utils/meta.hpp>
#include <userver/utils/strong_typedef.hpp>
#include <userver/dump/common.hpp>
#include <userver/dump/meta.hpp>
#include <userver/dump/meta_containers.hpp>
#include <userver/dump/operations.hpp>

Namespaces

namespace  dump
 Dumping of cache-like components.
 

Functions

template<typename T >
std::enable_if_t< kIsContainer< T > &&kIsWritable< meta::RangeValueType< T > > > dump::Write (Writer &writer, const T &value)
 Container serialization support.
 
template<typename T >
std::enable_if_t< kIsContainer< T > &&kIsReadable< meta::RangeValueType< T > >, T > dump::Read (Reader &reader, To< T >)
 Container deserialization support.
 
template<typename T , typename U >
std::enable_if_t< kIsWritable< T > &&kIsWritable< U >, void > dump::Write (Writer &writer, const std::pair< T, U > &value)
 Pair serialization support (for maps)
 
template<typename T , typename U >
std::enable_if_t< kIsReadable< T > &&kIsReadable< U >, std::pair< T, U > > dump::Read (Reader &reader, To< std::pair< T, U > >)
 Pair deserialization support (for maps)
 
template<typename T >
std::enable_if_t< kIsWritable< T > > dump::Write (Writer &writer, const std::optional< T > &value)
 std::optional serialization support
 
template<typename T >
std::enable_if_t< kIsReadable< T >, std::optional< T > > dump::Read (Reader &reader, To< std::optional< T > >)
 std::optional deserialization support
 
template<typename T >
std::enable_if_t< kIsReadable< T >, T > dump::Read (Reader &reader, To< const T >)
 
template<typename Tag , typename T , utils::StrongTypedefOps Ops>
std::enable_if_t< kIsWritable< T > > dump::Write (Writer &writer, const utils::StrongTypedef< Tag, T, Ops > &object)
 utils::StrongTypedef serialization support
 
template<typename Tag , typename T , utils::StrongTypedefOps Ops>
std::enable_if_t< kIsReadable< T >, utils::StrongTypedef< Tag, T, Ops > > dump::Read (Reader &reader, To< utils::StrongTypedef< Tag, T, Ops > >)
 utils::StrongTypedef deserialization support
 
template<typename T >
std::enable_if_t< kIsWritable< T > > dump::Write (Writer &writer, const std::unique_ptr< T > &ptr)
 std::unique_ptr serialization support
 
template<typename T >
std::enable_if_t< kIsReadable< T >, std::unique_ptr< T > > dump::Read (Reader &reader, To< std::unique_ptr< T > >)
 std::unique_ptr deserialization support
 
template<typename T >
std::enable_if_t< kIsWritable< T > > dump::Write (Writer &writer, const std::shared_ptr< T > &ptr)
 std::shared_ptr serialization support
 
template<typename T >
std::enable_if_t< kIsReadable< T >, std::shared_ptr< T > > dump::Read (Reader &reader, To< std::shared_ptr< T > >)
 std::shared_ptr deserialization support
 
template<typename L , typename R , typename... Args>
std::enable_if_t< kIsWritable< impl::BoostBimapLeftKey< L, R, Args... > > &&kIsWritable< impl::BoostBimapRightKey< L, R, Args... > > > dump::Write (Writer &writer, const boost::bimap< L, R, Args... > &map)
 boost::bimap serialization support
 
template<typename L , typename R , typename... Args>
std::enable_if_t< kIsReadable< impl::BoostBimapLeftKey< L, R, Args... > > &&kIsReadable< impl::BoostBimapRightKey< L, R, Args... > >, boost::bimap< L, R, Args... > > dump::Read (Reader &reader, To< boost::bimap< L, R, Args... > >)
 boost::bimap deserialization support
 
template<typename T , typename Index , typename Alloc >
std::enable_if_t< kIsWritable< T > > dump::Write (Writer &writer, const boost::multi_index_container< T, Index, Alloc > &container)
 boost::multi_index_container serialization support
 
template<typename T , typename Index , typename Alloc >
std::enable_if_t< kIsReadable< T >, boost::multi_index_container< T, Index, Alloc > > dump::Read (Reader &reader, To< boost::multi_index_container< T, Index, Alloc > >)
 boost::multi_index_container deserialization support
 

Variables

template<typename... Args>
std::enable_if_t<(true &&... &&kIsWritable< Args >) dump::Write )(Writer &writer, const std::variant< Args... > &value)
 std::variant serialization support
 
template<typename... Args>
std::enable_if_t<(true &&... &&(std::is_move_constructible_v< Args > &&kIsReadable< Args >)), std::variant< Args... > dump::Read )(Reader &reader, To< std::variant< Args... > >)
 std::variant deserialization support