Uniot Core
0.8.1
Loading...
Searching...
No Matches
DataChannels.h
Go to the documentation of this file.
1/*
2 * This is a part of the Uniot project.
3 * Copyright (C) 2016-2023 Uniot <contact@uniot.io>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <Bytes.h>
22#include <LimitedQueue.h>
23#include <Map.h>
24
25namespace uniot {
26
42template <class T_channel, class T_data>
44 public:
45 virtual ~DataChannels() = default;
46
55 bool open(T_channel channel, size_t limit);
56
64 bool close(T_channel channel);
65
76 bool send(T_channel channel, T_data data);
77
85 T_data receive(T_channel channel);
86
94 bool isEmpty(T_channel channel);
95
96 private:
99};
100
101
102} // namespace uniot
Definition DataChannels.h:43
virtual ~DataChannels()=default
T_data receive(T_channel channel)
Retrieves and removes the oldest data from the specified channel.
Definition DataChannels.cpp:50
bool isEmpty(T_channel channel)
Checks if a channel has no data available.
Definition DataChannels.cpp:58
bool send(T_channel channel, T_data data)
Sends data to the specified channel.
Definition DataChannels.cpp:40
bool close(T_channel channel)
Removes an existing channel and frees associated resources.
Definition DataChannels.cpp:35
bool open(T_channel channel, size_t limit)
Creates a new data channel with the specified capacity.
Definition DataChannels.cpp:25
Definition Map.h:41
Contains all classes and functions related to the Uniot Core.