YARP
Yet Another Robot Platform
MpiP2PStream.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2010 Daniel Krieg <krieg@fias.uni-frankfurt.de>
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef YARP_MPIP2PSTREAM_H
8 #define YARP_MPIP2PSTREAM_H
9 
10 #include "MpiStream.h"
11 
15 class MpiP2PStream :
16  public MpiStream
17 {
18 public:
20 
21  using MpiStream::write;
22  using MpiStream::read;
23 
24  ssize_t read(yarp::os::Bytes& b) override;
25  void write(const yarp::os::Bytes& b) override;
26  void close() override {
27  yCDebug(MPI_CARRIER, "[MpiP2PStream @ %s] Closing stream", name.c_str());
28  terminate = true;
29  }
30 };
31 
32 
33 #endif // YARP_MPIP2PSTREAM_H
const yarp::os::LogComponent & MPI_CARRIER()
Wrapper for MPI_Comm communicator.
Definition: MpiComm.h:50
Implements communication via MPI point-to-point send/receive.
Definition: MpiP2PStream.h:17
ssize_t read(yarp::os::Bytes &b) override=0
Read and return a single byte.
void write(const yarp::os::Bytes &b) override=0
void close() override
Terminate the stream.
Definition: MpiP2PStream.h:26
MpiP2PStream(std::string name, MpiComm *comm)
Definition: MpiP2PStream.h:19
Abstract base class for port communication via MPI.
Definition: MpiStream.h:29
MpiComm * comm
Definition: MpiStream.h:35
std::string name
Definition: MpiStream.h:34
bool terminate
Definition: MpiStream.h:33
void write(const yarp::os::Bytes &b) override=0
Write a block of bytes to the stream.
A simple abstraction for a block of bytes.
Definition: Bytes.h:25
virtual int read()
Read and return a single byte.
Definition: InputStream.cpp:20
#define yCDebug(component,...)
Definition: LogComponent.h:109
::ssize_t ssize_t
Definition: numeric.h:86