Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Node.hpp
Go to the documentation of this file.
1
6// Copyright (c) 2017 Czech Technical University in Prague | Faculty of Information Technology. All rights reserved.
7
8#pragma once
9
10#include <ostream>
11#include <object/Object.h>
12
13#include "NodeBase.hpp"
14
15namespace node {
16
17class Node : public NodeBase {
18// ---------------------------------------------------------------------------------------------------------------------
19
20 private:
21 int m_id;
22
23// =====================================================================================================================
24// Constructor, Destructor, Operators
25
26 public:
27 explicit Node();
28 explicit Node(int id);
29
30// ---------------------------------------------------------------------------------------------------------------------
31
32 auto operator <=> ( const Node &rhs) const { return m_id <=> rhs.m_id; }
33 bool operator ==( const Node &rhs) const { return m_id == rhs.m_id; }
34
35// ---------------------------------------------------------------------------------------------------------------------
36// =====================================================================================================================
37// NodeBase interface
38
39 public:
40 void operator>>(ext::ostream &ostream) const override;
41
42// =====================================================================================================================
43 public:
44
45 std::string name() const;
46
47// ---------------------------------------------------------------------------------------------------------------------
48
49 int getId() const;
50
51// ---------------------------------------------------------------------------------------------------------------------
52
53};
54
55// =====================================================================================================================
56
57} // namespace node
58
59// =====================================================================================================================
60
61namespace std {
62
63template<>
64struct hash<node::Node> {
65 std::size_t operator()(const node::Node &k) const {
66 return hash<int>()(k.getId());
67 }
68};
69}
70
71// =====================================================================================================================
72
Definition: ostream.h:14
Definition: NodeBase.hpp:18
Definition: Node.hpp:17
void operator>>(ext::ostream &ostream) const override
Definition: Node.cpp:31
bool operator==(const Node &rhs) const
Definition: Node.hpp:33
Node()
Definition: Node.cpp:15
int getId() const
Definition: Node.cpp:38
auto operator<=>(const Node &rhs) const
Definition: Node.hpp:32
std::string name() const
Definition: Node.cpp:25
Definition: Node.cpp:11
Definition: FordFulkerson.hpp:16
std::size_t operator()(const node::Node &k) const
Definition: Node.hpp:65