PGROUTING  2.6
rule.cpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: rule.cpp
4 
5 Copyright (c) 2017 pgRouting developers
6 Mail: project@pgrouting.org
7 
8 ------
9 
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 aint64_t with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 
24  ********************************************************************PGR-GNU*/
25 
26 #include "trsp/rule.h"
27 
28 #include <algorithm>
29 
30 
31 
32 namespace pgrouting {
33 namespace trsp {
34 
36  m_cost(r.cost),
37  m_precedencelist(r.via, r.via + r.via_size) {
38  m_dest_id = m_precedencelist.back();
39  m_precedencelist.pop_back();
40  std::reverse(m_precedencelist.begin(), m_precedencelist.end());
41  }
42 
43  const std::vector<int64_t>
45  return m_precedencelist;
46  }
47 
48 
49  std::ostream& operator<<(std::ostream& log, const Rule &r) {
50  log << r.m_cost << ", (";
51  for (const auto e : r.m_precedencelist) {
52  log << e << ",";
53  }
54  log << ")";
55  return log;
56  }
57 
58 
59 } // namespace trsp
60 } // namespace pgrouting
61 
Rule(Restriction_t r)
Definition: rule.cpp:35
std::vector< int64_t > m_precedencelist
Definition: rule.h:59
const std::vector< int64_t > precedencelist() const
Definition: rule.cpp:44
int64_t m_dest_id
Definition: rule.h:57
Book keeping class for swapping orders between vehicles.
Definition: basic_edge.cpp:28
friend std::ostream & operator<<(std::ostream &log, const Rule &r)
Definition: rule.cpp:49