bar_point.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <vector>
12 
13 namespace illumina { namespace interop { namespace model { namespace plot
14 {
15 
18  class bar_point : public data_point<float, float>
19  {
20  public:
27  bar_point(const float x = 0,
28  const float height = 0,
29  const float width = 0) :
30  data_point<float, float>(x, height), m_width(width)
31  { }
32 
33  public:
40  void set(const x_type x, const y_type height, const float width = 1)
41  {
43  m_width = width;
44  }
45 
46  public:
59  float width() const
60  {
61  return m_width;
62  }
63 
68  float min_value() const
69  {
70  return 0;
71  }
74  public:
75  friend std::ostream& operator<<(std::ostream& out, const bar_point& data)
76  {
77  std::ios::fmtflags previous_state( out.flags() );
78  const size_t precision = 10;
79  out << static_cast< const data_point<float, float>& > (data);
80  out << std::setprecision(precision) << io::table::handle_nan(data.m_width) << ",";
81  out.flags(previous_state);
82  return out;
83  }
84  friend std::istream& operator>>(std::istream& in, bar_point& data)
85  {
86  in >> static_cast< data_point<float, float>& > (data);
87  std::string tmp;
88  std::getline(in, tmp, ',');
89  data.m_width = util::lexical_cast<y_type>(tmp);
90  return in;
91  }
92 
93  private:
94  float m_width;
95  };
96 
97 
98 }}}}
99 
Definition: enum_description.h:15
friend std::ostream & operator<<(std::ostream &out, const bar_point &data)
Definition: bar_point.h:75
bar_point(const float x=0, const float height=0, const float width=0)
Definition: bar_point.h:27
float width() const
Definition: bar_point.h:59
void set(const x_type x, const y_type y)
Definition: data_point.h:96
void set(const x_type x, const y_type height, const float width=1)
Definition: bar_point.h:40
const T & handle_nan(const T &val)
Definition: csv_format.h:84
float x() const
Definition: data_point.h:50
float min_value() const
Definition: bar_point.h:68
friend std::istream & operator>>(std::istream &in, bar_point &data)
Definition: bar_point.h:84
Destination lexical_cast(const Source &src)
Definition: lexical_cast.h:264