ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::bins::static_array< entry_t, N > Class Template Reference

Bin that holds a collection of entries. More...

#include <detray/utils/grid/grid_bins.hpp>

Inheritance diagram for detray::bins::static_array< entry_t, N >:
[legend]
Collaboration diagram for detray::bins::static_array< entry_t, N >:
[legend]

Public Types

using entry_type = entry_t
 Type stored in each bin.

Public Member Functions

constexpr static_array ()
 Default constructor initializer the bin with an invalid value.
constexpr static_array (const static_array &other)=default
 Copies a bin and its contents.
constexpr static_array (static_array &&other) noexcept=default
 Moves a bin and its contents.
constexpr dindex capacity () const noexcept
constexpr auto init (darray< entry_t, N > content) -> static_array &
 Initialize from an entire bin content content.
constexpr auto init (entry_t entry=detail::invalid_value< entry_t >()) -> static_array &
 Initialize with a single entry filled.
static_array & operator= (const static_array &other) noexcept=default
 Copies another bin's contents.
constexpr bool operator== (const static_array &rhs) const
 Equality operator.
template<typename E = entry_t>
constexpr void push_back (E &&entry) noexcept
 Add a new entry to the bin.
constexpr dindex size () const
bin_iterator_t begin ()
 Returns an iterator to the first valid entry.
bin_iterator_t end ()
 Returns an iterator one past the last valid entry.
const_bin_iterator_t begin () const
 Returns a const iterator to the first valid entry.
const_bin_iterator_t end () const
 Returns a const iterator one past the last valid entry.
Public Member Functions inherited from detray::ranges::view_interface< static_array< entry_t, N > >
constexpr decltype(auto) back () const
 Return a reference to the last element.
constexpr auto data () const
 Return a pointer to the first element, or null for an empty view.
constexpr auto empty () const -> bool
 Check whether the view contains no elements.
constexpr decltype(auto) front () const
 Return a reference to the first element.
constexpr operator bool () const
 Test whether the view contains at least one element.
constexpr decltype(auto) operator[] (const dindex i) const
 Subscript operator that takes detray dindex.
constexpr auto size () const
 Return the number of elements in the view.

Detailed Description

template<typename entry_t, std::size_t N>
class detray::bins::static_array< entry_t, N >

Bin that holds a collection of entries.

Keeps an additional counter to track the number of entries per bin. The bin capacity is static.

Constructor & Destructor Documentation

◆ static_array() [1/2]

template<typename entry_t, std::size_t N>
detray::bins::static_array< entry_t, N >::static_array ( const static_array< entry_t, N > & other)
constexprdefault

Copies a bin and its contents.

Parameters
otherBin to copy.

◆ static_array() [2/2]

template<typename entry_t, std::size_t N>
detray::bins::static_array< entry_t, N >::static_array ( static_array< entry_t, N > && other)
constexprdefaultnoexcept

Moves a bin and its contents.

Parameters
otherBin to move from.

Member Function Documentation

◆ begin() [1/2]

template<typename entry_t, std::size_t N>
bin_iterator_t detray::bins::static_array< entry_t, N >::begin ( )

Returns an iterator to the first valid entry.

Returns
view iterator over bin content in start or end position

◆ begin() [2/2]

template<typename entry_t, std::size_t N>
const_bin_iterator_t detray::bins::static_array< entry_t, N >::begin ( ) const

Returns a const iterator to the first valid entry.

Returns
Const iterator to the first valid entry.

◆ capacity()

template<typename entry_t, std::size_t N>
dindex detray::bins::static_array< entry_t, N >::capacity ( ) const
constexprnoexcept
Returns
The fixed storage capacity of this bin.

◆ end() [1/2]

template<typename entry_t, std::size_t N>
bin_iterator_t detray::bins::static_array< entry_t, N >::end ( )

Returns an iterator one past the last valid entry.

Returns
Iterator past the last valid entry.

◆ end() [2/2]

template<typename entry_t, std::size_t N>
const_bin_iterator_t detray::bins::static_array< entry_t, N >::end ( ) const

Returns a const iterator one past the last valid entry.

Returns
Const iterator past the last valid entry.

◆ init() [1/2]

template<typename entry_t, std::size_t N>
auto detray::bins::static_array< entry_t, N >::init ( darray< entry_t, N > content) ->static_array &
constexpr

Initialize from an entire bin content content.

Parameters
contentArray containing the bin contents; invalid sentinels are excluded from the resulting size.
Returns
Access to the initialized bin

◆ init() [2/2]

template<typename entry_t, std::size_t N>
auto detray::bins::static_array< entry_t, N >::init ( entry_t entry = detail::invalid_value<entry_t>()) ->static_array &
constexpr

Initialize with a single entry filled.

Parameters
entryInitial value; the invalid sentinel leaves the bin empty.
Returns
Access to the initialized bin

◆ operator=()

template<typename entry_t, std::size_t N>
static_array & detray::bins::static_array< entry_t, N >::operator= ( const static_array< entry_t, N > & other)
defaultnoexcept

Copies another bin's contents.

Parameters
otherBin whose contents are copied.
Returns
This bin after assignment.

◆ operator==()

template<typename entry_t, std::size_t N>
bool detray::bins::static_array< entry_t, N >::operator== ( const static_array< entry_t, N > & rhs) const
constexpr

Equality operator.

Parameters
rhsthe bin entry to compare with
Returns
true if the content is equal

◆ push_back()

template<typename entry_t, std::size_t N>
template<typename E = entry_t>
void detray::bins::static_array< entry_t, N >::push_back ( E && entry)
constexprnoexcept

Add a new entry to the bin.

Parameters
entryValue to append. The caller must ensure capacity is available.

◆ size()

template<typename entry_t, std::size_t N>
dindex detray::bins::static_array< entry_t, N >::size ( ) const
constexpr
Returns
the number of entries in this bin - const