PGROUTING  3.2
basic_vertex.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2  *
3 
4 Copyright (c) 2015 Celia Virginia Vergara Castillo
6 
7 ------
8 
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 
23  ********************************************************************PGR-GNU*/
24 
27 #ifndef INCLUDE_CPP_COMMON_BASIC_VERTEX_H_
28 #define INCLUDE_CPP_COMMON_BASIC_VERTEX_H_
29 #pragma once
30 
31 #include <vector>
32 #include <ostream>
33 
34 #include "c_types/pgr_edge_t.h"
35 
36 
37 
38 namespace pgrouting {
39 
40 class Basic_vertex {
41  public:
43  id(0) {}
45  id(v.id) {}
46 
47  explicit Basic_vertex(const int64_t _id) :
48  id(_id) {}
49 
50  Basic_vertex& operator=(const Basic_vertex&) = default;
51 
52  Basic_vertex(const pgr_edge_t &other, bool is_source) :
53  id(is_source? other.source : other.target) {}
54 
55  void cp_members(const Basic_vertex &other) {
56  this->id = other.id;
57  }
58 
59 
60  friend std::ostream& operator<<(std::ostream& log, const Basic_vertex &v);
61  public:
62  int64_t id;
63  size_t vertex_index;
64 };
65 
66 size_t check_vertices(std::vector < Basic_vertex > vertices);
67 
68 
69 std::vector < Basic_vertex > extract_vertices(
70  std::vector < Basic_vertex > vertices,
71  const pgr_edge_t *data_edges, size_t count);
72 
73 std::vector < Basic_vertex > extract_vertices(
74  std::vector < Basic_vertex > vertices,
75  const std::vector < pgr_edge_t > data_edges);
76 
77 std::vector < Basic_vertex > extract_vertices(
78  const pgr_edge_t *data_edges, size_t count);
79 
80 std::vector < Basic_vertex > extract_vertices(
81  const std::vector < pgr_edge_t > &data_edges);
82 
83 
84 } // namespace pgrouting
85 
86 #endif // INCLUDE_CPP_COMMON_BASIC_VERTEX_H_
pgr_edge_t
Definition: pgr_edge_t.h:37
pgrouting::Basic_vertex::Basic_vertex
Basic_vertex(const pgr_edge_t &other, bool is_source)
Definition: basic_vertex.h:52
pgrouting::Basic_vertex::cp_members
void cp_members(const Basic_vertex &other)
Definition: basic_vertex.h:55
pgrouting::check_vertices
size_t check_vertices(std::vector< Basic_vertex > vertices)
Definition: basic_vertex.cpp:42
pgrouting::Basic_vertex::Basic_vertex
Basic_vertex(const int64_t _id)
Definition: basic_vertex.h:47
pgrouting::Basic_vertex
Definition: basic_vertex.h:40
pgrouting::Basic_vertex::Basic_vertex
Basic_vertex()
Definition: basic_vertex.h:42
pgrouting::extract_vertices
std::vector< Basic_vertex > extract_vertices(std::vector< Basic_vertex > vertices, const std::vector< pgr_edge_t > data_edges)
Definition: basic_vertex.cpp:59
pgrouting::Basic_vertex::operator<<
friend std::ostream & operator<<(std::ostream &log, const Basic_vertex &v)
Definition: basic_vertex.cpp:37
pgrouting::Basic_vertex::id
int64_t id
Definition: basic_vertex.h:62
pgr_edge_t.h
pgrouting::Basic_vertex::Basic_vertex
Basic_vertex(const Basic_vertex &v)
Definition: basic_vertex.h:44
pgrouting::Basic_vertex::vertex_index
size_t vertex_index
Definition: basic_vertex.h:63
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56
pgrouting::Basic_vertex::operator=
Basic_vertex & operator=(const Basic_vertex &)=default