Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
cudf::detail::base_2dspan< T, RowType > Class Template Reference

Generic class for row-major 2D spans. Not compliant with STL container semantics/syntax. More...

#include <span.hpp>

Public Types

using size_type = std::pair< size_t, size_t >
 Type used to represent the dimension of the span.
 

Public Member Functions

constexpr base_2dspan (T *data, size_t rows, size_t columns) noexcept
 Constructor a 2D span. More...
 
 base_2dspan (T *data, size_type size) noexcept
 Constructor a 2D span. More...
 
constexpr auto data () const noexcept
 Returns a pointer to the beginning of the sequence. More...
 
constexpr auto size () const noexcept
 Returns the size in the span as pair. More...
 
constexpr auto count () const noexcept
 Returns the number of elements in the span. More...
 
constexpr bool is_empty () const noexcept
 Checks if the span is empty. More...
 
constexpr RowType< T, dynamic_extentoperator[] (size_t row) const
 Returns a reference to the row-th element of the sequence. More...
 
constexpr RowType< T, dynamic_extentfront () const
 Returns a reference to the first element in the span. More...
 
constexpr RowType< T, dynamic_extentback () const
 Returns a reference to the last element in the span. More...
 
constexpr base_2dspan subspan (size_t first_row, size_t num_rows) const noexcept
 Obtains a 2D span that is a view over the num_rows rows of this span starting at first_row More...
 
constexpr RowType< T, dynamic_extentflat_view ()
 Returns a flattened span of the 2D span. More...
 
template<typename OtherT , template< typename, size_t > typename OtherRowType, std::enable_if_t< std::is_convertible_v< OtherRowType< OtherT, dynamic_extent >, RowType< T, dynamic_extent >>, void > * = nullptr>
constexpr base_2dspan (base_2dspan< OtherT, OtherRowType > const &other) noexcept
 Construct a 2D span from another 2D span of convertible type. More...
 

Static Public Member Functions

static constexpr size_t flatten_index (size_t row, size_t column, size_type size) noexcept
 Returns flattened index of the element at the specified 2D position. More...
 

Protected Attributes

T * _data = nullptr
 pointer to the first element
 
size_type _size {0, 0}
 rows, columns
 

Detailed Description

template<typename T, template< typename, std::size_t > typename RowType>
class cudf::detail::base_2dspan< T, RowType >

Generic class for row-major 2D spans. Not compliant with STL container semantics/syntax.

The index operator returns the corresponding row.

Definition at line 382 of file span.hpp.

Constructor & Destructor Documentation

◆ base_2dspan() [1/3]

template<typename T , template< typename, std::size_t > typename RowType>
constexpr cudf::detail::base_2dspan< T, RowType >::base_2dspan ( T *  data,
size_t  rows,
size_t  columns 
)
inlineconstexprnoexcept

Constructor a 2D span.

Parameters
dataPointer to the data
rowsNumber of rows
columnsNumber of columns

Definition at line 395 of file span.hpp.

◆ base_2dspan() [2/3]

template<typename T , template< typename, std::size_t > typename RowType>
cudf::detail::base_2dspan< T, RowType >::base_2dspan ( T *  data,
size_type  size 
)
inlinenoexcept

Constructor a 2D span.

Parameters
dataPointer to the data
sizeSize of the 2D span as pair

Definition at line 405 of file span.hpp.

◆ base_2dspan() [3/3]

template<typename T , template< typename, std::size_t > typename RowType>
template<typename OtherT , template< typename, size_t > typename OtherRowType, std::enable_if_t< std::is_convertible_v< OtherRowType< OtherT, dynamic_extent >, RowType< T, dynamic_extent >>, void > * = nullptr>
constexpr cudf::detail::base_2dspan< T, RowType >::base_2dspan ( base_2dspan< OtherT, OtherRowType > const &  other)
inlineconstexprnoexcept

Construct a 2D span from another 2D span of convertible type.

Template Parameters
OtherTType of the other 2D span
OtherRowTypeType of the row of the other 2D span
Parameters
otherThe other 2D span

Definition at line 516 of file span.hpp.

Member Function Documentation

◆ back()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr RowType<T, dynamic_extent> cudf::detail::base_2dspan< T, RowType >::back ( ) const
inlineconstexpr

Returns a reference to the last element in the span.

Calling back() on an empty span results in undefined behavior.

Returns
Reference to the last element in the span

Definition at line 474 of file span.hpp.

◆ count()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr auto cudf::detail::base_2dspan< T, RowType >::count ( ) const
inlineconstexprnoexcept

Returns the number of elements in the span.

Returns
Number of elements in the span

Definition at line 424 of file span.hpp.

◆ data()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr auto cudf::detail::base_2dspan< T, RowType >::data ( ) const
inlineconstexprnoexcept

Returns a pointer to the beginning of the sequence.

Returns
A pointer to the first element of the span

Definition at line 412 of file span.hpp.

◆ flat_view()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr RowType<T, dynamic_extent> cudf::detail::base_2dspan< T, RowType >::flat_view ( )
inlineconstexpr

Returns a flattened span of the 2D span.

Returns
A flattened span of the 2D span

Definition at line 498 of file span.hpp.

◆ flatten_index()

template<typename T , template< typename, std::size_t > typename RowType>
static constexpr size_t cudf::detail::base_2dspan< T, RowType >::flatten_index ( size_t  row,
size_t  column,
size_type  size 
)
inlinestaticconstexprnoexcept

Returns flattened index of the element at the specified 2D position.

Parameters
rowThe row index
columnThe column index
sizeThe size of the 2D span as pair
Returns
The flattened index of the element at the specified 2D position

Definition at line 440 of file span.hpp.

◆ front()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr RowType<T, dynamic_extent> cudf::detail::base_2dspan< T, RowType >::front ( ) const
inlineconstexpr

Returns a reference to the first element in the span.

Calling front() on an empty span results in undefined behavior.

Returns
Reference to the first element in the span

Definition at line 466 of file span.hpp.

◆ is_empty()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr bool cudf::detail::base_2dspan< T, RowType >::is_empty ( ) const
inlineconstexprnoexcept

Checks if the span is empty.

Returns
True if the span is empty, false otherwise

Definition at line 430 of file span.hpp.

◆ operator[]()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr RowType<T, dynamic_extent> cudf::detail::base_2dspan< T, RowType >::operator[] ( size_t  row) const
inlineconstexpr

Returns a reference to the row-th element of the sequence.

The behavior is undefined if row is out of range (i.e., if it is greater than or equal to size()).

Parameters
rowthe index of the element to access
Returns
A reference to the row-th element of the sequence, i.e., data()[row]

Definition at line 454 of file span.hpp.

◆ size()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr auto cudf::detail::base_2dspan< T, RowType >::size ( ) const
inlineconstexprnoexcept

Returns the size in the span as pair.

Returns
pair representing rows and columns size of the span

Definition at line 418 of file span.hpp.

◆ subspan()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr base_2dspan cudf::detail::base_2dspan< T, RowType >::subspan ( size_t  first_row,
size_t  num_rows 
) const
inlineconstexprnoexcept

Obtains a 2D span that is a view over the num_rows rows of this span starting at first_row

Parameters
first_rowThe first row in the subspan
num_rowsThe number of rows in the subspan
Returns
A subspan of the sequence, of requested starting first_row and num_rows

Definition at line 487 of file span.hpp.


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