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_edge.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: ch_edge.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 
30 #ifndef SRC_COMMON_SRC_CH_EDGE_H_
31 #define SRC_COMMON_SRC_CH_EDGE_H_
32 #pragma once
33 
34 #include <iostream>
35 #include <sstream>
36 #include "./ch_vertex.h"
37 #include "./basic_edge.h"
38 namespace pgrouting {
39 namespace contraction {
40 
41 class Edge {
42  public:
43  Edge() = default;
44  Edge(int64_t eid, int64_t source, int64_t target, double cost) :
45  id(eid), source(source),
46  target(target), cost(cost), first(true) {}
47  Edge(int64_t eid, int64_t source, int64_t target,
48  double cost, bool first) :
49  id(eid), source(source),
50  target(target), cost(cost), first(first) {}
51 
52  void cp_members(const Edge &other, std::ostringstream& log);
53  void cp_members(const Edge &other);
54  void cp_members(const Basic_edge &other);
55  void add_contracted_vertex(Vertex& v, int64_t vid);
57  bool has_contracted_vertices() const;
60  friend std::ostream& operator <<(std::ostream& os, const Edge& e);
61 
62  public:
63  int64_t id;
64  int64_t source;
65  int64_t target;
66  double cost;
67  bool first;
68  private:
70 };
71 
72 } // namespace contraction
73 } // namespace pgrouting
74 
75 #endif // SRC_COMMON_SRC_CH_EDGE_H_
void add_contracted_edge_vertices(Edge &e)
Definition: ch_edge.cpp:104
Edge(int64_t eid, int64_t source, int64_t target, double cost)
Definition: ch_edge.h:44
void clear()
Definition: identifiers.hpp:54
void add_contracted_vertex(Vertex &v, int64_t vid)
Definition: ch_edge.cpp:95
void cp_members(const Edge &other, std::ostringstream &log)
Definition: ch_edge.cpp:34
Identifiers< int64_t > m_contracted_vertices
Definition: ch_edge.h:69
const Identifiers< int64_t > & contracted_vertices() const
Definition: ch_edge.cpp:90
bool has_contracted_vertices() const
Definition: ch_edge.cpp:84
Edge(int64_t eid, int64_t source, int64_t target, double cost, bool first)
Definition: ch_edge.h:47
friend std::ostream & operator<<(std::ostream &os, const Edge &e)
Definition: ch_edge.cpp:111