PGROUTING  2.6-dev
restriction.cpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: restriction.cpp
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) 2017 Vidhan Jain
10 Mail: vidhanj1307@gmail.com
11 
12 ------
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 ********************************************************************PGR-GNU*/
25 
27 
28 #include <vector>
29 #include <memory>
30 #include <utility>
31 #include <limits>
32 
33 Restriction::Restriction(const Restrict_t &r) :
34  m_id(r.id),
35  m_cost(r.cost) {
36  for (auto &it : r.restricted_edges) {
37  if (it == -1) break;
38  restrict_edges(it);
39  }
40  }
41 
42 std::ostream&
43 operator << (std::ostream &log, const Restriction& r) {
44  log << "\n--------------------------------\nRestriction\n";
45  log << "ID: " << r.id() << "\nRestricion edge sequence: ";
46  for (const auto &v : r.restrict_edges()) {
47  log << v <<" ";
48  }
49  log << "\n";
50  log << "Cost: " << r.cost() << "\n";
51  return log;
52 }
double cost() const
Definition: restriction.h:51
Restriction()=default
int64_t id() const
Definition: restriction.h:48
std::vector< int64_t > restrict_edges() const
Definition: restriction.h:54
friend std::ostream & operator<<(std::ostream &log, const Restriction &r)
Definition: restriction.cpp:43