YARP
Yet Another Robot Platform
Face.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_FACE_H
8 #define YARP_OS_FACE_H
9 
10 #include <yarp/os/Contact.h>
11 #include <yarp/os/InputProtocol.h>
12 #include <yarp/os/OutputProtocol.h>
13 
14 namespace yarp {
15 namespace os {
16 
21 {
22 public:
26  Face() = default;
27 
31  virtual ~Face() = default;
32 
43  virtual bool open(const Contact& address) = 0;
44 
50  virtual void close() = 0;
51 
60  virtual InputProtocol* read() = 0;
61 
72  virtual OutputProtocol* write(const Contact& address) = 0;
73 
74 
83  virtual Contact getLocalAddress() const
84  {
85  return Contact();
86  }
87 };
88 
89 } // namespace os
90 } // namespace yarp
91 
92 #endif // YARP_OS_FACE_H
Represents how to reach a part of a YARP network.
Definition: Contact.h:36
The initial point-of-contact with a port.
Definition: Face.h:21
virtual ~Face()=default
Destructor.
virtual Contact getLocalAddress() const
Get address after open(), if more specific that the address provided to open() - otherwise an invalid...
Definition: Face.h:83
virtual InputProtocol * read()=0
Block and wait for someone to talk to us.
Face()=default
Constructor.
virtual void close()=0
Stop listening.
virtual bool open(const Contact &address)=0
Start listening to the given address.
virtual OutputProtocol * write(const Contact &address)=0
Try to reach out and talk to someone.
The input side of an active connection between two ports.
Definition: InputProtocol.h:35
The output side of an active connection between two ports.
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_API
Definition: api.h:18