Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 34 of file RooSpan.h.

Public Types

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

Public Member Functions

constexpr RooSpan ()
 
constexpr RooSpan (const RooSpan &other)
 
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> If the input span owns some memory, the const-version of the span will copy the shared_ptr.
 
constexpr RooSpan (const std::vector< typename std::remove_cv< T >::type > &vec) noexcept
 
template<class InputIterator >
constexpr RooSpan (InputIterator beginIn, InputIterator endIn)
 Construct from a range. Data held by foreign object.
 
constexpr RooSpan (RooSpan &&other)
 
constexpr RooSpan (std::vector< typename std::remove_cv< T >::type > &vec) noexcept
 
constexpr RooSpan (std::vector< value_type > &&payload)=delete
 We cannot point to temporary data.
 
constexpr RooSpan (typename std::span< T >::pointer beginIn, typename std::span< T >::index_type sizeIn)
 Construct from start pointer and size.
 
constexpr RooSpan (typename std::span< T >::pointer beginIn, typename std::span< T >::pointer endIn)
 Construct from start and end pointers.
 
constexpr std::span< T >::iterator begin () const
 
constexpr std::span< T >::pointer data () const
 
constexpr bool empty () const noexcept
 
constexpr std::span< T >::iterator end () const
 
template<typename ptr_t >
constexpr bool insideSpan (ptr_t ptr) const
 Test if the given pointer/iterator is inside the span.
 
constexpr bool isBatch () const noexcept
 
RooSpanoperator= (const RooSpan &other)=default
 
std::span< T >::reference operator[] (typename std::span< T >::index_type i) const noexcept
 
template<class Span_t >
constexpr bool overlaps (const Span_t &other) const
 Test if the span overlaps with other.
 
constexpr std::span< T >::index_type size () const noexcept
 

Private Attributes

std::span< T > _span
 

#include <RooSpan.h>

Member Typedef Documentation

◆ iterator

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

Definition at line 36 of file RooSpan.h.

◆ value_type

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

Definition at line 37 of file RooSpan.h.

Constructor & Destructor Documentation

◆ RooSpan() [1/10]

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

Definition at line 39 of file RooSpan.h.

◆ RooSpan() [2/10]

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

Definition at line 42 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> If the input span owns some memory, the const-version of the span will copy the shared_ptr.

Definition at line 56 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 63 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 76 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 82 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 86 of file RooSpan.h.

◆ RooSpan() [10/10]

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

We cannot point to temporary data.

Member Function Documentation

◆ begin()

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

Definition at line 98 of file RooSpan.h.

◆ data()

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

Definition at line 106 of file RooSpan.h.

◆ empty()

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

Definition at line 125 of file RooSpan.h.

◆ end()

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

Definition at line 102 of file RooSpan.h.

◆ insideSpan()

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

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

Definition at line 143 of file RooSpan.h.

◆ isBatch()

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

Definition at line 129 of file RooSpan.h.

◆ operator=()

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

◆ operator[]()

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

Definition at line 115 of file RooSpan.h.

◆ overlaps()

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

Test if the span overlaps with other.

Definition at line 136 of file RooSpan.h.

◆ size()

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

Definition at line 121 of file RooSpan.h.

Member Data Documentation

◆ _span

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

Definition at line 149 of file RooSpan.h.

  • roofit/batchcompute/inc/RooSpan.h