YARP  2.3.70
Yet Another Robot Platform
ConnectionReader.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006 RobotCub Consortium
3  * Authors: Paul Fitzpatrick
4  * CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
5  */
6 
7 #ifndef YARP_OS_CONNECTIONREADER_H
8 #define YARP_OS_CONNECTIONREADER_H
9 
10 #include <yarp/os/ConstString.h>
11 #include <yarp/os/Contact.h>
12 #include <yarp/os/Bytes.h>
13 #include <yarp/os/Searchable.h>
14 #include <yarp/conf/numeric.h>
15 
16 namespace yarp {
17  namespace os {
18  class ConnectionReader;
19  class ConnectionWriter;
20  class PortReader;
21  class Portable;
22  class InputStream;
23  }
24 }
25 
31 class YARP_OS_API yarp::os::ConnectionReader {
32 public:
36  virtual ~ConnectionReader();
37 
45  virtual bool expectBlock(const char *data, size_t len) = 0;
46 
52  virtual ConstString expectText(int terminatingChar = '\n') = 0;
53 
58  virtual int expectInt() = 0;
59 
64  virtual YARP_INT64 expectInt64() = 0;
65 
70  virtual double expectDouble() = 0;
71 
78  virtual bool isTextMode() = 0;
79 
85  virtual bool isBareMode() = 0;
86 
95  virtual bool convertTextMode() = 0;
96 
101  virtual size_t getSize() = 0;
102 
103 
109  virtual ConnectionWriter *getWriter() = 0;
110 
116  virtual Bytes readEnvelope();
117 
125  virtual Portable *getReference() = 0;
126 
134  virtual Contact getRemoteContact() = 0;
135 
143  virtual Contact getLocalContact() = 0;
144 
149  virtual bool isValid() = 0;
150 
155  virtual bool isActive() = 0;
156 
163  virtual bool isError() = 0;
164 
168  virtual void requestDrop() = 0;
169 
176  virtual Searchable& getConnectionModifiers() = 0;
177 
183  virtual bool pushInt(int x) = 0;
184 
185  virtual bool setSize(size_t len) = 0;
186 
193  static ConnectionReader *createConnectionReader(InputStream& is);
194 
195  static bool readFromStream(PortReader& portable, InputStream& is);
196 
202  virtual void setParentConnectionReader(ConnectionReader *parentConnectionReader);
203 };
204 
205 #endif // YARP_OS_CONNECTIONREADER_H
A base class for nested structures that can be searched.
Definition: Searchable.h:56
This is a base class for objects that can be both read from and be written to the YARP network...
Definition: Portable.h:26
Simple specification of the minimum functions needed from input streams.
Definition: InputStream.h:24
A simple abstraction for a block of bytes.
Definition: Bytes.h:26
The main, catch-all namespace for YARP.
A string with almost the same api as std::string.
Definition: ConstString.h:44
An interface for writing to a network connection.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:25
An interface for reading from a network connection.
Represents how to reach a part of a YARP network.
Definition: Contact.h:33