An interface for reading from a network connection. More...
#include <yarp/os/ConnectionReader.h>
Public Member Functions | |
virtual | ~ConnectionReader () |
Destructor. More... | |
virtual bool | expectBlock (char *data, size_t len)=0 |
Read a block of data from the network connection. More... | |
virtual std::string | expectText (const char terminatingChar='\n')=0 |
Read some text from the network connection. More... | |
virtual std::string | expectString () |
Read a string from the network connection. More... | |
virtual int | expectInt () final |
Read an integer from the network connection. More... | |
virtual std::int8_t | expectInt8 ()=0 |
Read a 8-bit integer from the network connection. More... | |
virtual std::int16_t | expectInt16 ()=0 |
Read a 16-bit integer from the network connection. More... | |
virtual std::int32_t | expectInt32 ()=0 |
Read a 32-bit integer from the network connection. More... | |
virtual std::int64_t | expectInt64 ()=0 |
Read a 64-bit integer from the network connection. More... | |
virtual double | expectDouble () |
Read a floating point number from the network connection. More... | |
virtual yarp::conf::float32_t | expectFloat32 ()=0 |
Read a 32-bit floating point number from the network connection. More... | |
virtual yarp::conf::float64_t | expectFloat64 ()=0 |
Read a 64-bit floating point number from the network connection. More... | |
virtual bool | isTextMode () const =0 |
Check if the connection is text mode. More... | |
virtual bool | isBareMode () const =0 |
Check if the connection is bare mode. More... | |
virtual bool | convertTextMode ()=0 |
Reads in a standard description in text mode, and converts it to a standard description in binary. More... | |
virtual size_t | getSize () const =0 |
Checks how much data is available. More... | |
virtual ConnectionWriter * | getWriter ()=0 |
Gets a way to reply to the message, if possible. More... | |
virtual Bytes | readEnvelope () |
Read a message envelope, if available. More... | |
virtual Portable * | getReference () const =0 |
Get a direct pointer to the object being sent, if possible. More... | |
virtual Contact | getRemoteContact () const =0 |
Gets information about who is supplying the data being read, if that information is available. More... | |
virtual Contact | getLocalContact () const =0 |
Gets information about who is receiving the data, if that information is available. More... | |
virtual bool | isValid () const =0 |
virtual bool | isActive () const =0 |
virtual bool | isError () const =0 |
virtual void | requestDrop ()=0 |
Tag the connection to be dropped after the current message. More... | |
virtual const Searchable & | getConnectionModifiers () const =0 |
Access modifiers associated with the connection, if any. More... | |
virtual bool | pushInt (int x)=0 |
Store an integer to return on the next call to expectInt() More... | |
virtual bool | setSize (size_t len)=0 |
virtual void | setParentConnectionReader (ConnectionReader *parentConnectionReader) |
Set ConnectionReader to be used for reading the envelope. More... | |
Static Public Member Functions | |
static ConnectionReader * | createConnectionReader (InputStream &is) |
Create an instance of YARP's standard connection reader implementation. More... | |
static bool | readFromStream (PortReader &portable, InputStream &is) |
An interface for reading from a network connection.
Definition at line 39 of file ConnectionReader.h.
|
virtualdefault |
Destructor.
|
pure virtual |
Reads in a standard description in text mode, and converts it to a standard description in binary.
Useful if you only operate on the binary description usually, and just want to permit text mode for command-line interaction. If isTextMode would return false, no conversion is done.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
static |
Create an instance of YARP's standard connection reader implementation.
Definition at line 28 of file ConnectionReader.cpp.
|
pure virtual |
Read a block of data from the network connection.
data | Start of the block of data |
len | Length of the block of data |
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
inlinevirtual |
Read a floating point number from the network connection.
Definition at line 120 of file ConnectionReader.h.
|
pure virtual |
Read a 32-bit floating point number from the network connection.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Read a 64-bit floating point number from the network connection.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
inlinefinalvirtual |
Read an integer from the network connection.
Definition at line 85 of file ConnectionReader.h.
|
pure virtual |
Read a 16-bit integer from the network connection.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Read a 32-bit integer from the network connection.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Read a 64-bit integer from the network connection.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Read a 8-bit integer from the network connection.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
inlinevirtual |
Read a string from the network connection.
The string should be serialized as "length" + "block".
Reimplemented in yarp::os::impl::StreamConnectionReader.
Definition at line 68 of file ConnectionReader.h.
|
pure virtual |
Read some text from the network connection.
terminatingChar | The marker for the end of the text |
Implemented in yarp::os::NullConnectionReader, BayerCarrier, yarp::os::impl::StreamConnectionReader, and yarp::os::impl::ConnectionRecorder.
|
pure virtual |
Access modifiers associated with the connection, if any.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Gets information about who is receiving the data, if that information is available.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Get a direct pointer to the object being sent, if possible.
This only makes sense in local operation, when sender and receiver are in the same process; in all other situations this returns nullptr.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Gets information about who is supplying the data being read, if that information is available.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Checks how much data is available.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Gets a way to reply to the message, if possible.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Check if the connection is bare mode.
If it is, you are encouraged to omit type information from your serialization.
Implemented in yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Check if the connection is text mode.
If it is, you are encouraged (but by no means required) to use a human-readable representation of your data structure.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
pure virtual |
Store an integer to return on the next call to expectInt()
x | the integer to store |
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
virtual |
Read a message envelope, if available.
Reimplemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, and BayerCarrier.
Definition at line 18 of file ConnectionReader.cpp.
|
static |
Definition at line 36 of file ConnectionReader.cpp.
|
pure virtual |
Tag the connection to be dropped after the current message.
Implemented in yarp::os::NullConnectionReader, yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.
|
virtual |
Set ConnectionReader to be used for reading the envelope.
Used by PortCoreInputUnit
Reimplemented in yarp::os::impl::StreamConnectionReader.
Definition at line 23 of file ConnectionReader.cpp.
|
pure virtual |
Implemented in yarp::os::impl::StreamConnectionReader, yarp::os::impl::ConnectionRecorder, and BayerCarrier.