00001 #pragma once
00002
00003 #include <cstddef>
00004 #include <functional>
00005 #include <memory>
00006
00007 namespace FDR
00008 {
00009 namespace LTS
00010 {
00014 class Node
00015 {
00016 public:
00017 Node(){};
00018 virtual ~Node(){};
00019
00024 virtual bool operator==(const Node& node) const = 0;
00025
00030 virtual bool operator!=(const Node& node) const = 0;
00031
00033 virtual size_t hash_code() const = 0;
00034 };
00035
00036 }
00037 }
00038
00039 namespace std
00040 {
00041 template <>
00042 struct hash<FDR::LTS::Node>
00043 {
00044 size_t operator()(const FDR::LTS::Node& node) const
00045 {
00046 return node.hash_code();
00047 }
00048 };
00049
00050 template <>
00051 struct hash<std::shared_ptr<FDR::LTS::Node>>
00052 {
00053 size_t operator()(const std::shared_ptr<FDR::LTS::Node>& node) const
00054 {
00055 return node ? node->hash_code() : 0;
00056 }
00057 };
00058
00059 inline bool operator==(const std::shared_ptr<FDR::LTS::Node>& first, const std::shared_ptr<FDR::LTS::Node>& second)
00060 {
00061 return first.get() == second.get() || *first == *second;
00062 }
00063
00064 inline bool operator!=(const std::shared_ptr<FDR::LTS::Node>& first, const std::shared_ptr<FDR::LTS::Node>& second)
00065 {
00066 return first.get() != second.get() && *first != *second;
00067 }
00068
00069 }