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
Communicating between two ports via shared memory.
Definition: ShmemCarrier.h:20
bool respondToHeader(yarp::os::ConnectionState &proto) override
Respond to the header.
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
bool expectReplyToHeader(yarp::os::ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
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...
bool isConnectionless() const override
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).
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...
Carrier * create() const override
Factory method.
virtual ~ShmemCarrier()
void setParameters(const yarp::os::Bytes &header) override
Configure this carrier based on the first 8 bytes of the connection.
virtual int getSpecifierCode() const
A starter class for implementing simple carriers.
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
The basic state of a connection - route, streams in use, etc.