data_point_collection.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <vector>
11 #include "interop/util/exception.h"
12 #include "interop/util/assert.h"
14 
15 namespace illumina { namespace interop { namespace model { namespace plot
16 {
17 
20  template<class Point>
22  {
23  typedef std::vector<Point> point_vector_t;
24  public:
26  typedef typename point_vector_t::const_reference const_reference;
28  typedef typename point_vector_t::reference reference;
30  typedef typename point_vector_t::size_type size_type;
32  typedef typename point_vector_t::const_iterator const_iterator;
33 
34  public:
48  const Point & operator[](const size_t index) const INTEROP_THROW_SPEC((model::index_out_of_bounds_exception))
49  {
50  INTEROP_BOUNDS_CHECK(index, m_points.size(), "Index out of bounds");
51  return m_points[index];
52  }
53 
60  {
61  INTEROP_BOUNDS_CHECK(index, m_points.size(), "Index out of bounds");
62  return m_points[index];
63  }
64 
71  const Point &at(const size_t index) const INTEROP_THROW_SPEC((model::index_out_of_bounds_exception))
72  {
73  INTEROP_BOUNDS_CHECK(index, m_points.size(), "Index out of bounds");
74  return m_points[index];
75  }
76 
81  size_t size() const
82  {
83  return m_points.size();
84  }
92  void assign(const size_t n, const Point &val)
93  {
94  m_points.assign(n, val);
95  }
96 
101  void resize(const size_t n)
102  {
103  m_points.resize(n);
104  }
105 
110  const_iterator begin() const
111  {
112  return m_points.begin();
113  }
114 
119  const_iterator end() const
120  {
121  return m_points.end();
122  }
127  void push_back(const Point &point)
128  {
129  m_points.push_back(point);
130  }
131 
132  private:
133  point_vector_t m_points;
134  };
135 
136 
137 }}}}
138 
void push_back(const Point &point)
Definition: data_point_collection.h:127
point_vector_t::reference reference
Definition: data_point_collection.h:28
Definition: enum_description.h:15
void assign(const size_t n, const Point &val)
Definition: data_point_collection.h:92
#define INTEROP_THROW_SPEC(SPEC)
Definition: exception_specification.h:15
size_t size() const
Definition: data_point_collection.h:81
point_vector_t::const_iterator const_iterator
Definition: data_point_collection.h:32
Point & operator[](const size_t index) INTEROP_THROW_SPEC((model
Definition: data_point_collection.h:59
point_vector_t::const_reference const_reference
Definition: data_point_collection.h:26
const_iterator begin() const
Definition: data_point_collection.h:110
#define INTEROP_BOUNDS_CHECK(VALUE, RANGE, MESSAGE)
Definition: exception.h:24
const Point & at(const size_t index) const INTEROP_THROW_SPEC((model
Definition: data_point_collection.h:71
void resize(const size_t n)
Definition: data_point_collection.h:101
const_iterator end() const
Definition: data_point_collection.h:119
const Point & operator[](const size_t index) const INTEROP_THROW_SPEC((model
Definition: data_point_collection.h:48
point_vector_t::size_type size_type
Definition: data_point_collection.h:30
Definition: data_point_collection.h:21