YAMI4 Core
channel_holder.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_HOLDER_H_INCLUDED
18 #define YAMICORE_CHANNEL_HOLDER_H_INCLUDED
19 
20 #include <cstddef>
21 
22 namespace yami
23 {
24 
25 namespace details
26 {
27 
28 class channel;
29 class channel_holder
30 {
31 public:
32 
33  void init();
34  void set(channel * ch, std::size_t & new_sequence_number);
35  channel * get_channel() const { return ch_; }
36  std::size_t get_sequence_number() const { return sequence_number_; }
37 
38  void reserve() { reserved_ = true; }
39  bool is_reserved() const { return reserved_; }
40  void clean();
41 
42 private:
43 
44  std::size_t sequence_number_;
45  channel * ch_;
46  bool reserved_;
47 };
48 
49 } // namespace details
50 
51 } // namespace yami
52 
53 #endif // YAMICORE_CHANNEL_HOLDER_H_INCLUDED
Namespace devoted for everything related to YAMI4.
Definition: agent.h:25