FDR  4.2.7(6ecbe5a21b71ab020e8fcaeccfe5ebaad0599f4f)
event.h
1 #pragma once
2 
3 #include <functional>
4 #include <memory>
5 #include <vector>
6 
7 namespace FDR
8 {
9 class Session;
10 
11 namespace Evaluator
12 {
20 class Event
21 {
22 public:
23  Event(){};
24  virtual ~Event(){};
25 
26  Event(const Event& event) = delete;
27  Event& operator=(const Event& event) = delete;
28 
32  virtual bool operator==(const Event& event) const = 0;
33 
37  virtual bool operator!=(const Event& event) const = 0;
38 
40  virtual size_t hash_code() const = 0;
41 
43  virtual std::string to_string() const = 0;
44 };
45 
46 } // end Evaluator
47 } // end FDR
48 
49 namespace std
50 {
51 template <>
52 struct hash<FDR::Evaluator::Event>
53 {
54  size_t operator()(const FDR::Evaluator::Event& event) const
55  {
56  return event.hash_code();
57  }
58 };
59 
60 template <>
61 struct hash<std::shared_ptr<FDR::Evaluator::Event>>
62 {
63  size_t operator()(const std::shared_ptr<FDR::Evaluator::Event>& event) const
64  {
65  return event ? event->hash_code() : 0;
66  }
67 };
68 
69 inline bool operator==(const std::shared_ptr<FDR::Evaluator::Event>& first,
70  const std::shared_ptr<FDR::Evaluator::Event>& second)
71 {
72  return first.get() == second.get() || *first == *second;
73 }
74 
75 inline bool operator!=(const std::shared_ptr<FDR::Evaluator::Event>& first,
76  const std::shared_ptr<FDR::Evaluator::Event>& second)
77 {
78  return first.get() != second.get() && *first != *second;
79 }
80 
81 } // end std
FDR::Evaluator::Event::operator==
virtual bool operator==(const Event &event) const =0
Compares two events for equality.
FDR::Evaluator::Event::hash_code
virtual size_t hash_code() const =0
Returns the hash value of this event.
FDR::Evaluator::Event::operator!=
virtual bool operator!=(const Event &event) const =0
Compares two events for inequality.
FDR::Evaluator::Event
An uncompiled event.
Definition: event.h:21
FDR::Evaluator::Event::to_string
virtual std::string to_string() const =0
Pretty prints this event.