Alexandria 2.31.0
SDC-CH common library for the Euclid project
|
This module provides an interface for accessing two dimensional datasets (pairs of (X,Y) values) stored in some storage (file system, database, etc) More...
#include <XYDataset.h>
Public Types | |
typedef std::vector< std::pair< double, double > >::const_iterator | const_iterator |
Public Member Functions | |
XYDataset (std::vector< std::pair< double, double > > values) | |
Constructor XYDataset interface represents an immutable data set. | |
XYDataset (const XYDataset &)=default | |
Copy constructor. | |
XYDataset (XYDataset &&)=default | |
Move constructor. | |
virtual | ~XYDataset ()=default |
Destructor. | |
const_iterator | begin () const |
Returns a const iterator to the first pair of the dataset. | |
const_iterator | end () const |
Returns a const iterator to the one after last pair dataset. | |
const std::pair< double, double > & | front () const |
Returns a reference to the first pair of the dataset. | |
const std::pair< double, double > & | back () const |
Returns a reference to the last pair of the dataset. | |
size_t | size () const |
Get the size of the vector container. | |
Static Public Member Functions | |
static XYDataset | factory (std::vector< std::pair< double, double > > vector_pair) |
Make a XYDataset object from a vector of pair of doubles. | |
static XYDataset | factory (const std::vector< double > &x, const std::vector< double > &y) |
Make a XYDataset object from two vectors of doubles. | |
Private Attributes | |
std::vector< std::pair< double, double > > | m_values {} |
This module provides an interface for accessing two dimensional datasets (pairs of (X,Y) values) stored in some storage (file system, database, etc)
Interface class
The datasets are organized in groups (nested groups are allowed, which create a tree) and they can be uniquely identified by their qualified name, which consists of the group names and the dataset name, separated by slashes "/" for example "groupA/groupB/name". Note that datasets might not belong to any group (or alternatively that they might belong to the root group), in which case they are accessed by just using their name (no leading slash). The module abstracts the nature of the storage and the only assumption is that the datasets can be accessed using their qualified names.
ElementException | : Vectors must have the same size! |
Definition at line 59 of file XYDataset.h.
typedef std::vector<std::pair<double,double>>::const_iterator Euclid::XYDataset::XYDataset::const_iterator |
Definition at line 62 of file XYDataset.h.
|
inline |
Constructor XYDataset interface represents an immutable data set.
XYDataset interface represents an immutable data set, where both X and Y axes contain double values. It provides iterators both for the (X,Y) pairs and for the axes values independently.
values | A vector of pair of doubles |
Definition at line 76 of file XYDataset.h.
|
default |
Copy constructor.
|
default |
Move constructor.
|
virtualdefault |
Destructor.
const std::pair< double, double > & Euclid::XYDataset::XYDataset::back | ( | ) | const |
Returns a reference to the last pair of the dataset.
Definition at line 48 of file XYDataset.cpp.
References std::vector< T >::back(), and m_values.
XYDataset::const_iterator Euclid::XYDataset::XYDataset::begin | ( | ) | const |
Returns a const iterator to the first pair of the dataset.
Definition at line 36 of file XYDataset.cpp.
References std::vector< T >::cbegin(), and m_values.
XYDataset::const_iterator Euclid::XYDataset::XYDataset::end | ( | ) | const |
Returns a const iterator to the one after last pair dataset.
Definition at line 40 of file XYDataset.cpp.
References std::vector< T >::cend(), and m_values.
|
static |
Make a XYDataset object from two vectors of doubles.
x | A vector of double values |
y | A vector of double values |
Definition at line 56 of file XYDataset.cpp.
References std::vector< T >::begin(), std::vector< T >::end(), std::make_pair(), std::vector< T >::reserve(), and std::vector< T >::size().
|
static |
Make a XYDataset object from a vector of pair of doubles.
vector_pair | A vector of pair of doubles |
Definition at line 52 of file XYDataset.cpp.
References std::move().
const std::pair< double, double > & Euclid::XYDataset::XYDataset::front | ( | ) | const |
Returns a reference to the first pair of the dataset.
Definition at line 44 of file XYDataset.cpp.
References std::vector< T >::front(), and m_values.
|
inline |
Get the size of the vector container.
Definition at line 150 of file XYDataset.h.
|
private |