31 convertedTextMode(
false),
34 parentConnectionReader(nullptr)
40 if (writer !=
nullptr) {
56 this->messageLen = len;
57 this->textMode = textMode;
58 this->bareMode = bareMode;
62 convertedTextMode =
false;
63 pushedIntFlag =
false;
68 this->protocol = protocol;
115 messageLen -= result.length() + 1;
121 if (writer !=
nullptr) {
123 if (str !=
nullptr) {
124 if (protocol !=
nullptr) {
125 protocol->
reply(*writer);
133 writePending =
false;
143 reset(*in, str, route, len, textMode, bareMode);
157 pushedIntFlag =
true;
162template <
typename T,
typename NetT>
163inline T StreamConnectionReader::expectType()
170 if (r < 0 ||
static_cast<size_t>(r) < b.length()) {
174 messageLen -= b.length();
176 return static_cast<T
>(x);
198 pushedIntFlag =
false;
246 messageLen -= result.length() + 1;
264 if (!convertedTextMode) {
272 convertedTextMode =
true;
281 if (str ==
nullptr) {
284 if (writer ==
nullptr) {
290 if (protocol !=
nullptr) {
298 if (str !=
nullptr) {
309 if (str !=
nullptr) {
353 if (protocol !=
nullptr) {
355 return {
const_cast<char*
>(env.c_str()), env.length()};
357 if (parentConnectionReader !=
nullptr) {
370 if (config.
size() == 0) {
371 if (protocol !=
nullptr) {
380 this->parentConnectionReader = parentConnectionReader;
383bool StreamConnectionReader::isGood()
A simple collection of objects that can be described and transmitted in a portable way.
size_type size() const
Gets the number of elements in the bottle.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
A mini-server for performing network communication in the background.
A simple abstraction for a block of bytes.
An interface for reading from a network connection.
virtual Bytes readEnvelope()
Read a message envelope, if available.
An interface for writing to a network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
Information about a connection between two ports.
const std::string & getToName() const
Get the destination of the route.
const std::string & getCarrierName() const
Get the carrier type of the route.
const std::string & getFromName() const
Get the source of the route.
A base class for nested structures that can be searched.
A stream which can be asked to perform bidirectional communication.
virtual const Contact & getRemoteAddress() const =0
Get the address of the remote side of the stream.
virtual const Contact & getLocalAddress() const =0
Get the address of the local side of the stream.
virtual OutputStream & getOutputStream()=0
Get an OutputStream to write to.
A helper for creating cached object descriptions.
std::string toString() const
bool write(ConnectionWriter &connection) const override
Write this object to a network connection.
void clear() override
Clear all cached data.
Connection choreographer.
std::string getSenderSpecifier() const override
Extract a name for the sender, if the connection type supports that.
const std::string & getEnvelope() const override
Read the envelope associated with the current message.
void reply(SizedWriter &writer) override
Reply to a message we have just read.
void willReply()
Promise that we'll be making a reply.
std::int64_t expectInt64() override
Read a 64-bit integer from the network connection.
yarp::os::Contact getRemoteContact() const override
Gets information about who is supplying the data being read, if that information is available.
bool convertTextMode() override
Reads in a standard description in text mode, and converts it to a standard description in binary.
void setParentConnectionReader(ConnectionReader *parentConnectionReader) override
Set ConnectionReader to be used for reading the envelope.
bool isActive() const override
yarp::os::ConnectionWriter * getWriter() override
Gets a way to reply to the message, if possible.
bool pushInt(int x) override
Store an integer to return on the next call to expectInt()
void setProtocol(Protocol *protocol)
bool isBareMode() const override
Check if the connection is bare mode.
std::int16_t expectInt16() override
Read a 16-bit integer from the network connection.
yarp::conf::float64_t expectFloat64() override
Read a 64-bit floating point number from the network connection.
yarp::os::Contact getLocalContact() const override
Gets information about who is receiving the data, if that information is available.
const yarp::os::Searchable & getConnectionModifiers() const override
Access modifiers associated with the connection, if any.
virtual std::string expectLine()
size_t getSize() const override
Checks how much data is available.
std::string expectText(const char terminatingChar) override
Read some text from the network connection.
std::int8_t expectInt8() override
Read a 8-bit integer from the network connection.
yarp::conf::float32_t expectFloat32() override
Read a 32-bit floating point number from the network connection.
void flushWriter() override
yarp::os::Bytes readEnvelope() override
Read a message envelope, if available.
bool isValid() const override
void reset(yarp::os::InputStream &in, TwoWayStream *str, const Route &route, size_t len, bool textMode, bool bareMode=false)
bool isError() const override
virtual ~StreamConnectionReader()
virtual bool expectBlock(yarp::os::Bytes &b)
bool isTextMode() const override
Check if the connection is text mode.
yarp::os::Portable * getReference() const override
Get a direct pointer to the object being sent, if possible.
virtual void setReference(yarp::os::Portable *obj)
std::int32_t expectInt32() override
Read a 32-bit integer from the network connection.
void requestDrop() override
Tag the connection to be dropped after the current message.
bool setSize(size_t len) override
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.
std::int32_t NetInt32
Definition of the NetInt32 type.