YARP
Yet Another Robot Platform
MpiP2PStream.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2010 Daniel Krieg <krieg@fias.uni-frankfurt.de>
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_MPIP2PSTREAM_H
11 #define YARP_MPIP2PSTREAM_H
12 
13 #include "MpiStream.h"
14 
18 class MpiP2PStream :
19  public MpiStream
20 {
21 public:
23 
24  using MpiStream::write;
25  using MpiStream::read;
26 
27  ssize_t read(yarp::os::Bytes& b) override;
28  void write(const yarp::os::Bytes& b) override;
29  void close() override {
30  yCDebug(MPI_CARRIER, "[MpiP2PStream @ %s] Closing stream", name.c_str());
31  terminate = true;
32  }
33 };
34 
35 
36 #endif // YARP_MPIP2PSTREAM_H
MpiP2PStream::close
void close() override
Terminate the stream.
Definition: MpiP2PStream.h:29
MpiStream::comm
MpiComm * comm
Definition: MpiStream.h:38
MpiStream::terminate
bool terminate
Definition: MpiStream.h:36
MpiStream::write
void write(const yarp::os::Bytes &b) override=0
Write a block of bytes to the stream.
yarp::conf::ssize_t
::ssize_t ssize_t
Definition: numeric.h:60
yarp::os::Bytes
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
MpiP2PStream::write
void write(const yarp::os::Bytes &b) override=0
MpiStream::name
std::string name
Definition: MpiStream.h:37
yarp::os::InputStream::read
virtual int read()
Read and return a single byte.
Definition: InputStream.cpp:23
yCDebug
#define yCDebug(component,...)
Definition: LogComponent.h:112
MpiStream.h
MpiP2PStream::MpiP2PStream
MpiP2PStream(std::string name, MpiComm *comm)
Definition: MpiP2PStream.h:22
MpiComm
Wrapper for MPI_Comm communicator.
Definition: MpiComm.h:53
MPI_CARRIER
const yarp::os::LogComponent & MPI_CARRIER()
Definition: MpiLogComponent.cpp:16
MpiP2PStream::read
ssize_t read(yarp::os::Bytes &b) override=0
Read and return a single byte.
MpiStream
Abstract base class for port communication via MPI.
Definition: MpiStream.h:32
MpiP2PStream
Implements communication via MPI point-to-point send/receive.
Definition: MpiP2PStream.h:20