LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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.
 
 util
 LArSoft utility namespace.
 

Classes

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  const_value_box
 Little class storing a value. More...
 
class  CountersMap
 Map storing counters in a compact way. More...
 
class  deep_const_fwd_iterator_nested
 Internal helper class: actual implementation of nested iterator. More...
 
class  EnsureOnlyOneSchedule
 
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  memory_error
 Exception thrown when BulkAllocator-specific allocation errors happen. More...
 
class  OptionalHexFloat
 Helper for formatting floats in base 16. More...
 
class  PairSecond
 
struct  PolymorphicClass
 A simple polymorphic class, providing a virtual table. More...
 
struct  PolymorphicUncopiableAndUnmovableClass
 An empty class that can't be copied nor moved. 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...
 
class  ProviderPack
 Container for a list of pointers to providers. More...
 
class  range_t
 A range (interval) of integers. More...
 
struct  SameAsDataTag
 Type for default tag in FindManyInChainP constructors. More...
 
class  ServiceProviderImplementationWrapper
 Service implementation returning a provider. More...
 
class  ServiceProviderInterfaceWrapper
 Service returning a provider interface. More...
 
class  SimpleServiceProviderWrapper
 Service returning a provider. More...
 
class  sparse_vector
 A sparse vector. More...
 
struct  to_element_t
 
struct  UncopiableAndUnmovableClass
 An empty class that can't be copied nor moved. 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...
 
class  value_const_iterator
 A constant iterator returning always the same value. 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 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

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 66 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 25 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 139 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 439 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 282 of file ProviderPack.h.

285  {
286  return {pack, providers...};
287  }
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 52 of file ServicePack.h.

53  {
54  return {lar::providerFrom<Services>()...};
55  }
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 34 of file ProviderUtil.h.

Referenced by detinfo::LArPropertiesStandard::Configure(), and detinfo::DetectorPropertiesStandard::ValidateAndConfigure().

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

Returns true if the argument is a power of 2.

Definition at line 24 of file CountersMap.h.

References LowestSetBit().

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

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

Definition at line 407 of file CountersMap.h.

References lar::details::LowestSetBitScaler().

Referenced by IsPowerOf2().

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

Creates a CollectionView from the specified iterators.

Definition at line 431 of file CollectionView.h.

References lar::details::makeCollectionExtremes(), and lar::details::makeCollectionView().

Referenced by proxy::details::BoundaryList< associated_data_iterator_t >::range().

432  {
434  }
auto makeCollectionView(BeginIter const &b, EndIter const &e)
Creates a CollectionView from the specified iterators.
Float_t e
Definition: plot.C:35
auto makeCollectionExtremes(Range const &range)
Helper to create a CollectionExtremes object from a range object.
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 256 of file ProviderPack.h.

Referenced by lar::details::ProviderPackExtractor< Service >::parameterPack(), and lar::ProviderPack< Providers >::ProviderPack().

257  {
258  return ProviderPack<Providers...>(providers...);
259  }
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 170 of file sparse_vector.h.

References lar::value_const_iterator< T >::index, and lar::value_const_iterator< T >::value.

Referenced by lar::sparse_vector< T >::const_iterator::operator++(), and lar::sparse_vector< T >::const_iterator::operator-().

172  {
173  return {iter.value, iter.index + ofs};
174  }
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 75 of file ServiceUtil.h.

References art::errors::NotFound.

76  {
77  using Service_t = std::add_const_t<T>;
78  using Provider_t = typename Service_t::provider_type;
79 
80  (void)details::ServiceRequirementsChecker<Service_t>();
81 
82  // retrieve the provider
84  Provider_t const* const pProvider{h->provider()};
85  if (!pProvider) {
87  << "ServiceHandle <" << cet::demangle_symbol(typeid(Service_t).name())
88  << "> offered a null provider";
89  }
90 
91  return pProvider;
92 
93  } // providerFrom()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
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 123 of file ServiceUtil.h.

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

Returns the specified container, wrapped in the view.

Definition at line 423 of file CollectionView.h.

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

Variable Documentation

constexpr SameAsDataTag lar::SameAsData

Value for default tag in FindManyInChainP constructors.

Definition at line 43 of file FindManyInChainP.h.