7#ifndef YARP_OS_IMPL_FAKETWOWAYSTREAM_H
8#define YARP_OS_IMPL_FAKETWOWAYSTREAM_H
26 this->out.owner =
this;
27 this->target = target;
32 this->target = ⌖
68 if (target !=
nullptr) {
80 return out.toString();
109 ActiveStringOutputStream() :
115 void write(
const Bytes& b)
override
123 FakeTwoWayStream* owner;
126 StringInputStream in;
127 ActiveStringOutputStream out;
130 StringInputStream* target;
A simple abstraction for a block of bytes.
Simple specification of the minimum functions needed from output streams.
virtual void write(char ch)
Write a single byte to the stream.
An OutputStream that produces a string.
void write(const Bytes &b) override
Write a block of bytes to the stream.
A stream which can be asked to perform bidirectional communication.
A dummy two way stream for testing purposes.
void beginPacket() override
Mark the beginning of a logical packet.
OutputStream & getOutputStream() override
Get an OutputStream to write to.
void close() override
Terminate the stream.
virtual void apply(const Bytes &b)
FakeTwoWayStream(StringInputStream *target=nullptr)
std::string getInputText() const
bool isOk() const override
Check if the stream is ok or in an error state.
void setTarget(StringInputStream &target)
std::string getOutputText() const
InputStream & getInputStream() override
Get an InputStream to read from.
virtual StringInputStream & getStringInputStream()
void addInputText(const std::string &str)
const Contact & getLocalAddress() const override
Get the address of the local side of the stream.
void reset() override
Reset the stream.
void endPacket() override
Mark the end of a logical packet (see beginPacket).
const Contact & getRemoteAddress() const override
Get the address of the remote side of the stream.
The components from which ports and connections are built.