All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Classes | Typedefs | Functions | Variables
lar Namespace Reference

LArSoft-specific namespace. More...

Namespaces

 debug
 
 details
 Namespace hiding implementation details.
 
 dump
 Namespace for LArSoft dumping utilities.
 
 example
 LArSoft examples.
 
 fhicl
 LArSoft utilities for interface with FHiCL and its libraries.
 
 standalone
 Utilities for use in an environment without art.
 
 test
 
 util
 LArSoft utility namespace.
 

Classes

class  EnsureOnlyOneSchedule
 
class  SimpleServiceProviderWrapper
 Service returning a provider. More...
 
class  ServiceProviderInterfaceWrapper
 Service returning a provider interface. More...
 
class  ServiceProviderImplementationWrapper
 Service implementation returning a provider. More...
 
class  ProviderPack
 Container for a list of pointers to providers. More...
 
struct  UncopiableClass
 An empty class that can't be copied (moving is allowed). More...
 
struct  UnmovableClass
 An empty class that can't be moved (copy is allowed). More...
 
struct  UncopiableAndUnmovableClass
 An empty class that can't be copied nor moved. More...
 
struct  PolymorphicClass
 A simple polymorphic class, providing a virtual table. More...
 
struct  PolymorphicUncopiableClass
 A polymorphic empty class that can't be copied (moving is allowed). More...
 
struct  PolymorphicUnmovableClass
 An empty polymorphic class that can't be moved (copy is allowed). More...
 
struct  PolymorphicUncopiableAndUnmovableClass
 An empty class that can't be copied nor moved. More...
 
class  OptionalHexFloat
 Helper for formatting floats in base 16. More...
 
struct  to_element_t
 
class  memory_error
 Exception thrown when BulkAllocator-specific allocation errors happen. More...
 
class  BulkAllocator
 Aggressive allocator reserving a lot of memory in advance. More...
 
class  CollectionView
 Provides features of a collections, from begin and end iterators. More...
 
class  ComputePi
 Computes pi (but it does not make it available) More...
 
class  CountersMap
 Map storing counters in a compact way. More...
 
struct  SameAsDataTag
 Type for default tag in FindManyInChainP constructors. More...
 
class  FindManyInChainP
 Query object collecting a list of associated objects. More...
 
struct  has_const_iterator
 
class  Identity
 Functor returning the object specified as argument. More...
 
class  PairSecond
 
class  deep_const_fwd_iterator_nested
 Internal helper class: actual implementation of nested iterator. More...
 
class  ServicePackTest
 Test module for ServicePack.h utilities depending on art farmework. More...
 
class  const_value_box
 Little class storing a value. More...
 
class  value_const_iterator
 A constant iterator returning always the same value. More...
 
class  range_t
 A range (interval) of integers. More...
 
class  sparse_vector
 A sparse vector. More...
 

Typedefs

template<typename... Services>
using providersFrom_t = lar::ProviderPack< typename Services::provider_type...>
 Type of a provider pack with a provider from each of the Services. More...
 
template<typename... Services>
using ProviderPackFromServices = lar::ProviderPack< typename Services::provider_type...>
 Type of provider pack with providers from all specified Services. More...
 
template<typename BeginIter , typename EndIter = BeginIter>
using RangeAsCollection_t = decltype(makeCollectionView(std::declval< BeginIter >(), std::declval< EndIter >()))
 Type of collection view owning the two range boundary iterators. More...
 
template<typename CITER , typename INNERCONTEXTRACT = Identity<typename CITER::value_type>>
using double_fwd_const_iterator = deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT >
 

Functions

template<typename T >
T::provider_type const * providerFrom ()
 Returns a constant pointer to the provider of specified service. More...
 
template<typename... Services>
auto providersFrom ()
 Returns a lar::ProviderPack with providers from all services. More...
 
template<typename... Providers>
ProviderPack< Providers...> makeProviderPack (Providers const *...providers)
 Function to create a ProviderPack from the function arguments. More...
 
template<typename... PackProviders, typename... MoreProviders>
ProviderPack< PackProviders...,
MoreProviders...> 
expandProviderPack (ProviderPack< PackProviders...> const &pack, MoreProviders const *...providers)
 Function to create a ProviderPack by adding to another. More...
 
std::set< std::string > const & IgnorableProviderConfigKeys ()
 Returns a list of configuration keys that providers should ignore. More...
 
template<typename... Services>
ProviderPackFromServices
< Services...> 
extractProviders ()
 Returns a provider pack with providers from specified services. More...
 
template<typename Range >
CollectionView< Range > const & wrapCollectionIntoView (Range const &c)
 Returns the specified container, wrapped in the view. More...
 
template<typename BeginIter , typename EndIter >
auto makeCollectionView (BeginIter const &b, EndIter const &e)
 Creates a CollectionView from the specified iterators. More...
 
constexpr bool IsPowerOf2 (unsigned long long int v)
 Returns true if the argument is a power of 2. More...
 
constexpr int LowestSetBit (unsigned long long int v)
 Returns the position of the first set bit (0 for LSB) More...
 
template<typename T >
value_const_iterator< T > operator+ (typename value_const_iterator< T >::difference_type ofs, value_const_iterator< T > &iter)
 Returns an iterator pointing ahead of this one by the specified steps. More...
 

Variables

constexpr to_element_t to_element
 
constexpr SameAsDataTag SameAsData
 Value for default tag in FindManyInChainP constructors. More...
 

Detailed Description

LArSoft-specific namespace.

LArSoft libraries.

LArSoft namespace.

Namespace for generic LArSoft-related utilities.

Functor to dereference an object if the object is a pointer.

Bug:
BulkAllocator.h is currently broken; see issue #19494.
Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.fnal..nosp@m.gov)
Date
January 23rd, 2015LArSoft namespace

framework libraries

Typedef Documentation

template<typename CITER , typename INNERCONTEXTRACT = Identity<typename CITER::value_type>>
using lar::double_fwd_const_iterator = typedef deep_const_fwd_iterator_nested<CITER, INNERCONTEXTRACT>

Deep iterator

Todo:
write documentation about how to use it

Definition at line 77 of file NestedIterator.h.

template<typename... Services>
using lar::ProviderPackFromServices = typedef lar::ProviderPack<typename Services::provider_type...>

Type of provider pack with providers from all specified Services.

Definition at line 27 of file ServicePack.h.

template<typename... Services>
using lar::providersFrom_t = typedef lar::ProviderPack<typename Services::provider_type...>

Type of a provider pack with a provider from each of the Services.


Template Parameters
Servicesthe list of services to extract the provider type of

Example of usage in a art service class declaration:

using needed_providers_t = lar::providersFrom_t
  <geo::Geometry, detinfo::LArPropertiesService>;

Definition at line 142 of file ServiceUtil.h.

template<typename BeginIter , typename EndIter = BeginIter>
using lar::RangeAsCollection_t = typedef decltype (makeCollectionView(std::declval<BeginIter>(), std::declval<EndIter>()))

Type of collection view owning the two range boundary iterators.

Definition at line 440 of file CollectionView.h.

Function Documentation

template<typename... PackProviders, typename... MoreProviders>
ProviderPack<PackProviders..., MoreProviders...> lar::expandProviderPack ( ProviderPack< PackProviders...> const &  pack,
MoreProviders const *...  providers 
)

Function to create a ProviderPack by adding to another.

Template Parameters
PackProviderstypes of the providers in the original parameter pack
MoreProviderstypes of the providers to be added
Parameters
packparameter pack with the first providers
providersconstant pointers to the other providers to be added
Returns
a ProviderPack object containing all the specified providers

This is an convenience function to reduce the typing needed to instantiate a ProviderPack. Use it like:

A a;
B b;
C c;
D d;
auto pack = makeProviderPack(&a, &d);
auto largerPack = expandProviderPack(pack, &c, &b);

creates a ProviderPack<A, D, C, B> including all the four objects.

Definition at line 297 of file ProviderPack.h.

301  { return { pack, providers... }; }
template<typename... Services>
ProviderPackFromServices<Services...> lar::extractProviders ( )

Returns a provider pack with providers from specified services.

Template Parameters
Servicesthe services to extract the providers from
Returns
a ProviderPack containing the current service providers

This convenience function automatically extracts all the service providers from a list of services. This is convenient if an algorithm or service accepts a provider pack for setup:

algo->Setup(extractProviders<
  detinfo::DetectorPropertiesService, detinfo::LArPropertiesService
  >());

Also note that the provider packs can rearrange their elements, so the call above should work just the same as:

algo->Setup(extractProviders<
  detinfo::LArPropertiesService, detinfo::DetectorPropertiesService
  >());

If a provider is needed in the setup argument that is not provided by any of the specified services, a compilation error will occur.

Definition at line 54 of file ServicePack.h.

55  { return { lar::providerFrom<Services>()... }; }
std::set<std::string> const& lar::IgnorableProviderConfigKeys ( )
inline

Returns a list of configuration keys that providers should ignore.


Returns
a reference to a key list

This function may be used for parameter validation, like in:

fhicl::Table<Config> cfg { pset, lar::IgnorableProviderConfigKeys() };

where pset is a fhicl::ParameterSet. This will inform cfg that some keys can be unexpectedly present, or missing.

This implementation includes:

  • art framework service keywords

Definition at line 35 of file ProviderUtil.h.

36  {
37  static std::set<std::string> const ignorable {
38  "service_type", // added by art: service name (possibly interface)
39  "service_provider" // art: service implementation name
40  };
41  return ignorable;
42  } // IgnorableProviderConfigKeys()
constexpr bool lar::IsPowerOf2 ( unsigned long long int  v)

Returns true if the argument is a power of 2.

Definition at line 25 of file CountersMap.h.

26  { return v & 1? v == 1: IsPowerOf2(v >> 1); }
constexpr bool IsPowerOf2(unsigned long long int v)
Returns true if the argument is a power of 2.
Definition: CountersMap.h:25
constexpr int lar::LowestSetBit ( unsigned long long int  v)
inline

Returns the position of the first set bit (0 for LSB)

Definition at line 413 of file CountersMap.h.

414  { return (v == 0)? -1: details::LowestSetBitScaler(v, 0); }
constexpr int LowestSetBitScaler(unsigned long long int v, int b)
Internally used by LowestSetBit.
Definition: CountersMap.h:402
template<typename BeginIter , typename EndIter >
auto lar::makeCollectionView ( BeginIter const &  b,
EndIter const &  e 
)

Creates a CollectionView from the specified iterators.

Definition at line 432 of file CollectionView.h.

433  {
435  }
auto makeCollectionExtremes(BeginIter const &b, EndIter const &e)
Helper to create a CollectionExtremes object from two iterators.
CollectionView< Range > makeCollectionView(Range &&)
do i e
template<typename... Providers>
ProviderPack<Providers...> lar::makeProviderPack ( Providers const *...  providers)

Function to create a ProviderPack from the function arguments.

Template Parameters
Providerstypes of the providers in the parameter pack
Parameters
providersconstant pointers to the providers
Returns
a ProviderPack object containing all the specified providers

This is an convenience function to reduce the typing needed to instantiate a ProviderPack. Example:

A a;
B b;
auto pack = makeProviderPack(&a, &b);

creates a ProviderPack<A, B>.

Definition at line 272 of file ProviderPack.h.

273  { return ProviderPack<Providers...>(providers...); }
template<typename T >
value_const_iterator<T> lar::operator+ ( typename value_const_iterator< T >::difference_type  ofs,
value_const_iterator< T > &  iter 
)

Returns an iterator pointing ahead of this one by the specified steps.

Parameters
ofsnumber of steps ahead
iterbase iterator

Definition at line 151 of file sparse_vector.h.

155  { return { iter.value, iter.index + ofs }; }
template<typename T >
T::provider_type const* lar::providerFrom ( )

Returns a constant pointer to the provider of specified service.


Template Parameters
Ttype of the service
Returns
a constant pointer to the provider of specified service
Exceptions
art::Exception(category art::errors::NotFound) if pointer is null

This function relies on the following service and provider interface:

  • provider is not movable nor copyable
  • service contains a type provider_type defined as the class of the service provider
  • service contains a method "provider()" that returns a non-null pointer to a service provider; the service provider is owned and managed by the service, and the caller is not responsible of regulating the object lifetime, nor it should attempt to

Violations of the protocol yield compilation errors (in case non-compliance can be statically detected), or throw of exceptions.

Example of usage:

auto const* geom = lar::providerFrom<geo::Geometry>();

retrieves the service provider for LArSoft geometry. This requires the inclusion of "Geometry/Geometry.h" header, where the service is declared. Typically, both ServiceUtil.h and the header of the provider class are included in the service header.

Definition at line 77 of file ServiceUtil.h.

78  {
79  using Service_t = std::add_const_t<T>;
80  using Provider_t = typename Service_t::provider_type;
81 
82  (void) details::ServiceRequirementsChecker<Service_t>();
83 
84  // retrieve the provider
85  art::ServiceHandle<Service_t> h;
86  Provider_t const* const pProvider { h->provider() };
87  if (!pProvider) {
88  throw art::Exception(art::errors::NotFound)
89  << "ServiceHandle <" << cet::demangle_symbol(typeid(Service_t).name())
90  << "> offered a null provider";
91  }
92 
93  return pProvider;
94 
95  } // providerFrom()
while getopts h
j template void())
Definition: json.hpp:3108
then echo fcl name
template<typename... Services>
auto lar::providersFrom ( )

Returns a lar::ProviderPack with providers from all services.


Template Parameters
Servicesa list of service types
Returns
a lar::ProviderPack with providers from all specified services
Exceptions
art::Exceptionas lar::providerFrom()
See Also
lar::providerFrom()

This function relies on lar::providerFrom() to extract providers from all the specified services. The parameter pack stores the providers in the same order as the services were specified, but this is not very relevant since provider packs can be implicitly converted in other provider packs with the same providers in a different order.

Example of usage:

prov->setup
  (lar::providersFrom<geo::Geometry, detinfo::LArPropertiesService>());

retrieves the service providers for LArSoft geometry and LArPropertiesService, and passes them as a provider pack to a setup() method, presumably from a algorithm or service provider that needs them. This requires the inclusion of "Geometry/Geometry.h" and "LArPropertiesService.h" headers, where the services are declared. Typically, both ServiceUtil.h and the header of the provider class are included in the service headers.

Definition at line 126 of file ServiceUtil.h.

127  { return details::ProviderPackExtractor<Services...>::parameterPack(); }
template<typename Range >
CollectionView<Range> const& lar::wrapCollectionIntoView ( Range const &  c)

Returns the specified container, wrapped in the view.

Definition at line 425 of file CollectionView.h.

426  { return reinterpret_cast<CollectionView<Range> const&>(c); }

Variable Documentation

constexpr SameAsDataTag lar::SameAsData

Value for default tag in FindManyInChainP constructors.

Definition at line 47 of file FindManyInChainP.h.

constexpr to_element_t lar::to_element
inline

Definition at line 24 of file ToElement.h.