FDR  4.2.7(6ecbe5a21b71ab020e8fcaeccfe5ebaad0599f4f)
process_name.h
1 #pragma once
2 
3 #include <functional>
4 #include <memory>
5 
6 namespace FDR
7 {
8 class Session;
9 
10 namespace Evaluator
11 {
16 {
17 public:
18  ProcessName(){};
19  virtual ~ProcessName(){};
20 
21  ProcessName(const ProcessName& process_name) = delete;
22  ProcessName& operator=(const ProcessName& event) = delete;
23 
27  virtual bool operator==(const ProcessName& event) const = 0;
28 
32  virtual bool operator!=(const ProcessName& event) const = 0;
33 
35  virtual size_t hash_code() const = 0;
36 
38  virtual std::string to_string() const = 0;
39 };
40 
41 } // end Evaluator
42 } // end FDR
43 
44 namespace std
45 {
46 template <>
47 struct hash<FDR::Evaluator::ProcessName>
48 {
49  size_t operator()(const FDR::Evaluator::ProcessName& name) const
50  {
51  return name.hash_code();
52  }
53 };
54 
55 template <>
56 struct hash<std::shared_ptr<FDR::Evaluator::ProcessName>>
57 {
58  size_t operator()(const std::shared_ptr<FDR::Evaluator::ProcessName>& name) const
59  {
60  return name ? name->hash_code() : 0;
61  }
62 };
63 
64 inline bool operator==(const std::shared_ptr<FDR::Evaluator::ProcessName>& first,
65  const std::shared_ptr<FDR::Evaluator::ProcessName>& second)
66 {
67  return first.get() == second.get() || *first == *second;
68 }
69 
70 inline bool operator!=(const std::shared_ptr<FDR::Evaluator::ProcessName>& first,
71  const std::shared_ptr<FDR::Evaluator::ProcessName>& second)
72 {
73  return first.get() != second.get() && *first != *second;
74 }
75 
76 } // end std
FDR::Evaluator::ProcessName::to_string
virtual std::string to_string() const =0
Pretty prints this process name.
FDR::Evaluator::ProcessName::operator!=
virtual bool operator!=(const ProcessName &event) const =0
Compares two process names for inequality.
FDR::Evaluator::ProcessName::hash_code
virtual size_t hash_code() const =0
Returns the hash value of this event.
FDR::Evaluator::ProcessName
The name of a process in the input file.
Definition: process_name.h:16
FDR::Evaluator::ProcessName::operator==
virtual bool operator==(const ProcessName &event) const =0
Compares two process names for equality.