Loading...
Searching...
No Matches
communications_buffers.cpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
25#include "communications_buffers.hpp"
26
27namespace bitpit {
28
39SendBuffer::SendBuffer(size_t size, bool doubleBuffer)
40 : CommunicationBuffer(size, doubleBuffer)
41{
42}
43
49{
50 for (RawSendBuffer & buffer : getBuffers()) {
51 buffer.squeeze();
52 }
53}
54
62void SendBuffer::write(const char *data, std::size_t size)
63{
64 getFront().write(data, size);
65}
66
77RecvBuffer::RecvBuffer(size_t size, bool doubleBuffer)
78 : CommunicationBuffer(size, doubleBuffer)
79{
80}
81
89void RecvBuffer::read(char *data, std::size_t size)
90{
91 getFront().read(data, size);
92}
93
94}
Buffer to be used for data communications.
void read(char *data, std::size_t size)
Output binary stream.
void write(const char *data, std::size_t size)
RecvBuffer(size_t size=0, bool doubleBuffer=false)
void read(char *data, std::size_t size)
void write(const char *data, std::size_t size)
SendBuffer(size_t size=0, bool doubleBuffer=false)
--- layout: doxygen_footer ---