Logo ROOT  
Reference Guide
RooSpan< T > Class Template Reference

template<class T>
class RooSpan< T >

A simple container to hold a batch of data values.

It can operate in two modes:

  • Span: It holds only a pointer to the storage held by another object like a std::span does.
  • Temp data: It holds its own data, and exposes the span. This mode is necessary to ship data that are not available in a contiguous storage like e.g. data from a TTree. This means, however, that data have to be copied, and only live as long as the span.

Definition at line 32 of file RooSpan.h.

Public Types

using iterator = typename std::span< T >::iterator
  More...
 
using value_type = typename std::remove_cv< T >::type
  More...
 

Public Member Functions

constexpr RooSpan ()
  More...
 
constexpr RooSpan (const RooSpan &other)
  More...
 
template<typename NON_CONST_T , typename = typename std::enable_if<std::is_same<const NON_CONST_T, T>::value>::type>
constexpr RooSpan (const RooSpan< NON_CONST_T > &other)
 Conversion constructor from <T> to <const T> More...
 
constexpr RooSpan (const std::vector< typename std::remove_cv< T >::type > &vec) noexcept
  More...
 
template<class InputIterator >
constexpr RooSpan (InputIterator beginIn, InputIterator endIn)
 Construct from a range. Data held by foreign object. More...
 
constexpr RooSpan (RooSpan &&other)
  More...
 
constexpr RooSpan (std::vector< typename std::remove_cv< T >::type > &vec) noexcept
  More...
 
constexpr RooSpan (std::vector< value_type > &&payload)
 Hand data over to this span. More...
 
constexpr RooSpan (typename std::span< T >::pointer beginIn, typename std::span< T >::index_type sizeIn)
 Construct from start pointer and size. More...
 
constexpr RooSpan (typename std::span< T >::pointer beginIn, typename std::span< T >::pointer endIn)
 Construct from start and end pointers. More...
 
constexpr std::span< T >::iterator begin () const
  More...
 
constexpr std::span< T >::pointer data () const
  More...
 
constexpr bool empty () const noexcept
  More...
 
constexpr std::span< T >::iterator end () const
  More...
 
template<typename ptr_t >
bool insideSpan (ptr_t ptr) const
 Test if the given pointer/iterator is inside the span. More...
 
constexpr bool isBatch () const noexcept
  More...
 
RooSpan< T > & operator= (const RooSpan< T > &other)=default
  More...
 
constexpr std::span< T >::reference operator[] (typename std::span< T >::index_type i) const noexcept
  More...
 
template<class Span_t >
bool overlaps (const Span_t &other) const
 Test if the span overlaps with other. More...
 
constexpr std::span< T >::index_type size () const noexcept
  More...
 

Private Attributes

std::shared_ptr< std::vector< value_type > > _auxStorage
 If a class does not own a contiguous block of memory, which could be used to create a span, the memory has to be kept alive until all referring spans are destroyed. More...
 
std::span< T > _span
  More...
 

#include <RooSpan.h>

Member Typedef Documentation

◆ iterator

template<class T >
using RooSpan< T >::iterator = typename std::span<T>::iterator

Definition at line 34 of file RooSpan.h.

◆ value_type

template<class T >
using RooSpan< T >::value_type = typename std::remove_cv<T>::type

Definition at line 35 of file RooSpan.h.

Constructor & Destructor Documentation

◆ RooSpan() [1/10]

template<class T >
constexpr RooSpan< T >::RooSpan ( )
inlineconstexpr

Definition at line 37 of file RooSpan.h.

◆ RooSpan() [2/10]

template<class T >
constexpr RooSpan< T >::RooSpan ( RooSpan< T > &&  other)
inlineconstexpr

Definition at line 41 of file RooSpan.h.

◆ RooSpan() [3/10]

template<class T >
constexpr RooSpan< T >::RooSpan ( const RooSpan< T > &  other)
inlineconstexpr

Definition at line 46 of file RooSpan.h.

◆ RooSpan() [4/10]

template<class T >
template<typename NON_CONST_T , typename = typename std::enable_if<std::is_same<const NON_CONST_T, T>::value>::type>
constexpr RooSpan< T >::RooSpan ( const RooSpan< NON_CONST_T > &  other)
inlineconstexpr

Conversion constructor from <T> to <const T>

Definition at line 55 of file RooSpan.h.

◆ RooSpan() [5/10]

template<class T >
template<class InputIterator >
constexpr RooSpan< T >::RooSpan ( InputIterator  beginIn,
InputIterator  endIn 
)
inlineconstexpr

Construct from a range. Data held by foreign object.

Definition at line 62 of file RooSpan.h.

◆ RooSpan() [6/10]

template<class T >
constexpr RooSpan< T >::RooSpan ( typename std::span< T >::pointer  beginIn,
typename std::span< T >::pointer  endIn 
)
inlineconstexpr

Construct from start and end pointers.

Definition at line 69 of file RooSpan.h.

◆ RooSpan() [7/10]

template<class T >
constexpr RooSpan< T >::RooSpan ( typename std::span< T >::pointer  beginIn,
typename std::span< T >::index_type  sizeIn 
)
inlineconstexpr

Construct from start pointer and size.

Definition at line 77 of file RooSpan.h.

◆ RooSpan() [8/10]

template<class T >
constexpr RooSpan< T >::RooSpan ( const std::vector< typename std::remove_cv< T >::type > &  vec)
inlineconstexprnoexcept

Definition at line 84 of file RooSpan.h.

◆ RooSpan() [9/10]

template<class T >
constexpr RooSpan< T >::RooSpan ( std::vector< typename std::remove_cv< T >::type > &  vec)
inlineconstexprnoexcept

Definition at line 89 of file RooSpan.h.

◆ RooSpan() [10/10]

template<class T >
constexpr RooSpan< T >::RooSpan ( std::vector< value_type > &&  payload)
inlineconstexpr

Hand data over to this span.

This will mean that the data will get deleted when it goes out of scope. Try to avoid this because unnecessary copies will be made.

Definition at line 98 of file RooSpan.h.

Member Function Documentation

◆ begin()

template<class T >
constexpr std::span<T>::iterator RooSpan< T >::begin ( ) const
inlineconstexpr

Definition at line 107 of file RooSpan.h.

◆ data()

template<class T >
constexpr std::span<T>::pointer RooSpan< T >::data ( ) const
inlineconstexpr

Definition at line 115 of file RooSpan.h.

◆ empty()

template<class T >
constexpr bool RooSpan< T >::empty ( ) const
inlineconstexprnoexcept

Definition at line 127 of file RooSpan.h.

◆ end()

template<class T >
constexpr std::span<T>::iterator RooSpan< T >::end ( ) const
inlineconstexpr

Definition at line 111 of file RooSpan.h.

◆ insideSpan()

template<class T >
template<typename ptr_t >
bool RooSpan< T >::insideSpan ( ptr_t  ptr) const
inline

Test if the given pointer/iterator is inside the span.

Definition at line 145 of file RooSpan.h.

◆ isBatch()

template<class T >
constexpr bool RooSpan< T >::isBatch ( ) const
inlineconstexprnoexcept

Definition at line 131 of file RooSpan.h.

◆ operator=()

template<class T >
RooSpan<T>& RooSpan< T >::operator= ( const RooSpan< T > &  other)
default

◆ operator[]()

template<class T >
constexpr std::span<T>::reference RooSpan< T >::operator[] ( typename std::span< T >::index_type  i) const
inlineconstexprnoexcept

Definition at line 119 of file RooSpan.h.

◆ overlaps()

template<class T >
template<class Span_t >
bool RooSpan< T >::overlaps ( const Span_t &  other) const
inline

Test if the span overlaps with other.

Definition at line 138 of file RooSpan.h.

◆ size()

template<class T >
constexpr std::span<T>::index_type RooSpan< T >::size ( ) const
inlineconstexprnoexcept

Definition at line 123 of file RooSpan.h.

Member Data Documentation

◆ _auxStorage

template<class T >
std::shared_ptr<std::vector<value_type> > RooSpan< T >::_auxStorage
private

If a class does not own a contiguous block of memory, which could be used to create a span, the memory has to be kept alive until all referring spans are destroyed.

Definition at line 154 of file RooSpan.h.

◆ _span

template<class T >
std::span<T> RooSpan< T >::_span
private

Definition at line 155 of file RooSpan.h.


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