PGROUTING  3.2
rule.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: rule.h
4 
5 Copyright (c) 2017 pgRouting developers
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 #ifndef INCLUDE_CPP_COMMON_RULE_H_
27 #define INCLUDE_CPP_COMMON_RULE_H_
28 
29 
30 #include <vector>
31 #include <sstream>
32 #include "c_types/restriction_t.h"
33 
34 namespace pgrouting {
35 namespace trsp {
36 
37 
38 
39 class Rule {
40  using iterator = std::vector<int64_t>::iterator;
41  using constiterator = std::vector<int64_t>::const_iterator;
42 
43  public:
44  explicit Rule(Restriction_t r);
45 
46  inline double cost() const {
47  return m_cost;
48  }
49 
50  const std::vector<int64_t> precedencelist() const;
51 
52  constiterator begin() const { return m_all.begin(); }
53  constiterator end() const { return m_all.end(); }
54 
55  iterator begin() { return m_all.begin(); }
56  iterator end() { return m_all.end(); }
57 
58  inline int64_t dest_id() const {
59  return m_dest_id;
60  }
61 
62 
63  friend std::ostream& operator<<(std::ostream& log, const Rule &r);
64 
65  private:
66  int64_t m_dest_id;
67  double m_cost;
68  std::vector<int64_t> m_precedencelist;
69  std::vector<int64_t> m_all;
70 };
71 
72 
73 
74 
75 } // namespace trsp
76 } // namespace pgrouting
77 
78 #endif // INCLUDE_CPP_COMMON_RULE_H_
pgrouting::trsp::Rule::precedencelist
const std::vector< int64_t > precedencelist() const
Definition: rule.cpp:46
pgrouting::trsp::Rule::cost
double cost() const
Definition: rule.h: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::dest_id
int64_t dest_id() const
Definition: rule.h:58
pgrouting::trsp::Rule
Definition: rule.h:39
pgrouting::trsp::Rule::end
iterator end()
Definition: rule.h:56
pgrouting::trsp::Rule::constiterator
std::vector< int64_t >::const_iterator constiterator
Definition: rule.h:41
restriction_t.h
pgrouting::trsp::Rule::operator<<
friend std::ostream & operator<<(std::ostream &log, const Rule &r)
Definition: rule.cpp:51
pgrouting::trsp::Rule::iterator
std::vector< int64_t >::iterator iterator
Definition: rule.h:40
Restriction_t
Definition: restriction_t.h:37
pgrouting::trsp::Rule::begin
constiterator begin() const
Definition: rule.h:52
pgrouting::trsp::Rule::end
constiterator end() const
Definition: rule.h:53
pgrouting::trsp::Rule::begin
iterator begin()
Definition: rule.h:55
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56
pgrouting::trsp::Rule::m_cost
double m_cost
Definition: rule.h:67