FSM Library - C++ version
FsmLabel.h
1 /*
2  * Copyright. GaĆ«l Dottel, Christoph Hilken, and Jan Peleska 2016 - 2021
3  *
4  * Licensed under the EUPL V.1.1
5  */
6 #ifndef FSM_FSM_FSMLABEL_H_
7 #define FSM_FSM_FSMLABEL_H_
8 
9 #include <memory>
10 
11 #include "interface/FsmPresentationLayer.h"
12 
13 class FsmLabel
14 {
15 private:
19  const int input;
20 
24  const int output;
25 
29  std::shared_ptr<FsmPresentationLayer> presentationLayer;
30 public:
38  FsmLabel(const int input, const int output, const std::shared_ptr<FsmPresentationLayer> presentationLayer);
39 
44  int getInput() const;
45 
50  int getOutput() const;
51 
58  friend bool operator==(FsmLabel const & label1, FsmLabel const & label2);
59 
66  friend bool operator<(FsmLabel const & label1, FsmLabel const & label2);
67 
74  friend std::ostream & operator<<(std::ostream & out, const FsmLabel & label);
75 };
76 
77 namespace std
78 {
79  template <>
80  class hash<FsmLabel>
81  {
82  public:
83  size_t operator()(const FsmLabel & x) const noexcept
84  {
85  return ((51 + std::hash<int>()(x.getInput())) * 51 + std::hash<int>()(x.getOutput()));
86  }
87  };
88 }
89 #endif //FSM_FSM_FSMLABEL_H_
friend std::ostream & operator<<(std::ostream &out, const FsmLabel &label)
Definition: FsmLabel.cpp:42
friend bool operator<(FsmLabel const &label1, FsmLabel const &label2)
Definition: FsmLabel.cpp:29
Definition: FsmLabel.h:13
Definition: FsmLabel.h:77
FsmLabel(const int input, const int output, const std::shared_ptr< FsmPresentationLayer > presentationLayer)
Definition: FsmLabel.cpp:8
int getInput() const
Definition: FsmLabel.cpp:14
friend bool operator==(FsmLabel const &label1, FsmLabel const &label2)
Definition: FsmLabel.cpp:24
int getOutput() const
Definition: FsmLabel.cpp:19