Alexandria  2.22.0
Please provide a description of the project.
XYDataset.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2021 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
26 #ifndef XYDATASET_H_
27 #define XYDATASET_H_
28 
29 #include <iterator>
30 #include <memory>
31 #include <string>
32 #include <utility>
33 #include <vector>
34 
35 #include "ElementsKernel/Export.h"
36 
37 namespace Euclid {
38 namespace XYDataset {
39 
60 
61 public:
63 
76  XYDataset(std::vector<std::pair<double, double>> values) // cppcheck-suppress noExplicitConstructor
77  : m_values(std::move(values)){};
78 
80  XYDataset(const XYDataset&) = default;
81 
83  XYDataset(XYDataset&&) = default;
84 
93  static XYDataset factory(std::vector<std::pair<double, double>> vector_pair);
94 
105  static XYDataset factory(const std::vector<double>& x, const std::vector<double>& y);
106 
110  virtual ~XYDataset() = default;
111 
118  const_iterator begin() const;
119 
126  const_iterator end() const;
127 
134  const std::pair<double, double>& front() const;
135 
142  const std::pair<double, double>& back() const;
143 
150  size_t size() const {
151  return m_values.size();
152  }
153 
154 private:
156 };
157 
158 } /* namespace XYDataset */
159 } // end of namespace Euclid
160 
161 #endif // XYDATASET_H_
This module provides an interface for accessing two dimensional datasets (pairs of (X,...
Definition: XYDataset.h:59
XYDataset(const XYDataset &)=default
Copy constructor.
size_t size() const
Get the size of the vector container.
Definition: XYDataset.h:150
virtual ~XYDataset()=default
Destructor.
XYDataset(std::vector< std::pair< double, double >> values)
Constructor XYDataset interface represents an immutable data set.
Definition: XYDataset.h:76
std::vector< std::pair< double, double > >::const_iterator const_iterator
Definition: XYDataset.h:62
XYDataset(XYDataset &&)=default
Move constructor.
#define ELEMENTS_API
STL namespace.