PLaSK library
Loading...
Searching...
No Matches
plask::LazyData< T > Class Template Reference

Lazy data (vector). More...

#include <plask/lazydata.hpp>

Public Types

typedefCellType
 
typedef DataVector< T > DataVectorType
 
typedef DataVector< const T > DataVectorOfConstType
 
typedef IndexedIterator< const LazyData, T > const_iterator
 Random access iterator type which allow iterate over all points in this lazy data vector, in order appointed by operator[].
 
typedef const_iterator iterator
 
typedef const_iterator Iterator
 

Public Member Functions

 LazyData (const LazyDataImpl< T > *impl=nullptr)
 Construct lazy data vector which use given implementation to provide data.
 
 LazyData (std::size_t size, T value)
 Construct lazy data vector which returns the same value for each index.
 
 LazyData (DataVector< const T > data_vector)
 Construct lazy data vector which wraps DataVector and allows to access to it.
 
 LazyData (DataVector< T > data_vector)
 
 LazyData (std::size_t size, std::function< T(std::size_t)> func)
 Construct lazy data from size and functor.
 
void reset (const LazyDataImpl< T > *new_impl=nullptr)
 
void reset (std::size_t size, T value)
 
void reset (DataVector< const T > data_vector)
 
void reset (DataVector< T > data_vector)
 
void reset (std::size_t size, std::function< T(std::size_t)> func)
 
operator[] (std::size_t index) const
 Get index-th value from this vector.
 
at (std::size_t index) const
 Get index-th value from this vector.
 
DataVector< const T > nonLazy () const
 
 operator DataVector< const T > () const
 
DataVector< T > claim () const
 
std::size_t size () const
 Get the number of elements in this vector.
 
const_iterator begin () const
 
const_iterator end () const
 
bool isNotNull () const
 
bool isNull () const
 

Detailed Description

template<typename T>
class plask::LazyData< T >

Lazy data (vector).

It ownership a pointer to implementation of lazy data (vector) which is of the type LazyDataImpl<T>.

Reading from LazyData object is thread-safty.

Definition at line 161 of file lazydata.hpp.

Member Typedef Documentation

◆ CellType

template<typename T >
typedef T plask::LazyData< T >::CellType

Definition at line 169 of file lazydata.hpp.

◆ const_iterator

template<typename T >
typedef IndexedIterator< const LazyData, T > plask::LazyData< T >::const_iterator

Random access iterator type which allow iterate over all points in this lazy data vector, in order appointed by operator[].

This iterator type is indexed, which means that it have (read-write) index field equal to 0 for begin() and growing up to size() for end().

Definition at line 251 of file lazydata.hpp.

◆ DataVectorOfConstType

template<typename T >
typedef DataVector<const T> plask::LazyData< T >::DataVectorOfConstType

Definition at line 171 of file lazydata.hpp.

◆ DataVectorType

template<typename T >
typedef DataVector<T> plask::LazyData< T >::DataVectorType

Definition at line 170 of file lazydata.hpp.

◆ iterator

template<typename T >
typedef const_iterator plask::LazyData< T >::iterator

Definition at line 252 of file lazydata.hpp.

◆ Iterator

template<typename T >
typedef const_iterator plask::LazyData< T >::Iterator

Definition at line 253 of file lazydata.hpp.

Constructor & Destructor Documentation

◆ LazyData() [1/5]

template<typename T >
plask::LazyData< T >::LazyData ( const LazyDataImpl< T > *  impl = nullptr)
inline

Construct lazy data vector which use given implementation to provide data.

Parameters
impllazy data vector implementation to use (if nullptr, reset should be called before another methods)

Definition at line 177 of file lazydata.hpp.

◆ LazyData() [2/5]

template<typename T >
plask::LazyData< T >::LazyData ( std::size_t  size,
value 
)
inline

Construct lazy data vector which returns the same value for each index.

Parameters
sizenumber of values, size of the vector
valuevalue which will be returned for each index

Definition at line 184 of file lazydata.hpp.

◆ LazyData() [3/5]

template<typename T >
plask::LazyData< T >::LazyData ( DataVector< const T >  data_vector)
inline

Construct lazy data vector which wraps DataVector and allows to access to it.

Parameters
data_vectorvector to wrap

Definition at line 190 of file lazydata.hpp.

◆ LazyData() [4/5]

template<typename T >
plask::LazyData< T >::LazyData ( DataVector< T >  data_vector)
inline

Definition at line 191 of file lazydata.hpp.

◆ LazyData() [5/5]

template<typename T >
plask::LazyData< T >::LazyData ( std::size_t  size,
std::function< T(std::size_t)>  func 
)
inline

Construct lazy data from size and functor.

Parameters
sizedata size
funcfunction returning data at point

Definition at line 198 of file lazydata.hpp.

Member Function Documentation

◆ at()

template<typename T >
T plask::LazyData< T >::at ( std::size_t  index) const
inline

Get index-th value from this vector.

Parameters
indexshould be a value from 0 to size()-1
Returns
index-th value from this vector

Definition at line 229 of file lazydata.hpp.

◆ begin()

template<typename T >
const_iterator plask::LazyData< T >::begin ( ) const
inline
Returns
iterator referring to the first point in this

Definition at line 256 of file lazydata.hpp.

◆ claim()

template<typename T >
DataVector< T > plask::LazyData< T >::claim ( ) const
inline

Definition at line 235 of file lazydata.hpp.

◆ end()

template<typename T >
const_iterator plask::LazyData< T >::end ( ) const
inline
Returns
iterator referring to the past-the-end point in this

Definition at line 259 of file lazydata.hpp.

◆ isNotNull()

template<typename T >
bool plask::LazyData< T >::isNotNull ( ) const
inline

Definition at line 261 of file lazydata.hpp.

◆ isNull()

template<typename T >
bool plask::LazyData< T >::isNull ( ) const
inline

Definition at line 263 of file lazydata.hpp.

◆ nonLazy()

template<typename T >
DataVector< const T > plask::LazyData< T >::nonLazy ( ) const
inline

Definition at line 231 of file lazydata.hpp.

◆ operator DataVector< const T >()

template<typename T >
plask::LazyData< T >::operator DataVector< const T > ( ) const
inline

Definition at line 233 of file lazydata.hpp.

◆ operator[]()

template<typename T >
T plask::LazyData< T >::operator[] ( std::size_t  index) const
inline

Get index-th value from this vector.

Parameters
indexshould be a value from 0 to size()-1
Returns
index-th value from this vector

Definition at line 222 of file lazydata.hpp.

◆ reset() [1/5]

template<typename T >
void plask::LazyData< T >::reset ( const LazyDataImpl< T > *  new_impl = nullptr)
inline

Definition at line 201 of file lazydata.hpp.

◆ reset() [2/5]

template<typename T >
void plask::LazyData< T >::reset ( DataVector< const T >  data_vector)
inline

Definition at line 205 of file lazydata.hpp.

◆ reset() [3/5]

template<typename T >
void plask::LazyData< T >::reset ( DataVector< T >  data_vector)
inline

Definition at line 206 of file lazydata.hpp.

◆ reset() [4/5]

template<typename T >
void plask::LazyData< T >::reset ( std::size_t  size,
std::function< T(std::size_t)>  func 
)
inline

Definition at line 208 of file lazydata.hpp.

◆ reset() [5/5]

template<typename T >
void plask::LazyData< T >::reset ( std::size_t  size,
value 
)
inline

Definition at line 203 of file lazydata.hpp.

◆ size()

template<typename T >
std::size_t plask::LazyData< T >::size ( ) const
inline

Get the number of elements in this vector.

Returns
the number of elements in this vector

Definition at line 245 of file lazydata.hpp.


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