PGROUTING  3.2
line_vertex.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: line_vertex.h
3 
4 Generated with Template by:
5 Copyright (c) 2015 pgRouting developers
7 
8 Function's developer:
9 Copyright (c) 2017 Vidhan Jain
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 
32 #ifndef INCLUDE_CPP_COMMON_LINE_VERTEX_H_
33 #define INCLUDE_CPP_COMMON_LINE_VERTEX_H_
34 #pragma once
35 
36 #include <vector>
37 #include <ostream>
38 
39 #include "c_types/pgr_edge_t.h"
40 
41 
42 
43 namespace pgrouting {
44 
45 class Line_vertex {
46  public:
48  id(0) {}
49 
50  explicit Line_vertex(const pgr_edge_t& edge) :
51  id(edge.id),
52  vertex_id(edge.id),
55  cost(edge.cost) {}
56 
58  id(v.id),
60  source(v.source),
61  target(v.target),
62  cost(v.cost) {}
63 
64  void cp_members(const Line_vertex &other) {
65  this->id = other.id;
66  this->vertex_id = other.vertex_id;
67  this->cost = other.cost;
68  this->source = other.source;
69  this->target = other.target;
70  }
71 
72  void cp_members(int64_t _id, int64_t _source) {
73  this->id = _id;
74  this->vertex_id = -1;
75  this->cost = 0;
76  this->source = _source;
77  this->target = -1;
78  }
79 
80  friend std::ostream& operator<<(std::ostream& log, const Line_vertex &v) {
81  log << "\nid = " << v.id;
82  log << " | vertex_id = " << v.vertex_id;
83  log << " | source = " << v.source;
84  log << " | target = " << v.target;
85  log << " | cost = " << v.cost;
86  return log;
87  }
88 
89  public:
90  int64_t id;
91  int64_t vertex_id;
92  int64_t source;
93  int64_t target;
94  double cost;
95 };
96 
97 } // namespace pgrouting
98 
99 #endif // INCLUDE_CPP_COMMON_LINE_VERTEX_H_
pgrouting::Line_vertex::Line_vertex
Line_vertex(const pgr_edge_t &edge)
Definition: line_vertex.h:50
pgrouting::Line_vertex::operator<<
friend std::ostream & operator<<(std::ostream &log, const Line_vertex &v)
Definition: line_vertex.h:80
pgrouting::Line_vertex::Line_vertex
Line_vertex()
Definition: line_vertex.h:47
pgr_edge_t
Definition: pgr_edge_t.h:37
pgrouting::Line_vertex::Line_vertex
Line_vertex(const Line_vertex &v)
Definition: line_vertex.h:57
pgrouting::Line_vertex::id
int64_t id
Definition: line_vertex.h:90
pgrouting::Line_vertex::cp_members
void cp_members(int64_t _id, int64_t _source)
Definition: line_vertex.h:72
edge
Definition: trsp.h:41
pgrouting::Line_vertex::target
int64_t target
Definition: line_vertex.h:93
pgrouting::Line_vertex::cp_members
void cp_members(const Line_vertex &other)
Definition: line_vertex.h:64
pgrouting::Line_vertex::vertex_id
int64_t vertex_id
Definition: line_vertex.h:91
pgrouting::Line_vertex::cost
double cost
Definition: line_vertex.h:94
pgrouting::Line_vertex
Definition: line_vertex.h:45
pgrouting::Line_vertex::source
int64_t source
Definition: line_vertex.h:92
pgr_edge_t.h
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56