YARP
Yet Another Robot Platform
ShmemCarrier.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
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_SHMEM_SHMEMCARRIER_H
11 #define YARP_SHMEM_SHMEMCARRIER_H
12 
14 
15 
20 {
21 public:
23  virtual ~ShmemCarrier();
24 
25  Carrier* create() const override;
26 
27  std::string getName() const override;
28 
29  virtual int getSpecifierCode() const;
30  bool requireAck() const override;
31  bool isConnectionless() const override;
32  bool checkHeader(const yarp::os::Bytes& header) override;
33  void getHeader(yarp::os::Bytes& header) const override;
34  void setParameters(const yarp::os::Bytes& header) override;
35  bool respondToHeader(yarp::os::ConnectionState& proto) override;
36  bool expectReplyToHeader(yarp::os::ConnectionState& proto) override;
37 
38 private:
39  bool becomeShmemVersionHybridStream(yarp::os::ConnectionState& proto, bool sender);
40  bool becomeShmem(yarp::os::ConnectionState& proto, bool sender);
41 };
42 
43 #endif // YARP_SHMEM_SHMEMCARRIER_H
ShmemCarrier::requireAck
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
Definition: ShmemCarrier.cpp:42
ShmemCarrier::getSpecifierCode
virtual int getSpecifierCode() const
Definition: ShmemCarrier.cpp:35
AbstractCarrier.h
yarp::os::AbstractCarrier
A starter class for implementing simple carriers.
Definition: AbstractCarrier.h:25
ShmemCarrier::~ShmemCarrier
virtual ~ShmemCarrier()
ShmemCarrier::ShmemCarrier
ShmemCarrier()
ShmemCarrier::isConnectionless
bool isConnectionless() const override
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).
Definition: ShmemCarrier.cpp:47
ShmemCarrier
Communicating between two ports via shared memory.
Definition: ShmemCarrier.h:20
yarp::os::Bytes
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
yarp::os::ConnectionState
The basic state of a connection - route, streams in use, etc.
Definition: ConnectionState.h:31
ShmemCarrier::respondToHeader
bool respondToHeader(yarp::os::ConnectionState &proto) override
Respond to the header.
Definition: ShmemCarrier.cpp:111
ShmemCarrier::getHeader
void getHeader(yarp::os::Bytes &header) const override
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to se...
Definition: ShmemCarrier.cpp:57
ShmemCarrier::create
Carrier * create() const override
Factory method.
Definition: ShmemCarrier.cpp:25
ShmemCarrier::expectReplyToHeader
bool expectReplyToHeader(yarp::os::ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
Definition: ShmemCarrier.cpp:117
ShmemCarrier::getName
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
Definition: ShmemCarrier.cpp:30
ShmemCarrier::setParameters
void setParameters(const yarp::os::Bytes &header) override
Configure this carrier based on the first 8 bytes of the connection.
Definition: ShmemCarrier.cpp:62
ShmemCarrier::checkHeader
bool checkHeader(const yarp::os::Bytes &header) override
Given the first 8 bytes received on a connection, decide if this is the right carrier type to use for...
Definition: ShmemCarrier.cpp:52