FDR  4.2.7(6ecbe5a21b71ab020e8fcaeccfe5ebaad0599f4f)
node.h
1 #pragma once
2 
3 #include <cstddef>
4 #include <functional>
5 #include <memory>
6 
7 namespace FDR
8 {
9 namespace LTS
10 {
14 class Node
15 {
16 public:
17  Node(){};
18  virtual ~Node(){};
19 
24  virtual bool operator==(const Node& node) const = 0;
25 
30  virtual bool operator!=(const Node& node) const = 0;
31 
33  virtual size_t hash_code() const = 0;
34 };
35 
36 } // end LTS
37 } // end FDR
38 
39 namespace std
40 {
41 template <>
42 struct hash<FDR::LTS::Node>
43 {
44  size_t operator()(const FDR::LTS::Node& node) const
45  {
46  return node.hash_code();
47  }
48 };
49 
50 template <>
51 struct hash<std::shared_ptr<FDR::LTS::Node>>
52 {
53  size_t operator()(const std::shared_ptr<FDR::LTS::Node>& node) const
54  {
55  return node ? node->hash_code() : 0;
56  }
57 };
58 
59 inline bool operator==(const std::shared_ptr<FDR::LTS::Node>& first, const std::shared_ptr<FDR::LTS::Node>& second)
60 {
61  return first.get() == second.get() || *first == *second;
62 }
63 
64 inline bool operator!=(const std::shared_ptr<FDR::LTS::Node>& first, const std::shared_ptr<FDR::LTS::Node>& second)
65 {
66  return first.get() != second.get() && *first != *second;
67 }
68 
69 } // end std
FDR::LTS::Node::operator==
virtual bool operator==(const Node &node) const =0
Compares two nodes for equality.
FDR::LTS::Node::operator!=
virtual bool operator!=(const Node &node) const =0
Compares two nodes for inequality.
FDR::LTS::Node
A node (also known as state) in a GLTS.
Definition: node.h:15
FDR::LTS::Node::hash_code
virtual size_t hash_code() const =0
Returns the hash value of this event.