The Gaudi Framework  v30r3 (a5ef0a68)
Gaudi::Functional::details::zip Namespace Reference

Functions

template<typename OS , typename Arg >
void printSizes (OS &out, Arg &&arg)
 Print the parameter. More...
 
template<typename OS , typename Arg , typename... Args>
void printSizes (OS &out, Arg &&arg, Args &&...args)
 Print the parameters. More...
 
template<typename A >
bool check_sizes (const A &) noexcept
 Resolve case there is only one container in the range. More...
 
template<typename A , typename B >
bool check_sizes (const A &a, const B &b) noexcept
 Compare sizes of two containers. More...
 
template<typename A , typename B , typename... C>
bool check_sizes (const A &a, const B &b, const C &...c) noexcept
 Compare sizes of 3 or more containers. More...
 
template<typename... Args>
decltype(auto) verifySizes (Args &...args)
 Verify the data container sizes have the same sizes. More...
 
template<typename... Args>
decltype(auto) range (Args &&...args)
 Zips multiple containers together to form a single range. More...
 
template<typename... Args>
decltype(auto) const_range (Args &&...args)
 Zips multiple containers together to form a single const range. More...
 

Function Documentation

template<typename A >
bool Gaudi::Functional::details::zip::check_sizes ( const A &  )
inlinenoexcept

Resolve case there is only one container in the range.

Definition at line 54 of file FunctionalDetails.h.

55  {
56  return true;
57  }
template<typename A , typename B >
bool Gaudi::Functional::details::zip::check_sizes ( const A &  a,
const B &  b 
)
inlinenoexcept

Compare sizes of two containers.

Definition at line 61 of file FunctionalDetails.h.

62  {
63  return a.size() == b.size();
64  }
template<typename A , typename B , typename... C>
bool Gaudi::Functional::details::zip::check_sizes ( const A &  a,
const B &  b,
const C &...  c 
)
inlinenoexcept

Compare sizes of 3 or more containers.

Definition at line 68 of file FunctionalDetails.h.

69  {
70  return ( check_sizes( a, b ) && check_sizes( b, c... ) );
71  }
bool check_sizes(const A &a, const B &b, const C &...c) noexcept
Compare sizes of 3 or more containers.
template<typename... Args>
decltype( auto ) Gaudi::Functional::details::zip::const_range ( Args &&...  args)
inline

Zips multiple containers together to form a single const range.

Definition at line 97 of file FunctionalDetails.h.

98  {
99 #ifndef NDEBUG
100  verifySizes( args... );
101 #endif
102  return ranges::view::const_( ranges::view::zip( std::forward<Args>( args )... ) );
103  }
decltype(auto) verifySizes(Args &...args)
Verify the data container sizes have the same sizes.
template<typename OS , typename Arg >
void Gaudi::Functional::details::zip::printSizes ( OS &  out,
Arg &&  arg 
)

Print the parameter.

Definition at line 38 of file FunctionalDetails.h.

39  {
40  out << "SizeOf'" << System::typeinfoName( typeid( Arg ) ) << "'=" << std::forward<Arg>( arg ).size();
41  }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:332
constexpr auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size())
template<typename OS , typename Arg , typename... Args>
void Gaudi::Functional::details::zip::printSizes ( OS &  out,
Arg &&  arg,
Args &&...  args 
)

Print the parameters.

Definition at line 45 of file FunctionalDetails.h.

46  {
47  printSizes( out, arg );
48  out << ", ";
49  printSizes( out, args... );
50  }
void printSizes(OS &out, Arg &&arg, Args &&...args)
Print the parameters.
template<typename... Args>
decltype( auto ) Gaudi::Functional::details::zip::range ( Args &&...  args)
inline

Zips multiple containers together to form a single range.

Definition at line 87 of file FunctionalDetails.h.

88  {
89 #ifndef NDEBUG
90  verifySizes( args... );
91 #endif
92  return ranges::view::zip( std::forward<Args>( args )... );
93  }
decltype(auto) verifySizes(Args &...args)
Verify the data container sizes have the same sizes.
template<typename... Args>
decltype( auto ) Gaudi::Functional::details::zip::verifySizes ( Args &...  args)
inline

Verify the data container sizes have the same sizes.

Definition at line 75 of file FunctionalDetails.h.

76  {
77  if ( UNLIKELY( !check_sizes( args... ) ) ) {
78  std::ostringstream mess;
79  mess << "Zipped containers have different sizes : ";
80  printSizes( mess, args... );
81  throw GaudiException( mess.str(), "Gaudi::Functional::details::zip::verifySizes", StatusCode::FAILURE );
82  }
83  }
#define UNLIKELY(x)
Definition: Kernel.h:122
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Define general base for Gaudi exception.
void printSizes(OS &out, Arg &&arg, Args &&...args)
Print the parameters.
bool check_sizes(const A &a, const B &b, const C &...c) noexcept
Compare sizes of 3 or more containers.