LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geo::details::GeoContainerData< T > Class Template Reference

#include "GeometryDataContainers.h"

Public Types

using index_type = size_type
 Type used internally (so far) for indexing. More...
 
STL container types.
using value_type = typename Container_t::value_type
 
using reference = typename Container_t::reference
 
using const_reference = typename Container_t::const_reference
 
using pointer = typename Container_t::pointer
 
using const_pointer = typename Container_t::const_pointer
 
using iterator = typename Container_t::iterator
 
using const_iterator = typename Container_t::const_iterator
 
using reverse_iterator = typename Container_t::reverse_iterator
 
using const_reverse_iterator = typename Container_t::const_reverse_iterator
 
using difference_type = typename Container_t::difference_type
 
using size_type = typename Container_t::size_type
 

Public Member Functions

 GeoContainerData ()=default
 Default constructor with empty container. Good for nothing. More...
 
 GeoContainerData (size_type size)
 Prepares the container with default-constructed data. More...
 
 GeoContainerData (size_type size, value_type const &defValue)
 
Container status query
size_type size () const
 Returns the number of elements in the container. More...
 
size_type capacity () const
 Returns the number of elements the container has memory for. More...
 
bool empty () const
 Returns whether the container has no elements (false by assumptions). More...
 
Data modification

In general, each single element can be accessed and changed. In addition, this section includes methods acting on multiple elements at once.

void fill (value_type value)
 Sets all elements to the specified value (copied). More...
 
void reset ()
 Sets all the elements to a default-constructed value_type. More...
 
template<typename Op >
Op apply (Op &&op)
 Applies an operation on all elements. More...
 
template<typename Op >
Op apply (Op &&op) const
 Applies an operation on all elements. More...
 
Container modification
void resize (size_type size)
 Prepares the container with default-constructed data. More...
 
void resize (size_type size, value_type const &defValue)
 Prepares the container with copies of the specified default value. More...
 
void clear ()
 Makes the container empty, with no usable storage space. More...
 
Element access
reference operator[] (index_type index)
 Returns the element for the specified index. More...
 
const_reference operator[] (index_type index) const
 Returns the element for the specified index (read-only). More...
 
Iterators
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 

Static Public Member Functions

template<typename Value , typename Upper >
static bool bounded (Value v, Upper upper)
 Returns whether the specified value is between 0 and the upper limit. More...
 

Private Types

using Container_t = std::vector< T >
 

Private Attributes

Container_t fData
 Data storage area. More...
 

Detailed Description

template<typename T>
class geo::details::GeoContainerData< T >

Definition at line 47 of file GeometryDataContainers.h.

Member Typedef Documentation

template<typename T >
using geo::details::GeoContainerData< T >::const_iterator = typename Container_t::const_iterator

Definition at line 973 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::const_pointer = typename Container_t::const_pointer

Definition at line 971 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::const_reference = typename Container_t::const_reference

Definition at line 969 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::const_reverse_iterator = typename Container_t::const_reverse_iterator

Definition at line 975 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::Container_t = std::vector<T>
private

Definition at line 960 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::difference_type = typename Container_t::difference_type

Definition at line 976 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::index_type = size_type

Type used internally (so far) for indexing.

Definition at line 982 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::iterator = typename Container_t::iterator

Definition at line 972 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::pointer = typename Container_t::pointer

Definition at line 970 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::reference = typename Container_t::reference

Definition at line 968 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::reverse_iterator = typename Container_t::reverse_iterator

Definition at line 974 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::size_type = typename Container_t::size_type

Definition at line 977 of file GeometryDataContainers.h.

template<typename T >
using geo::details::GeoContainerData< T >::value_type = typename Container_t::value_type

Definition at line 967 of file GeometryDataContainers.h.

Constructor & Destructor Documentation

template<typename T >
geo::details::GeoContainerData< T >::GeoContainerData ( )
default

Default constructor with empty container. Good for nothing.

template<typename T >
geo::details::GeoContainerData< T >::GeoContainerData ( size_type  size)
inline

Prepares the container with default-constructed data.

Definition at line 990 of file GeometryDataContainers.h.

990 : fData(size) {}
size_type size() const
Returns the number of elements in the container.
Container_t fData
Data storage area.
template<typename T >
geo::details::GeoContainerData< T >::GeoContainerData ( size_type  size,
value_type const &  defValue 
)
inline

Definition at line 993 of file GeometryDataContainers.h.

993 : fData(size, defValue) {}
size_type size() const
Returns the number of elements in the container.
Container_t fData
Data storage area.

Member Function Documentation

template<typename T >
template<typename Op >
Op geo::details::GeoContainerData< T >::apply ( Op &&  op)
inline

Applies an operation on all elements.

Template Parameters
Optype of operation
Parameters
opOperation
Returns
the operation object after operations took place

The operation op is a unary functor, i.e. an object that supports the call to op(value_type&).

The return values of op calls are discarded.

Definition at line 1041 of file GeometryDataContainers.h.

Referenced by geo::GeoIDdataContainer< T, Mapper >::apply(), and geo::GeoIDdataContainer< T, Mapper >::clear().

1042  {
1043  for (auto& data : fData)
1044  op(data);
1045  return op;
1046  }
Container_t fData
Data storage area.
template<typename T >
template<typename Op >
Op geo::details::GeoContainerData< T >::apply ( Op &&  op) const
inline

Applies an operation on all elements.

Template Parameters
Optype of operation
Parameters
opOperation
Returns
the operation object after operations took place

The operation op is a unary functor, i.e. an object that supports the call to op(value_type const&).

The return values of op calls are discarded.

Definition at line 1060 of file GeometryDataContainers.h.

1061  {
1062  for (auto const& data : fData)
1063  op(data);
1064  return op;
1065  }
Container_t fData
Data storage area.
template<typename T >
iterator geo::details::GeoContainerData< T >::begin ( )
inline

Definition at line 1125 of file GeometryDataContainers.h.

Referenced by geo::GeoIDdataContainer< T, Mapper >::begin(), and geo::GeoIDdataContainer< T, Mapper >::end().

1125 { return fData.begin(); }
Container_t fData
Data storage area.
template<typename T >
const_iterator geo::details::GeoContainerData< T >::begin ( ) const
inline

Definition at line 1127 of file GeometryDataContainers.h.

1127 { return fData.begin(); }
Container_t fData
Data storage area.
template<typename T >
template<typename Value , typename Upper >
static bool geo::details::GeoContainerData< T >::bounded ( Value  v,
Upper  upper 
)
inlinestatic

Returns whether the specified value is between 0 and the upper limit.

Definition at line 1144 of file GeometryDataContainers.h.

1145  {
1146  return (v >= 0) && (static_cast<size_type>(v) < upper);
1147  }
typename Container_t::size_type size_type
template<typename T >
size_type geo::details::GeoContainerData< T >::capacity ( ) const
inline

Returns the number of elements the container has memory for.

Definition at line 1005 of file GeometryDataContainers.h.

Referenced by geo::GeoIDdataContainer< T, Mapper >::capacity().

1005 { return fData.capacity(); }
Container_t fData
Data storage area.
template<typename T >
const_iterator geo::details::GeoContainerData< T >::cbegin ( ) const
inline

Definition at line 1129 of file GeometryDataContainers.h.

1129 { return fData.cbegin(); }
Container_t fData
Data storage area.
template<typename T >
const_iterator geo::details::GeoContainerData< T >::cend ( ) const
inline

Definition at line 1130 of file GeometryDataContainers.h.

1130 { return fData.cend(); }
Container_t fData
Data storage area.
template<typename T >
void geo::details::GeoContainerData< T >::clear ( )
inline

Makes the container empty, with no usable storage space.

See also
resize()

The container needs to be resized before it is useful again.

Definition at line 1103 of file GeometryDataContainers.h.

Referenced by geo::GeoIDdataContainer< T, Mapper >::clear().

1103 { fData.clear(); }
Container_t fData
Data storage area.
template<typename T >
const_reverse_iterator geo::details::GeoContainerData< T >::crbegin ( ) const
inline

Definition at line 1136 of file GeometryDataContainers.h.

1136 { return fData.crbegin(); }
Container_t fData
Data storage area.
template<typename T >
const_reverse_iterator geo::details::GeoContainerData< T >::crend ( ) const
inline

Definition at line 1137 of file GeometryDataContainers.h.

1137 { return fData.crend(); }
Container_t fData
Data storage area.
template<typename T >
bool geo::details::GeoContainerData< T >::empty ( ) const
inline

Returns whether the container has no elements (false by assumptions).

Definition at line 1008 of file GeometryDataContainers.h.

Referenced by geo::GeoIDdataContainer< T, Mapper >::empty(), and geo::GeoIDdataContainer< T, Mapper >::GeoIDdataContainer().

1008 { return fData.empty(); }
Container_t fData
Data storage area.
template<typename T >
iterator geo::details::GeoContainerData< T >::end ( )
inline

Definition at line 1126 of file GeometryDataContainers.h.

Referenced by geo::GeoIDdataContainer< T, Mapper >::end().

1126 { return fData.end(); }
Container_t fData
Data storage area.
template<typename T >
const_iterator geo::details::GeoContainerData< T >::end ( ) const
inline

Definition at line 1128 of file GeometryDataContainers.h.

1128 { return fData.end(); }
Container_t fData
Data storage area.
template<typename T >
void geo::details::GeoContainerData< T >::fill ( value_type  value)
inline

Sets all elements to the specified value (copied).

Definition at line 1024 of file GeometryDataContainers.h.

References trkf::fill(), and value.

Referenced by geo::GeoIDdataContainer< T, Mapper >::fill().

1024 { std::fill(fData.begin(), fData.end(), value); }
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
double value
Definition: spectrum.C:18
Container_t fData
Data storage area.
template<typename T >
reference geo::details::GeoContainerData< T >::operator[] ( index_type  index)
inline

Returns the element for the specified index.

Definition at line 1113 of file GeometryDataContainers.h.

1113 { return fData[index]; }
Container_t fData
Data storage area.
template<typename T >
const_reference geo::details::GeoContainerData< T >::operator[] ( index_type  index) const
inline

Returns the element for the specified index (read-only).

Definition at line 1116 of file GeometryDataContainers.h.

1116 { return fData[index]; }
Container_t fData
Data storage area.
template<typename T >
reverse_iterator geo::details::GeoContainerData< T >::rbegin ( )
inline

Definition at line 1132 of file GeometryDataContainers.h.

1132 { return fData.rbegin(); }
Container_t fData
Data storage area.
template<typename T >
const_reverse_iterator geo::details::GeoContainerData< T >::rbegin ( ) const
inline

Definition at line 1134 of file GeometryDataContainers.h.

1134 { return fData.rbegin(); }
Container_t fData
Data storage area.
template<typename T >
reverse_iterator geo::details::GeoContainerData< T >::rend ( )
inline

Definition at line 1133 of file GeometryDataContainers.h.

1133 { return fData.rend(); }
Container_t fData
Data storage area.
template<typename T >
const_reverse_iterator geo::details::GeoContainerData< T >::rend ( ) const
inline

Definition at line 1135 of file GeometryDataContainers.h.

1135 { return fData.rend(); }
Container_t fData
Data storage area.
template<typename T >
void geo::details::GeoContainerData< T >::reset ( )
inline

Sets all the elements to a default-constructed value_type.

Definition at line 1027 of file GeometryDataContainers.h.

References trkf::fill().

Referenced by geo::GeoIDdataContainer< T, Mapper >::reset().

1027 { fill(value_type{}); }
typename Container_t::value_type value_type
void fill(value_type value)
Sets all elements to the specified value (copied).
template<typename T >
void geo::details::GeoContainerData< T >::resize ( size_type  size)
inline

Prepares the container with default-constructed data.

Parameters
sizenumber of elements in the container
See also
clear(), fill()

The container is sized to host data for all the elements. Each new element in the container is default-constructed. Existing data is not touched.

Definition at line 1083 of file GeometryDataContainers.h.

Referenced by geo::GeoIDdataContainer< T, Mapper >::resize(), and geo::GeoIDdataContainer< T, Mapper >::resizeAs().

1083 { fData.resize(size); }
size_type size() const
Returns the number of elements in the container.
Container_t fData
Data storage area.
template<typename T >
void geo::details::GeoContainerData< T >::resize ( size_type  size,
value_type const &  defValue 
)
inline

Prepares the container with copies of the specified default value.

Parameters
sizenumber of elements in the container
defValuethe value copied to fill all entries in the container
See also
clear(), fill()

The container is sized to host data for all the elements. Each new element in the container is constructed as copy of defValue. Existing data is not touched.

Definition at line 1095 of file GeometryDataContainers.h.

1095 { fData.resize(size, defValue); }
size_type size() const
Returns the number of elements in the container.
Container_t fData
Data storage area.
template<typename T >
size_type geo::details::GeoContainerData< T >::size ( ) const
inline

Returns the number of elements in the container.

Definition at line 1002 of file GeometryDataContainers.h.

Referenced by geo::GeoIDdataContainer< T, Mapper >::size().

1002 { return fData.size(); }
Container_t fData
Data storage area.

Member Data Documentation

template<typename T >
Container_t geo::details::GeoContainerData< T >::fData
private

Data storage area.

Definition at line 1150 of file GeometryDataContainers.h.


The documentation for this class was generated from the following file: