LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar::details Namespace Reference

Namespace hiding implementation details. More...

Namespaces

 bulk_allocator
 Namespace specific to bulk allocator.
 
 counters_map
 
 type_traits
 

Classes

struct  are_same_types
 
struct  are_types_contained
 
struct  are_types_contained< First >
 
struct  are_types_contained< First, OtherTypes... >
 
class  CollectionExtremes
 Class storing a begin and a end iterator. More...
 
class  const_datarange_iterator
 
class  CounterBlock
 Type of block of counters (just a STL array until SUBCOUNTERS are in) More...
 
struct  CountersMapTraits
 
struct  enable_if_type_exists
 
struct  findFirstMatching_answer
 
struct  findFirstMatching_answer< Match, Target, false, FirstCandidate, OtherCandidates... >
 
struct  findFirstMatching_answer< Match, Target, true, Candidates... >
 
struct  findFirstMatching_dispatcher
 
struct  findFirstMatching_dispatcher< Match, Target >
 
struct  findFirstMatching_dispatcher< Match, Target, FirstCandidate, OtherCandidates... >
 
struct  findFirstMatching_impl
 
struct  findNextMatching_impl
 
struct  findNextMatching_impl< 0U, Match, Target, FirstCandidate, OtherCandidates... >
 
struct  findNextMatching_impl< NSkip, Match, Target >
 
struct  findNextMatching_impl< NSkip, Match, Target, FirstCandidate, OtherCandidates... >
 
struct  findTheMatching_impl
 
struct  has_duplicate_types
 
struct  has_duplicate_types< Key, Types... >
 
struct  has_duplicate_types<>
 
struct  has_type
 
struct  has_type< Target >
 
struct  has_type< Target, First, Others... >
 
struct  has_type< Target, Target, Others... >
 
struct  have_same_provider_types
 
struct  have_same_provider_types< ProviderPack< AProviders... >, ProviderPack< BProviders... > >
 
struct  is_derived_of
 
struct  is_provider_pack
 
struct  is_provider_pack< ProviderPack< Providers... > >
 
class  iteratorRange
 Enclosure to use two iterators representing a range in a range-for loop. More...
 
struct  OptionalHexFloatFormatter
 
struct  ProviderPackComparer
 
struct  ProviderPackComparer< APack, BPack, First >
 
struct  ProviderPackComparer< APack, BPack, First, Others... >
 
struct  ProviderPackComparerBase
 
struct  ProviderPackExtractor
 
struct  ProviderPackExtractor< First, Others... >
 
struct  ProviderPackExtractor< Service >
 
struct  RangeTraits
 
struct  ServiceProviderRequirementsChecker
 Compiles only if PROVIDER class satisfied service provider requirements. More...
 
struct  ServiceRequirementsChecker
 
struct  SetFrom
 Implementation detail for the extraction constructor. More...
 
struct  SetFrom< DestPack, SourcePack >
 
struct  SetFrom< DestPack, SourcePack, FirstProvider, OtherProviders... >
 

Typedefs

template<bool Value>
using bool_constant = std::integral_constant< bool, Value >
 
template<std::size_t Value>
using index_constant = std::integral_constant< std::size_t, Value >
 
template<typename T , typename R = void>
using enable_if_type_exists_t = typename enable_if_type_exists< T, R >::type
 
template<typename H , typename R = void>
using enable_if_is_handle_t = enable_if_type_exists_t< typename std::decay_t< H >::HandleTag, R >
 

Functions

template<typename Derived , typename... Bases>
constexpr std::size_t indexOfBaseOf ()
 Index of the class among Bases which is base of Derived. More...
 
template<typename Derived , typename... Bases>
constexpr std::size_t indexOfDerivedFrom ()
 
template<typename Derived , typename... Bases>
constexpr std::size_t findBaseOf ()
 Index of the class among Bases which is base of Derived. More...
 
template<typename Derived , typename... Bases>
constexpr std::size_t findDerivedFrom ()
 
template<typename Derived , typename... Bases>
constexpr std::size_t hasBaseOf ()
 Returns whether there is exactly one base class of Derived among Bases. More...
 
template<typename Derived , typename... Bases>
constexpr std::size_t hasDerivedFrom ()
 
template<typename Provider , typename APack , typename BPack >
bool haveSameProvider (APack const &a, BPack const &b)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, details::OptionalHexFloatFormatter< T > fmt)
 
template<typename BeginIter , typename EndIter >
auto makeCollectionExtremes (BeginIter const &b, EndIter const &e)
 Helper to create a CollectionExtremes object from two iterators. More...
 
template<typename Range >
auto makeCollectionExtremes (Range const &range)
 Helper to create a CollectionExtremes object from a range object. More...
 
template<typename Range >
CollectionView< Range > makeCollectionView (Range &&)
 
constexpr int LowestSetBitScaler (unsigned long long int v, int b)
 Internally used by LowestSetBit. More...
 
template<typename T >
decltype(auto) make_const_datarange_t (typename sparse_vector< T >::datarange_t &r)
 
template<typename T >
std::string demangle ()
 Demangles the name of a type. More...
 
template<typename T >
std::string demangle (const T &)
 Demangles the name of a type. More...
 

Detailed Description

Namespace hiding implementation details.

Typedef Documentation

template<bool Value>
using lar::details::bool_constant = typedef std::integral_constant<bool, Value>

Definition at line 298 of file ProviderPack.h.

template<typename H , typename R = void>
using lar::details::enable_if_is_handle_t = typedef enable_if_type_exists_t<typename std::decay_t<H>::HandleTag, R>

Definition at line 35 of file FindManyInChainP.h.

template<typename T , typename R = void>
using lar::details::enable_if_type_exists_t = typedef typename enable_if_type_exists<T, R>::type

Definition at line 32 of file FindManyInChainP.h.

template<std::size_t Value>
using lar::details::index_constant = typedef std::integral_constant<std::size_t, Value>

Definition at line 301 of file ProviderPack.h.

Function Documentation

template<typename T >
std::string lar::details::demangle ( )

Demangles the name of a type.

Template Parameters
Ttype to be demangled
Parameters
[anonymous]parameter to determine the type
Returns
a string with the demangled name

This function relies on GCC ABI; if there is no GCC, no demangling happens. One version of this function takes no parameters, and the type must be specified explicitly in the call. The other takes one parameter, that is not actually used but allows the compiler to understand which type to use. The following usese are equivalent:

std::vector<int> v;
std::cout << demangle<std::vector<int>>() << std::endl;
std::cout << demangle(v) << std::endl;

Definition at line 203 of file BulkAllocator.h.

204  {
205  std::string name = typeid(T).name();
206 #ifdef __GNUG__
207  int status; // some arbitrary value to eliminate the compiler warning
208  std::unique_ptr<char, void (*)(void*)> res{
209  abi::__cxa_demangle(name.c_str(), NULL, NULL, &status), std::free};
210  return (status == 0) ? res.get() : name;
211 #else // !__GNUG__
212  return name;
213 #endif // ?__GNUG__
214  } // demangle()
template<typename T >
std::string lar::details::demangle ( const T &  )
inline

Demangles the name of a type.

Template Parameters
Ttype to be demangled
Parameters
[anonymous]parameter to determine the type
Returns
a string with the demangled name

This function relies on GCC ABI; if there is no GCC, no demangling happens. One version of this function takes no parameters, and the type must be specified explicitly in the call. The other takes one parameter, that is not actually used but allows the compiler to understand which type to use. The following usese are equivalent:

std::vector<int> v;
std::cout << demangle<std::vector<int>>() << std::endl;
std::cout << demangle(v) << std::endl;

Definition at line 217 of file BulkAllocator.h.

218  {
219  return demangle<T>();
220  }
template<typename Derived , typename... Bases>
constexpr std::size_t lar::details::findBaseOf ( )

Index of the class among Bases which is base of Derived.

Template Parameters
Derivedthe class to be found
Basesa list of classes candidate to be the base of Derived
Returns
index of the class among Bases which is base of Derived
Exceptions
static_assertif none, or multiple classes, are base of Derived
See also
hasBaseOf(), indexOfBaseOf()

Definition at line 520 of file ProviderPack.h.

References indexOfBaseOf().

521  {
522  constexpr std::size_t index = indexOfBaseOf<Derived, Bases...>();
523  static_assert(index < sizeof...(Bases),
524  "Target is not derived from any of the available classes");
525  return index;
526  } // findBaseOf()
constexpr std::size_t indexOfBaseOf()
Index of the class among Bases which is base of Derived.
Definition: ProviderPack.h:514
template<typename Derived , typename... Bases>
constexpr std::size_t lar::details::findDerivedFrom ( )

Definition at line 539 of file ProviderPack.h.

References indexOfDerivedFrom().

Referenced by lar::ProviderPack< Providers >::get(), and lar::ProviderPack< Providers >::set().

540  {
541  constexpr std::size_t index = indexOfDerivedFrom<Base, Derived...>();
542  static_assert(index < sizeof...(Derived),
543  "Target is not base of any of the available classes");
544  return index;
545  } // findDerivedFrom()
constexpr std::size_t indexOfDerivedFrom()
Definition: ProviderPack.h:533
template<typename Derived , typename... Bases>
constexpr std::size_t lar::details::hasBaseOf ( )

Returns whether there is exactly one base class of Derived among Bases.

Template Parameters
Derivedthe class to be found
Basesa list of classes candidate to be the base of Derived
Returns
whether there is exactly one base class of Derived
Exceptions
static_assertif multiple classes are base of Derived
See also
indexOfBaseOf(), findBaseOf()

Definition at line 69 of file ProviderPack.h.

References indexOfBaseOf().

70  {
71  return indexOfBaseOf<Derived, Bases...>() < sizeof...(Bases);
72  }
constexpr std::size_t indexOfBaseOf()
Index of the class among Bases which is base of Derived.
Definition: ProviderPack.h:514
template<typename Derived , typename... Bases>
constexpr std::size_t lar::details::hasDerivedFrom ( )

Definition at line 75 of file ProviderPack.h.

References indexOfDerivedFrom().

Referenced by lar::ProviderPack< Providers >::has().

76  {
77  return indexOfDerivedFrom<Derived, Bases...>() < sizeof...(Bases);
78  }
constexpr std::size_t indexOfDerivedFrom()
Definition: ProviderPack.h:533
template<typename Provider , typename APack , typename BPack >
bool lar::details::haveSameProvider ( APack const &  a,
BPack const &  b 
)

Definition at line 573 of file ProviderPack.h.

574  {
575  static_assert(is_provider_pack<APack>() && is_provider_pack<BPack>(),
576  "This class needs two ProviderPack template types.");
577  return a.template get<Provider>() == b.template get<Provider>();
578  } // haveSameProvider()
template<typename Derived , typename... Bases>
constexpr std::size_t lar::details::indexOfBaseOf ( )

Index of the class among Bases which is base of Derived.

Template Parameters
Derivedthe class to be found
Basesa list of classes candidate to be the base of Derived
Returns
index of the class among Bases which is base of Derived
Exceptions
static_assertif multiple classes are base of Derived
See also
hasBaseOf(), findBaseOf()

If no class among Bases is actually a base class of Derived, an invalid index is returned, greater than any valid index (that is, no smaller than sizeof...(Bases)).

Definition at line 514 of file ProviderPack.h.

Referenced by findBaseOf(), and hasBaseOf().

515  {
516  return findTheMatching_impl<std::is_base_of, Derived, Bases...>();
517  }
template<typename Derived , typename... Bases>
constexpr std::size_t lar::details::indexOfDerivedFrom ( )

Definition at line 533 of file ProviderPack.h.

Referenced by findDerivedFrom(), and hasDerivedFrom().

534  {
535  return findTheMatching_impl<is_derived_of, Base, Derived...>();
536  }
constexpr int lar::details::LowestSetBitScaler ( unsigned long long int  v,
int  b 
)
inline

Internally used by LowestSetBit.

Definition at line 396 of file CountersMap.h.

Referenced by lar::LowestSetBit().

397  {
398  return (v & 1) ? b : LowestSetBitScaler(v >> 1, b + 1);
399  }
constexpr int LowestSetBitScaler(unsigned long long int v, int b)
Internally used by LowestSetBit.
Definition: CountersMap.h:396
template<typename T >
decltype(auto) lar::details::make_const_datarange_t ( typename sparse_vector< T >::datarange_t &  r)

Definition at line 1708 of file sparse_vector.h.

References r.

1709  {
1710  return static_cast<typename sparse_vector<T>::const_datarange_t&>(r);
1711  }
TRandom r
Definition: spectrum.C:23
template<typename BeginIter , typename EndIter >
auto lar::details::makeCollectionExtremes ( BeginIter const &  b,
EndIter const &  e 
)

Helper to create a CollectionExtremes object from two iterators.

Definition at line 147 of file CollectionView.h.

References e.

Referenced by makeCollectionExtremes(), and lar::makeCollectionView().

148  {
149  return CollectionExtremes<BeginIter, EndIter>(b, e);
150  }
Float_t e
Definition: plot.C:35
template<typename Range >
auto lar::details::makeCollectionExtremes ( Range const &  range)

Helper to create a CollectionExtremes object from a range object.

Definition at line 155 of file CollectionView.h.

References util::cbegin(), util::cend(), makeCollectionExtremes(), and makeCollectionView().

156  {
157  using std::cbegin;
158  using std::cend;
159  return makeCollectionExtremes(cbegin(range), cend(range));
160  } // makeCollectionExtremes(range)
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:93
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:85
auto makeCollectionExtremes(Range const &range)
Helper to create a CollectionExtremes object from a range object.
template<typename Range >
CollectionView< Range > lar::details::makeCollectionView ( Range &&  range)

Definition at line 444 of file CollectionView.h.

Referenced by makeCollectionExtremes(), and lar::makeCollectionView().

445  {
446  return CollectionView<Range>(std::move(range));
447  }
template<typename T >
std::ostream& lar::details::operator<< ( std::ostream &  os,
details::OptionalHexFloatFormatter< T >  fmt 
)

Definition at line 84 of file hexfloat.h.

85  {
86  return fmt(os);
87  }