rasdaman client API  10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
point.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 */
23 
24 #ifndef D_POINT_HH
25 #define D_POINT_HH
26 
27 #include "raslib/mddtypes.hh" // for r_Range, r_Dimension
28 #include <vector>
29 #include <iosfwd>
30 
31 //@ManMemo: Module: {\bf raslib}
42 class r_Point
43 {
44 public:
45  // the coordinates underlying type
48 
50  r_Point() = default;
52  explicit r_Point(r_Dimension);
54  explicit r_Point(char *);
55 
56  //@Man: 'easy-to-use' constructors
58  explicit r_Point(r_Range);
63  explicit r_Point(std::vector<r_Range> pointArg);
65 
67  ~r_Point() = default;
68 
71 
76 
81 
83  r_Point &operator=(const r_Point &) = default;
84 
88  int compare_with(const r_Point &p) const;
95  bool operator==(const r_Point &) const;
96 
103  bool operator!=(const r_Point &) const;
104  bool operator<(const r_Point &) const;
105  bool operator>(const r_Point &) const;
106  bool operator<=(const r_Point &) const;
107  bool operator>=(const r_Point &) const;
108 
110  r_Point operator+(const r_Point &) const;
111 
113  r_Point operator-(const r_Point &) const;
114 
116  r_Point operator*(const r_Point &) const;
117 
119  r_Point operator*(const r_Range newElement) const;
120 
123 
125  std::vector<r_Range> get_coordinates() const;
126 
128  void print_status(std::ostream &s) const;
129 
143  std::string to_string(bool wkt = false) const;
144 
145 private:
146  void checkDimensionMatch(const r_Point &pt) const;
147 
149  std::vector<r_Range> points;
150  size_t streamIndex{};
151 };
152 
153 extern std::ostream &operator<<(std::ostream &s, const r_Point &d);
154 
155 #endif
Class r_Point represents an n-dimensional point vector.
Definition: point.hh:43
r_Point operator-(const r_Point &) const
vector subtraction
void print_status(std::ostream &s) const
writes the state of the object to the specified stream
r_Point(r_Range, r_Range, r_Range, r_Range)
r_Point(r_Range, r_Range, r_Range, r_Range, r_Range)
r_Point(r_Range, r_Range)
r_Point(char *)
constructor taking string representation (e.g. [ 1, 2, 3])
bool operator==(const r_Point &) const
Returns 0 if this == p, -1 if this < p, 1 if this > p (considering the coordinates in decreasing orde...
r_Point operator*(const r_Range newElement) const
vector multiplication with a scalar
char * get_string_representation() const
gives back the string representation
r_Point operator+(const r_Point &) const
vector addition
r_Range operator[](r_Dimension) const
subscriptor for read access
r_Point & operator<<(r_Range)
stream-input operator for stream initializing
r_Range & at(r_Dimension)
subscriptor for write access with bound-checking
bool operator>(const r_Point &) const
r_Range value_type
Definition: point.hh:46
int compare_with(const r_Point &p) const
compares this point with the given point.
bool operator<(const r_Point &) const
r_Point(std::vector< r_Range > pointArg)
r_Point operator*(const r_Point &) const
vector multiplication
r_Point(r_Range)
r_Point()=default
default constructor
r_Range & operator[](r_Dimension)
subscriptor for write access
bool operator<=(const r_Point &) const
r_Dimension DimType
Definition: point.hh:47
r_Point & operator=(const r_Point &)=default
assignment: cleanup + copy
bool operator!=(const r_Point &) const
Two points are equal if they have the same number of dimensions and the same values.
r_Dimension dimension() const
get dimensionality
bool operator>=(const r_Point &) const
~r_Point()=default
destructor: cleanup dynamic memory
std::vector< r_Range > get_coordinates() const
get vectorized version of the stored point
r_Point(r_Range, r_Range, r_Range)
r_Range at(r_Dimension) const
subscriptor for read access with bound-checking
std::string to_string(bool wkt=false) const
The string representation delivered by this method is allocated using malloc() and has to be free us...
r_Point(r_Dimension)
constructor getting dimensionality for stream initializing
std::int64_t r_Range
for axis indexing, e.g.
Definition: mddtypes.hh:53
std::uint32_t r_Dimension
number of dimensions in r_Point and r_Minterval.
Definition: mddtypes.hh:56
std::ostream & operator<<(std::ostream &s, const r_Point &d)