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 
78  r_Range at(r_Dimension) const;
81 
83  r_Point &operator=(const r_Point &) = default;
84 
88  int compare_with(const r_Point &p) const;
94  bool operator==(const r_Point &) const;
96 
102  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 
122  r_Dimension dimension() const;
123 
125  std::vector<r_Range> get_coordinates() const;
126 
128  void print_status(std::ostream &s) const;
129 
131  char *get_string_representation() const;
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
r_Point::operator<<
r_Point & operator<<(r_Range)
stream-input operator for stream initializing
mddtypes.hh
r_Dimension
std::uint32_t r_Dimension
number of dimensions in r_Point and r_Minterval.
Definition: mddtypes.hh:56
r_Point::operator*
r_Point operator*(const r_Point &) const
vector multiplication
r_Point::compare_with
int compare_with(const r_Point &p) const
compares this point with the given point.
r_Point::DimType
r_Dimension DimType
Definition: point.hh:47
r_Point::operator>
bool operator>(const r_Point &) const
r_Point::operator-
r_Point operator-(const r_Point &) const
vector subtraction
r_Point::operator>=
bool operator>=(const r_Point &) const
r_Point::get_coordinates
std::vector< r_Range > get_coordinates() const
get vectorized version of the stored point
r_Point::~r_Point
~r_Point()=default
destructor: cleanup dynamic memory
r_Point
Class r_Point represents an n-dimensional point vector.
Definition: point.hh:42
r_Range
std::int64_t r_Range
for axis indexing, e.g.
Definition: mddtypes.hh:53
operator<<
std::ostream & operator<<(std::ostream &s, const r_Point &d)
r_Point::operator=
r_Point & operator=(const r_Point &)=default
assignment: cleanup + copy
r_Point::operator!=
bool operator!=(const r_Point &) const
Two points are equal if they have the same number of dimensions and the same values.
r_Point::operator[]
r_Range operator[](r_Dimension) const
subscriptor for read access
r_Point::dimension
r_Dimension dimension() const
get dimensionality
r_Point::value_type
r_Range value_type
Definition: point.hh:46
r_Point::operator<=
bool operator<=(const r_Point &) const
r_Point::r_Point
r_Point()=default
default constructor
r_Point::to_string
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::operator==
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::print_status
void print_status(std::ostream &s) const
writes the state of the object to the specified stream
r_Point::operator<
bool operator<(const r_Point &) const
r_Point::at
r_Range at(r_Dimension) const
subscriptor for read access with bound-checking
r_Point::operator+
r_Point operator+(const r_Point &) const
vector addition
r_Point::get_string_representation
char * get_string_representation() const
gives back the string representation