YAMI4 Core
channel_descriptor.h
1 // Copyright Maciej Sobczak 2008-2019.
2 // This file is part of YAMI4.
3 //
4 // YAMI4 is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // YAMI4 is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with YAMI4. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef YAMICORE_CHANNEL_DESCRIPTOR_H_INCLUDED
18 #define YAMICORE_CHANNEL_DESCRIPTOR_H_INCLUDED
19 
20 #include "dll.h"
21 
22 #include <cstddef>
23 
24 namespace yami
25 {
26 
27 namespace core
28 {
29 
39 {
40 public:
48  : index_(0), sequence_number_(0)
49  {
50  }
51 
52  // used internally to create the descriptor that is then
53  // returned to the user code
54  channel_descriptor(std::size_t index, std::size_t sequence_number)
55  : index_(index), sequence_number_(sequence_number)
56  {
57  }
58 
59  // used internally
60  void get_details(std::size_t & index, std::size_t & sequence_number) const
61  {
62  index = index_;
63  sequence_number = sequence_number_;
64  }
65 
73  bool operator==(const channel_descriptor & other) const
74  {
75  return index_ == other.index_ &&
76  sequence_number_ == other.sequence_number_;
77  }
78 
83  bool operator!=(const channel_descriptor & other) const
84  {
85  return (*this == other) == false;
86  }
87 
88 private:
89  std::size_t index_;
90  std::size_t sequence_number_;
91 };
92 
93 } // namespace core
94 
95 } // namespace yami
96 
97 #endif // YAMICORE_CHANNEL_DESCRIPTOR_H_INCLUDED
Descriptor handle for the physical channel.
Definition: channel_descriptor.h:38
channel_descriptor()
Constructor.
Definition: channel_descriptor.h:47
Namespace devoted for everything related to YAMI4.
Definition: agent.h:25
bool operator==(const channel_descriptor &other) const
Comparison operator.
Definition: channel_descriptor.h:73
bool operator!=(const channel_descriptor &other) const
Comparison operator.
Definition: channel_descriptor.h:83