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
35{
36 public:
37
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
115
118};
119
125#endif /* __LIBIPC_CHANNEL_H */
Unidirectional point-to-point messaging channel.
Definition Channel.h:35
const Size getMessageSize() const
Get message size.
Definition Channel.cpp:30
Mode
Channel modes.
Definition Channel.h:57
@ Consumer
Definition Channel.h:59
@ Producer
Definition Channel.h:58
virtual ~Channel()
Destructor.
Definition Channel.cpp:26
const Mode m_mode
Channel mode.
Definition Channel.h:114
const Size m_messageSize
Message size.
Definition Channel.h:117
virtual Result write(const void *buffer)
Write a message.
Definition Channel.cpp:40
virtual Result read(void *buffer)
Read a message.
Definition Channel.cpp:35
virtual Result flush()
Flush message buffers.
Definition Channel.cpp:45
Result
Result codes.
Definition Channel.h:42
@ Success
Definition Channel.h:43
@ InvalidArgument
Definition Channel.h:44
@ ChannelFull
Definition Channel.h:48
@ InvalidMode
Definition Channel.h:45
@ IOError
Definition Channel.h:47
@ InvalidSize
Definition Channel.h:46
@ NotSupported
Definition Channel.h:50
@ NotFound
Definition Channel.h:49
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128