TECA
The Toolkit for Extreme Climate Analysis
teca_variant_array_impl< T > Class Template Reference

The concrete implementation of our type agnostic container for contiguous arrays. More...

#include <teca_variant_array.h>

Inheritance diagram for teca_variant_array_impl< T >:

Public Member Functions

std::string get_class_name () const override
 Returns the name of the class in a human readable form. More...
 
void initialize () override
 Initialize all elements with T() More...
 
const teca_variant_array_impl< T > & operator= (const teca_variant_array_impl< T > &other)
 Copy from the other array. More...
 
template<typename U >
const teca_variant_array_impl< T > & operator= (const teca_variant_array_impl< U > &other)
 Copy from the other array. More...
 
 teca_variant_array_impl (teca_variant_array_impl< T > &&other)
 Move the contents of the other array. More...
 
const teca_variant_array_impl< T > & operator= (teca_variant_array_impl< T > &&other)
 Move the contents of the other array. More...
 
T & get (unsigned long i)
 Get the ith value. More...
 
const T & get (unsigned long i) const
 Get the ith value. More...
 
template<typename U >
void get (unsigned long i, U &val) const
 Get the ith value. More...
 
template<typename U >
void get (size_t start, size_t end, U *vals) const
 
template<typename U >
void get (std::vector< U > &val) const
 Copy the data out into the passed in vector. More...
 
T * get ()
 Get a pointer to the data. More...
 
const T * get () const
 
template<typename U >
void set (unsigned long i, const U &val)
 Set the ith value. More...
 
template<typename U >
void set (size_t start, size_t end, const U *vals)
 Set a range of values described by [start end] inclusive. More...
 
template<typename U >
void set (const std::vector< U > &val)
 Copy data, replacing contents with the passed in vector. More...
 
template<typename U >
void append (const std::vector< U > &val)
 Insert from the passed in vector at the back. More...
 
template<typename U >
void append (const U &val)
 
virtual unsigned long size () const noexcept override
 Get the current size of the data. More...
 
virtual void resize (unsigned long n) override
 Resize the data. More...
 
void resize (unsigned long n, const T &val)
 
virtual void reserve (unsigned long n) override
 Reserve space. More...
 
virtual void clear () noexcept override
 Clear the data. More...
 
void copy (const teca_variant_array &other)
 
void append (const teca_variant_array &other)
 
void swap (teca_variant_array &other) override
 virtual swap More...
 
bool equal (const teca_variant_array &other) const override
 virtual equivalence test More...
 
int to_stream (teca_binary_stream &s) const override
 Serialize to the stream. More...
 
int from_stream (teca_binary_stream &s) override
 Deserialize from the stream. More...
 
int to_stream (std::ostream &s) const override
 Serialize to the stream. More...
 
int from_stream (std::ostream &s) override
 Deserialize from the stream. More...
 

Protected Member Functions

 teca_variant_array_impl (unsigned long n)
 
 teca_variant_array_impl (unsigned long n, const T &v)
 
 teca_variant_array_impl (const T *vals, unsigned long n)
 
template<typename U >
 teca_variant_array_impl (const teca_variant_array_impl< U > &other)
 
 teca_variant_array_impl (const teca_variant_array_impl< T > &other)
 

Friends

class teca_variant_array
 

Array constructors

Constructs a new instance containing the templated type.

static std::shared_ptr< teca_variant_array_impl< T > > New ()
 
static std::shared_ptr< teca_variant_array_impl< T > > New (size_t n)
 
static std::shared_ptr< teca_variant_array_impl< T > > New (size_t n, const T &v)
 
static std::shared_ptr< teca_variant_array_impl< T > > New (const T *vals, size_t n)
 
std::shared_ptr< teca_variant_array_implshared_from_this ()
 
std::shared_ptr< teca_variant_array_impl const > shared_from_this () const
 
p_teca_variant_array new_copy () const override
 Returns a new instance initialized with a copy of this one. More...
 
p_teca_variant_array new_copy (size_t start, size_t end) const override
 Returns a new instance initialized with a copy of a subset of this one. More...
 
p_teca_variant_array new_instance () const override
 Returns a new instance of the same type. More...
 
p_teca_variant_array new_instance (size_t n) const override
 Returns a new instance of the same type sized to hold n elements. More...
 

Detailed Description

template<typename T>
class teca_variant_array_impl< T >

The concrete implementation of our type agnostic container for contiguous arrays.

Constructor & Destructor Documentation

◆ teca_variant_array_impl()

template<typename T >
teca_variant_array_impl< T >::teca_variant_array_impl ( teca_variant_array_impl< T > &&  other)

Move the contents of the other array.

Member Function Documentation

◆ append() [1/2]

template<typename T >
template<typename U >
void teca_variant_array_impl< T >::append ( const std::vector< U > &  val)

Insert from the passed in vector at the back.

◆ append() [2/2]

template<typename T >
void teca_variant_array_impl< T >::append ( const teca_variant_array other)

append. This method is not virtual so that string can be handled as a special case in the base class.

◆ clear()

template<typename T >
void teca_variant_array_impl< T >::clear
overridevirtualnoexcept

Clear the data.

◆ copy()

template<typename T >
void teca_variant_array_impl< T >::copy ( const teca_variant_array other)

copy. This method is not virtual so that string can be handled as a special case in the base class.

◆ equal()

template<typename T >
bool teca_variant_array_impl< T >::equal ( const teca_variant_array other) const
override

virtual equivalence test

◆ from_stream() [1/2]

template<typename T >
int teca_variant_array_impl< T >::from_stream ( std::ostream &  s)
inlineoverride

Deserialize from the stream.

◆ from_stream() [2/2]

template<typename T >
int teca_variant_array_impl< T >::from_stream ( teca_binary_stream s)
inlineoverride

Deserialize from the stream.

◆ get() [1/5]

template<typename T >
T* teca_variant_array_impl< T >::get ( )
inline

Get a pointer to the data.

◆ get() [2/5]

template<typename T >
template<typename U >
void teca_variant_array_impl< T >::get ( std::vector< U > &  val) const

Copy the data out into the passed in vector.

◆ get() [3/5]

template<typename T >
T& teca_variant_array_impl< T >::get ( unsigned long  i)
inline

Get the ith value.

◆ get() [4/5]

template<typename T >
const T& teca_variant_array_impl< T >::get ( unsigned long  i) const
inline

Get the ith value.

◆ get() [5/5]

template<typename T >
template<typename U >
void teca_variant_array_impl< T >::get ( unsigned long  i,
U &  val 
) const

Get the ith value.

◆ get_class_name()

template<typename T >
std::string teca_variant_array_impl< T >::get_class_name
override

Returns the name of the class in a human readable form.

◆ initialize()

template<typename T >
void teca_variant_array_impl< T >::initialize
override

Initialize all elements with T()

◆ New() [1/4]

template<typename T >
static std::shared_ptr< teca_variant_array_impl < T > > teca_variant_array_impl< T >::New ( )
inlinestatic

Allocate a teca_variant_array_impl < T >

◆ New() [2/4]

template<typename T >
static std::shared_ptr< teca_variant_array_impl < T > > teca_variant_array_impl< T >::New ( const T *  vals,
size_t  n 
)
inlinestatic

Allocate a teca_variant_array_impl < T > initialized with n values from vals

◆ New() [3/4]

template<typename T >
static std::shared_ptr< teca_variant_array_impl < T > > teca_variant_array_impl< T >::New ( size_t  n)
inlinestatic

Allocate a teca_variant_array_impl < T > of size n

◆ New() [4/4]

template<typename T >
static std::shared_ptr< teca_variant_array_impl < T > > teca_variant_array_impl< T >::New ( size_t  n,
const T &  v 
)
inlinestatic

Allocate a teca_variant_array_impl < T > of size n initialized with v

◆ new_copy() [1/2]

template<typename T >
p_teca_variant_array teca_variant_array_impl< T >::new_copy
override

Returns a new instance initialized with a copy of this one.

◆ new_copy() [2/2]

template<typename T >
p_teca_variant_array teca_variant_array_impl< T >::new_copy ( size_t  start,
size_t  end 
) const
override

Returns a new instance initialized with a copy of a subset of this one.

◆ new_instance() [1/2]

template<typename T >
p_teca_variant_array teca_variant_array_impl< T >::new_instance
override

Returns a new instance of the same type.

◆ new_instance() [2/2]

template<typename T >
p_teca_variant_array teca_variant_array_impl< T >::new_instance ( size_t  n) const
override

Returns a new instance of the same type sized to hold n elements.

◆ operator=() [1/3]

template<typename T >
const teca_variant_array_impl< T > & teca_variant_array_impl< T >::operator= ( const teca_variant_array_impl< T > &  other)

Copy from the other array.

◆ operator=() [2/3]

template<typename T >
template<typename U >
const teca_variant_array_impl< T > & teca_variant_array_impl< T >::operator= ( const teca_variant_array_impl< U > &  other)

Copy from the other array.

◆ operator=() [3/3]

template<typename T >
const teca_variant_array_impl< T > & teca_variant_array_impl< T >::operator= ( teca_variant_array_impl< T > &&  other)

Move the contents of the other array.

◆ reserve()

template<typename T >
void teca_variant_array_impl< T >::reserve ( unsigned long  n)
overridevirtual

Reserve space.

◆ resize()

template<typename T >
void teca_variant_array_impl< T >::resize ( unsigned long  n)
overridevirtual

Resize the data.

◆ set() [1/3]

template<typename T >
template<typename U >
void teca_variant_array_impl< T >::set ( const std::vector< U > &  val)

Copy data, replacing contents with the passed in vector.

◆ set() [2/3]

template<typename T >
template<typename U >
void teca_variant_array_impl< T >::set ( size_t  start,
size_t  end,
const U *  vals 
)

Set a range of values described by [start end] inclusive.

◆ set() [3/3]

template<typename T >
template<typename U >
void teca_variant_array_impl< T >::set ( unsigned long  i,
const U &  val 
)

Set the ith value.

◆ size()

template<typename T >
unsigned long teca_variant_array_impl< T >::size
overridevirtualnoexcept

Get the current size of the data.

◆ swap()

template<typename T >
void teca_variant_array_impl< T >::swap ( teca_variant_array other)
override

virtual swap

◆ to_stream() [1/2]

template<typename T >
int teca_variant_array_impl< T >::to_stream ( std::ostream &  s) const
inlineoverride

Serialize to the stream.

◆ to_stream() [2/2]

template<typename T >
int teca_variant_array_impl< T >::to_stream ( teca_binary_stream s) const
inlineoverride

Serialize to the stream.


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