PROBI  1.0
 All Classes Functions
Point.hpp
1 #ifndef POINT_H
2 #define POINT_H
3 
4 #include <vector>
5 #include <iostream>
6 
10 class Point
11 {
12 public:
13  // constructors
14  Point() = default;
15  Point(Point const & point) = default;
16  Point(int dimension);
17  Point(Point const * point);
18  Point(std::vector<double> const & coordinates);
19 
20  // operators
21  double & operator[] (int index);
22  double const & operator[] (int index) const;
23  Point & operator+=(const Point & point);
24  Point & operator-=(const Point & point);
25  Point const operator+(Point const & x) const;
26  Point const operator-(Point const & x) const;
27  bool operator==(Point const & x) const;
28  bool operator!=(Point const & x) const;
29 
30  // iterators
31  std::vector<double>::const_iterator cbegin() const;
32  std::vector<double>::const_iterator cend() const;
33 
34  // accessors / mutators
35  int getDimension() const;
36 
37 private:
38  std::vector<double> coordinates;
39  int dimension;
40 };
41 
45 Point operator*(double s, Point const & x);
46 
50 double operator*(Point const & x, Point const & y);
51 
55 std::ostream& operator<<(std::ostream& stream, Point const& point);
56 
57 #endif