PGROUTING  2.4
 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 
40 class CH_vertex {
41  public:
42  int64_t id;
43  CH_vertex() = default;
44  CH_vertex(const CH_vertex &) = default;
45  CH_vertex(const pgr_edge_t &other, bool is_source) :
46  id(is_source? other.source : other.target)
47  {}
48  void cp_members(const CH_vertex &other) {
49  this->id = other.id;
50  }
51  void add_contracted_vertex(CH_vertex& v, int64_t vid);
52  void add_vertex_id(int64_t vid) {m_contracted_vertices += vid;}
54  bool has_contracted_vertices() const;
56  friend std::ostream& operator <<(std::ostream& os, const CH_vertex& v);
57  private:
59 };
60 
61 size_t
62 check_vertices(std::vector < CH_vertex > vertices);
63 
64 #if 0
65 std::vector < CH_vertex >
67  const pgr_edge_t *data_edges, int64_t count);
68 
69 std::vector < CH_vertex >
71  const std::vector < pgr_edge_t > &data_edges);
72 #endif
73 } // namespace pgrouting
74 
75 #endif // SRC_COMMON_SRC_CH_VERTEX_H_
Identifiers< int64_t > m_contracted_vertices
Definition: ch_vertex.h:58
void cp_members(const CH_vertex &other)
Definition: ch_vertex.h:48
CH_vertex(const pgr_edge_t &other, bool is_source)
Definition: ch_vertex.h:45
friend std::ostream & operator<<(std::ostream &os, const CH_vertex &v)
Definition: ch_vertex.cpp:56
void clear()
Definition: identifiers.hpp:59
void clear_contracted_vertices()
Definition: ch_vertex.h:55
bool has_contracted_vertices() const
Definition: ch_vertex.cpp:44
std::vector< Basic_vertex > extract_vertices(std::vector< Basic_vertex > vertices, const std::vector< pgr_edge_t > data_edges)
void add_vertex_id(int64_t vid)
Definition: ch_vertex.h:52
void add_contracted_vertex(CH_vertex &v, int64_t vid)
Definition: ch_vertex.cpp:50
size_t check_vertices(std::vector< Basic_vertex > vertices)
const Identifiers< int64_t > & contracted_vertices() const
Definition: ch_vertex.cpp:39