YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
PortCoreInputUnit.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_OS_IMPL_PORTCOREINPUTUNIT_H
8#define YARP_OS_IMPL_PORTCOREINPUTUNIT_H
9
11#include <yarp/os/Semaphore.h>
14
15namespace yarp::os::impl {
16
22 public PortCoreUnit
23{
24public:
36 int index,
37 InputProtocol* ip,
38 bool reversed);
39
43 virtual ~PortCoreInputUnit();
44
50 bool start() override;
51
59 void run() override;
60
61 bool isInput() override;
62
63 void close() override;
64
65 bool isFinished() override;
66
67 const std::string& getName();
68
69 Route getRoute() override;
70
71 bool interrupt() override;
72
73 void setCarrierParams(const yarp::os::Property& params) override;
74
75 void getCarrierParams(yarp::os::Property& params) override;
76
77 // return the protocol object
79
80 bool isBusy() override;
81
82private:
83 InputProtocol* ip;
84 yarp::os::Semaphore phase, access;
85 bool closing, finished, running;
86 std::string name;
87 yarp::os::PortReader* localReader;
88 Route officialRoute;
89 bool reversed;
90
91 void closeMain();
92
93 bool skipIncomingData(yarp::os::ConnectionReader& reader);
94
95 static void envelopeReadCallback(void* data, const Bytes& envelope);
96};
97
98} // namespace yarp::os::impl
99
100#endif // YARP_OS_IMPL_PORTCOREINPUTUNIT_H
A simple abstraction for a block of bytes.
Definition Bytes.h:24
An interface for reading from a network connection.
The input side of an active connection between two ports.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition PortReader.h:24
A class for storing options and configuration information.
Definition Property.h:33
Information about a connection between two ports.
Definition Route.h:28
A class for thread synchronization and mutual exclusion.
Definition Semaphore.h:25
Manager for a single input to a port.
void run() override
The body of the thread associated with this input.
bool start() override
Start a thread running to serve this input.
void getCarrierParams(yarp::os::Property &params) override
void setCarrierParams(const yarp::os::Property &params) override
Set arbitrary parameters for this connection.
bool interrupt() override
Interrupt the connection.
This manages a single threaded resource related to a single input or output connection.
The components from which ports and connections are built.