PGROUTING
3.2
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:
[email protected]
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
along 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 "
cpp_common/rule.h
"
27
28
#include <vector>
29
#include <algorithm>
30
31
32
33
namespace
pgrouting
{
34
namespace
trsp {
35
36
Rule::Rule
(
Restriction_t
r) :
37
m_cost(r.cost),
38
m_precedencelist(r.via, r.via + r.via_size),
39
m_all(r.via, r.via + r.via_size) {
40
m_dest_id
=
m_precedencelist
.back();
41
m_precedencelist
.pop_back();
42
std::reverse(
m_precedencelist
.begin(),
m_precedencelist
.end());
43
}
44
45
const
std::vector<int64_t>
46
Rule::precedencelist
()
const
{
47
return
m_precedencelist
;
48
}
49
50
51
std::ostream&
operator<<
(std::ostream& log,
const
Rule
&r) {
52
log <<
"("
;
53
for
(
const
auto
e : r.
m_all
) {
54
log << e <<
","
;
55
}
56
log <<
")"
;
57
return
log;
58
}
59
60
61
}
// namespace trsp
62
}
// namespace pgrouting
63
pgrouting::trsp::Rule::precedencelist
const std::vector< int64_t > precedencelist() const
Definition:
rule.cpp:46
pgrouting::trsp::Rule::m_dest_id
int64_t m_dest_id
Definition:
rule.h:66
pgrouting::trsp::Rule::m_precedencelist
std::vector< int64_t > m_precedencelist
Definition:
rule.h:68
pgrouting::trsp::Rule::Rule
Rule(Restriction_t r)
Definition:
rule.cpp:36
pgrouting::trsp::Rule::m_all
std::vector< int64_t > m_all
Definition:
rule.h:69
pgrouting::trsp::Rule
Definition:
rule.h:39
rule.h
Restriction_t
Definition:
restriction_t.h:37
pgrouting::trsp::operator<<
std::ostream & operator<<(std::ostream &log, const Rule &r)
Definition:
rule.cpp:51
pgrouting
Book keeping class for swapping orders between vehicles.
Definition:
pgr_alphaShape.cpp:56
src
cpp_common
rule.cpp
Generated on Tue May 25 2021 15:09:48 for PGROUTING by
1.8.17