pgRouting
pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ch_vertex.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: ch_vertex.h
3 
4 Generated with Template by:
5 Copyright (c) 2015 pgRouting developers
6 Mail: project@pgrouting.org
7 
8 Function's developer:
9 Copyright (c) 2016 Rohith Reddy
10 Mail:
11 
12 ------
13 
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
18 
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23 
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 
28  ********************************************************************PGR-GNU*/
29 #ifndef SRC_COMMON_SRC_CH_VERTEX_H_
30 #define SRC_COMMON_SRC_CH_VERTEX_H_
31 #include <iostream>
32 #include <sstream>
33 #include <vector>
34 
35 #include "./pgr_types.h"
36 #include "./identifiers.hpp"
37 
38 namespace pgrouting {
39 namespace contraction {
40 
41 
42 class Vertex {
43  public:
44  int64_t id;
45  Vertex() = default;
46  Vertex(const Vertex &) = default;
47  Vertex(const pgr_edge_t &other, bool is_source) :
48  id(is_source? other.source : other.target)
49  {}
50  void cp_members(const Vertex &other) {
51  this->id = other.id;
52  }
53  void add_contracted_vertex(Vertex& v, int64_t vid);
54  void add_vertex_id(int64_t vid) {m_contracted_vertices += vid;}
56  bool has_contracted_vertices() const;
58  friend std::ostream& operator <<(std::ostream& os, const Vertex& v);
59  private:
61 };
62 
63 size_t
64 check_vertices(std::vector < Vertex > vertices);
65 
66 std::vector < Vertex >
68  const pgr_edge_t *data_edges, int64_t count);
69 
70 std::vector < Vertex >
72  const std::vector < pgr_edge_t > &data_edges);
73 
74 } // namespace contraction
75 } // namespace pgrouting
76 #endif // SRC_COMMON_SRC_CH_VERTEX_H_
void add_contracted_vertex(Vertex &v, int64_t vid)
Definition: ch_vertex.cpp:48
Vertex(const pgr_edge_t &other, bool is_source)
Definition: ch_vertex.h:47
bool has_contracted_vertices() const
Definition: ch_vertex.cpp:42
void clear()
Definition: identifiers.hpp:54
const Identifiers< int64_t > & contracted_vertices() const
Definition: ch_vertex.cpp:37
void cp_members(const Vertex &other)
Definition: ch_vertex.h:50
friend std::ostream & operator<<(std::ostream &os, const Vertex &v)
Definition: ch_vertex.cpp:57
Identifiers< int64_t > m_contracted_vertices
Definition: ch_vertex.h:60
void add_vertex_id(int64_t vid)
Definition: ch_vertex.h:54
size_t check_vertices(std::vector< Vertex > vertices)
Definition: ch_vertex.cpp:68
std::vector< Vertex > extract_vertices(const std::vector< pgr_edge_t > &data_edges)
Definition: ch_vertex.cpp:84