PGROUTING  2.6
base_node.cpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: base_node.cpp
4 
5 Copyright (c) 2015 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 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 "vrp/base_node.h"
27 #include "cpp_common/pgr_assert.h"
28 
29 namespace pgrouting {
30 namespace vrp {
31 
32 std::ostream& operator << (std::ostream &log, const Base_node &node) {
33  node.print(log);
34  return log;
35 }
36 
37 void
38 Base_node::print(std::ostream& os) const {
39  os << id()
40  << "(" << idx() << ")";
41 }
42 
43 Base_node::Base_node(size_t _idx, int64_t _id)
44  : Identifier(_idx, _id) {
45  }
46 
47 bool
48 Base_node::operator ==(const Base_node &rhs) const {
49  if (&rhs == this) return true;
50  return
51  (idx() == rhs.idx())
52  && (id() == rhs.id());
53 }
54 
55 } // namespace vrp
56 } // namespace pgrouting
57 
58 
int64_t id() const
Definition: identifier.cpp:42
virtual void print(std::ostream &os) const
Definition: base_node.cpp:38
The Base_node class defines the operations that can be performed in a 2D node.
Definition: base_node.h:47
std::ostream & operator<<(std::ostream &log, const Base_node &node)
Definition: base_node.cpp:32
Book keeping class for swapping orders between vehicles.
Definition: basic_edge.cpp:28
Assertions Handling.
virtual bool operator==(const Base_node &rhs) const
Definition: base_node.cpp:48
size_t idx() const
Definition: identifier.cpp:37