YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
MpiBcastCarrier.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_MPIBCASTCARRIER_H
8#define YARP_MPIBCASTCARRIER_H
9
10#include "MpiCarrier.h"
11#include "MpiBcastStream.h"
12
13#include <yarp/os/Election.h>
14
15
28 public MpiCarrier
29{
30private:
33
34 bool electionMember;
35
36public:
37 MpiBcastCarrier() : MpiCarrier(), electionMember(false) {
38 target = "MPIBCAST";
39 }
40
41 virtual ~MpiBcastCarrier();
42
43 void close() override;
44
45 Carrier *create() const override {
46 return new MpiBcastCarrier();
47 }
48
49 void createStream(bool sender) override;
50
51 std::string getName() const override {
52 return "bcast";
53 }
54
55 bool supportReply() const override {
56 return false;
57 }
58
59 bool isBroadcast() const override {
60 return true;
61 }
62
63 void prepareDisconnect() override;
64
66 bool ok = MpiCarrier::expectReplyToHeader(proto);
67 MpiBcastStream *mpiStream = dynamic_cast<MpiBcastStream*> (stream);
68 if (mpiStream) {
69 mpiStream->post();
70 }
71 return ok;
72 }
73
74 bool isActive() const override;
75
76 virtual bool isElect() const;
77};
78
79#endif // YARP_MPIBCASTCARRIER_H
Carrier for port communicating via MPI broadcast.
Carrier * create() const override
Factory method.
virtual ~MpiBcastCarrier()
void close() override
Close the carrier.
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
bool supportReply() const override
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
void createStream(bool sender) override
bool isBroadcast() const override
Check if this carrier uses a broadcast mechanism.
bool expectReplyToHeader(yarp::os::ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
virtual bool isElect() const
void prepareDisconnect() override
Do cleanup and preparation for the coming disconnect, if necessary.
bool isActive() const override
Check if carrier is alive and error free.
Implements communication via MPI broadcast.
Abstract base carrier for managing port communication via MPI.
Definition MpiCarrier.h:26
std::string target
Definition MpiCarrier.h:32
MpiStream * stream
Definition MpiCarrier.h:28
bool expectReplyToHeader(yarp::os::ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
A mini-server for performing network communication in the background.
The basic state of a connection - route, streams in use, etc.