FreeNOS
Channel.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Niek Linnenbank
3  *
4  * This program 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  * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __LIBIPC_CHANNEL_H
19 #define __LIBIPC_CHANNEL_H
20 
21 #include <Types.h>
22 
34 class Channel
35 {
36  public:
37 
41  enum Result
42  {
51  };
52 
56  enum Mode
57  {
60  };
61 
62  public:
63 
70  Channel(const Mode mode, const Size messageSize);
71 
75  virtual ~Channel();
76 
82  const Size getMessageSize() const;
83 
91  virtual Result read(void *buffer);
92 
100  virtual Result write(const void *buffer);
101 
109  virtual Result flush();
110 
111  protected:
112 
114  const Mode m_mode;
115 
118 };
119 
125 #endif /* __LIBIPC_CHANNEL_H */
Channel
Unidirectional point-to-point messaging channel.
Definition: Channel.h:34
Channel::Success
@ Success
Definition: Channel.h:43
Types.h
Channel::Mode
Mode
Channel modes.
Definition: Channel.h:56
Channel::Channel
Channel(const Mode mode, const Size messageSize)
Constructor.
Definition: Channel.cpp:20
Channel::InvalidArgument
@ InvalidArgument
Definition: Channel.h:44
Channel::m_messageSize
const Size m_messageSize
Message size.
Definition: Channel.h:117
Channel::m_mode
const Mode m_mode
Channel mode.
Definition: Channel.h:114
Channel::IOError
@ IOError
Definition: Channel.h:47
Channel::read
virtual Result read(void *buffer)
Read a message.
Definition: Channel.cpp:35
Channel::getMessageSize
const Size getMessageSize() const
Get message size.
Definition: Channel.cpp:30
Channel::NotSupported
@ NotSupported
Definition: Channel.h:50
Channel::InvalidSize
@ InvalidSize
Definition: Channel.h:46
Channel::write
virtual Result write(const void *buffer)
Write a message.
Definition: Channel.cpp:40
Channel::NotFound
@ NotFound
Definition: Channel.h:49
Channel::InvalidMode
@ InvalidMode
Definition: Channel.h:45
Channel::Consumer
@ Consumer
Definition: Channel.h:59
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
Channel::~Channel
virtual ~Channel()
Destructor.
Definition: Channel.cpp:26
Channel::Producer
@ Producer
Definition: Channel.h:58
Channel::Result
Result
Result codes.
Definition: Channel.h:41
Channel::flush
virtual Result flush()
Flush message buffers.
Definition: Channel.cpp:45
Channel::ChannelFull
@ ChannelFull
Definition: Channel.h:48