TECA
The Toolkit for Extreme Climate Analysis
teca_dataset Class Referenceabstract

Interface for TECA datasets. More...

#include <teca_dataset.h>

Inheritance diagram for teca_dataset:
[legend]
Collaboration diagram for teca_dataset:
[legend]

Public Types

using allocator = teca_variant_array::allocator
 

Public Member Functions

virtual int set_request_indices (const std::string &request_key, const unsigned long ids[2])
 
virtual int get_request_indices (unsigned long ids[2]) const
 
virtual int get_request_index (unsigned long &index) const
 
virtual int set_request_index (const std::string &request_key, unsigned long index)
 
 operator bool () const noexcept
 
virtual bool empty () const noexcept
 
virtual p_teca_dataset new_instance () const =0
 virtual constructor. return a new dataset of the same type. More...
 
virtual p_teca_dataset new_copy (allocator alloc=allocator::malloc) const =0
 
virtual p_teca_dataset new_shallow_copy ()=0
 
virtual std::string get_class_name () const =0
 
virtual int get_type_code () const =0
 
virtual void copy (const const_p_teca_dataset &other, allocator alloc=allocator::malloc)
 
virtual void shallow_copy (const p_teca_dataset &other)
 
virtual void copy_metadata (const const_p_teca_dataset &other)
 copy metadata. always a deep copy. More...
 
virtual void swap (const p_teca_dataset &other)
 swap internals of the two objects More...
 
virtual teca_metadataget_metadata () noexcept
 get the dataset metadata More...
 
virtual const teca_metadataget_metadata () const noexcept
 get the dataset metadata More...
 
virtual void set_metadata (const teca_metadata &md)
 set the dataset metadata More...
 
virtual int to_stream (teca_binary_stream &) const
 serialize the dataset to the given stream for I/O or communication More...
 
virtual int from_stream (teca_binary_stream &)
 deserialize the dataset from the given stream for I/O or communication More...
 
virtual int to_stream (std::ostream &) const
 send to stream in a human readable representation More...
 
virtual int from_stream (std::istream &)
 read from stream in a human readable representation More...
 
index_request_key

The name of the key that holds the index identifying this dataset's location in the index set.

void set_index_request_key (const std::vector< std::string > &vals)
 
int get_index_request_key (std::vector< std::string > &vals) const
 
void set_index_request_key (const p_teca_variant_array &vals)
 
int get_index_request_key (p_teca_variant_array vals) const
 
void set_index_request_key (const std::initializer_list< std::string > &l)
 
void set_index_request_key (const std::string *vals)
 
int get_index_request_key (std::string *vals) const
 
void set_index_request_key (const std::string &val_1)
 
int get_index_request_key (std::string &val_1) const
 

Protected Member Functions

 teca_dataset (const teca_dataset &)=delete
 
 teca_dataset (const teca_dataset &&)=delete
 
void operator= (const p_teca_dataset &other)=delete
 
void operator= (p_teca_dataset &&other)=delete
 

Protected Attributes

teca_metadatametadata
 

Detailed Description

Interface for TECA datasets.

Member Function Documentation

◆ copy()

virtual void teca_dataset::copy ( const const_p_teca_dataset &  other,
allocator  alloc = allocator::malloc 
)
virtual

Deep copy data and metdata.

Parameters
[in]otherThe dataset to copy.
[in]allocThe allocator to use for alloctions of data structures to hold the copy. The default is a CPU based allocator.

Reimplemented in teca_cf_time_axis_data, teca_uniform_cartesian_mesh, teca_table, teca_mesh, teca_curvilinear_mesh, teca_cartesian_mesh, teca_array_collection, teca_arakawa_c_grid, and teca_database.

◆ copy_metadata()

virtual void teca_dataset::copy_metadata ( const const_p_teca_dataset &  other)
virtual

copy metadata. always a deep copy.

Reimplemented in teca_database, teca_curvilinear_mesh, teca_cartesian_mesh, and teca_arakawa_c_grid.

◆ empty()

virtual bool teca_dataset::empty ( ) const
inlinevirtualnoexcept
Returns
true if the dataset is empty.

Reimplemented in teca_cf_time_axis_data, teca_table, teca_mesh, teca_database, and teca_arakawa_c_grid.

◆ from_stream() [1/2]

virtual int teca_dataset::from_stream ( std::istream &  )
virtual

read from stream in a human readable representation

Reimplemented in teca_cf_time_axis_data, teca_table, teca_mesh, and teca_database.

◆ from_stream() [2/2]

virtual int teca_dataset::from_stream ( teca_binary_stream )
virtual

deserialize the dataset from the given stream for I/O or communication

Reimplemented in teca_array_collection, teca_cf_time_axis_data, teca_table, teca_mesh, teca_database, teca_curvilinear_mesh, teca_cartesian_mesh, and teca_arakawa_c_grid.

◆ get_metadata() [1/2]

virtual const teca_metadata& teca_dataset::get_metadata ( ) const
virtualnoexcept

get the dataset metadata

◆ get_metadata() [2/2]

virtual teca_metadata& teca_dataset::get_metadata ( )
virtualnoexcept

get the dataset metadata

Reimplemented in teca_cf_time_axis_data, and teca_cf_time_axis_data.

◆ get_request_index()

virtual int teca_dataset::get_request_index ( unsigned long &  index) const
virtual

Looks for an index_request_key and uses the value to get the single index stored in this dataset. The call can fail if the index_request_key has not been set or if the dataset holds more than one index.

Parameters
[out]idsthe inclusive range of indices stored in this dataset.
Returns
zero if successful.

◆ get_request_indices()

virtual int teca_dataset::get_request_indices ( unsigned long  ids[2]) const
virtual

Looks for an index_request_key and uses the value to get the inclusive range of indices stored in this dataset. The call can fail if the index_request_key has not been set.

Parameters
[out]idsthe inclusive range of indices stored in this dataset.
Returns
zero if successful.

◆ new_copy()

virtual p_teca_dataset teca_dataset::new_copy ( allocator  alloc = allocator::malloc) const
pure virtual

Virtual copy constructor. return a deep copy of this dataset in a new instance.

Parameters
[in]allocThe allocator to use for alloctions of data structures to hold the copy. The default is a CPU based allocator.

Implemented in teca_cf_time_axis_data, teca_uniform_cartesian_mesh, teca_table, teca_database, teca_curvilinear_mesh, teca_cartesian_mesh, teca_array_collection, and teca_arakawa_c_grid.

◆ new_instance()

virtual p_teca_dataset teca_dataset::new_instance ( ) const
pure virtual

◆ new_shallow_copy()

virtual p_teca_dataset teca_dataset::new_shallow_copy ( )
pure virtual

Virtual shallow copy constructor. return a shallow copy of this dataset in a new instance. References to source data structures are taken, but metadata is always deep copied.

Implemented in teca_cf_time_axis_data, teca_uniform_cartesian_mesh, teca_table, teca_database, teca_curvilinear_mesh, teca_cartesian_mesh, teca_array_collection, and teca_arakawa_c_grid.

◆ operator bool()

teca_dataset::operator bool ( ) const
inlineexplicitnoexcept

covert to boolean.

Returns
true if the dataset is not empty, otherwise false.

◆ set_metadata()

virtual void teca_dataset::set_metadata ( const teca_metadata md)
virtual

set the dataset metadata

◆ set_request_index()

virtual int teca_dataset::set_request_index ( const std::string &  request_key,
unsigned long  index 
)
virtual

Set the name of the index_request_key and a key with that name set to an inclusive range of indices [i0, i0] i.e. a single index.

Parameters
[in]request_keythe name of the index_request_key will be stored in the dataset metadata index_request_key
[in]idsan inclusive range of indices that will be stored in a key named by the value of request_key
Returns
zero if successful

◆ set_request_indices()

virtual int teca_dataset::set_request_indices ( const std::string &  request_key,
const unsigned long  ids[2] 
)
virtual

Set the name of the index_request_key and a key with that name set to an inclusive range of indices [i0, i1].

Parameters
[in]request_keythe name of the index_request_key will be stored in the dataset metadata index_request_key
[in]idsan inclusive range of indices that will be stored in a key named by the value of request_key
Returns
zero if successful

◆ shallow_copy()

virtual void teca_dataset::shallow_copy ( const p_teca_dataset &  other)
virtual

Shallow copy data and metadata. The shallow copy takes references to the source data structures. Metadata is always deep copied.

Parameters
[in]otherThe dataset to copy.

Reimplemented in teca_cf_time_axis_data, teca_uniform_cartesian_mesh, teca_table, teca_mesh, teca_database, teca_curvilinear_mesh, teca_cartesian_mesh, teca_array_collection, and teca_arakawa_c_grid.

◆ swap()

virtual void teca_dataset::swap ( const p_teca_dataset &  other)
virtual

◆ to_stream() [1/2]

virtual int teca_dataset::to_stream ( std::ostream &  ) const
virtual

◆ to_stream() [2/2]

virtual int teca_dataset::to_stream ( teca_binary_stream ) const
virtual

serialize the dataset to the given stream for I/O or communication

Reimplemented in teca_array_collection, teca_cf_time_axis_data, teca_table, teca_mesh, teca_database, teca_curvilinear_mesh, teca_cartesian_mesh, and teca_arakawa_c_grid.


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