|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
9 #ifndef YARP2_WIRETWIDDLER
10 #define YARP2_WIRETWIDDLER
28 namespace wire_rep_utils {
80 if (writer)
delete writer;
84 bool configure(
const char *txt,
const char *prompt);
98 std::vector<yarp::os::NetInt32>
buffer;
99 std::vector<WireTwiddlerGap> gaps;
106 const std::string& vtag);
109 return (
int)gaps.size();
156 int pending_string_length;
157 int pending_string_data;
175 pending_string_length = 0;
176 pending_string_data = 0;
177 override_length = -1;
208 this->offset = offset;
218 std::vector<WireTwiddlerSrc> srcs;
222 const char *blockPtr;
229 const char *activeEmit;
231 int activeEmitLength;
232 int activeEmitOffset;
233 const char *activeCheck;
235 size_t scratchOffset;
262 activeCheck(nullptr),
289 activeCheck(nullptr),
300 this->parent = &parent;
301 this->twiddler = &twiddler;
315 size_t length(
size_t index)
const override {
316 return srcs[index].len;
319 const char *
data(
size_t index)
const override {
320 if (srcs[index].offset<0)
return srcs[index].src;
321 return scratch.
get()+srcs[index].offset;
332 bool skip(
const char *start,
int len);
338 bool pad(
size_t len);
340 bool readLengthAndPass(
int unitLength,
const WireTwiddlerGap *gap =
nullptr);
342 bool advance(
int length,
bool shouldEmit,
bool shouldAccum=
false,
343 bool shouldCheck=
false);
345 bool emit(
const char *src,
int len);
size_t headerLength() const override
A simple collection of objects that can be described and transmitted in a portable way.
WireTwiddlerReader(yarp::os::InputStream &is, WireTwiddler &twiddler)
const WireTwiddlerGap & getGap(int index)
#define YARP_wire_rep_utils_API
yarp::os::Portable * getReference() override
This is a base class for objects that can be both read from and be written to the YARP network.
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
void attach(yarp::os::SizedWriter &parent, WireTwiddler &twiddler)
yarp::sig::Vector zeros(int s)
Creates a vector of zeros (defined in Math.h).
virtual void startWrite() const =0
Call when writing is about to begin.
bool isOk() const override
Check if the stream is ok or in an error state.
bool shouldIgnoreExternal() const
virtual ~WireTwiddlerWriter()
yarp::os::PortReader * getReplyHandler() override
void stopWrite() const override
Call when all writing is finished.
const char * data(size_t index) const override
virtual ~WireTwiddlerReader()
const std::string & getOrigin() const
void startWrite() const override
Call when writing is about to begin.
WireTwiddlerWriter(yarp::os::SizedWriter &parent, WireTwiddler &twiddler)
void close() override
Terminate the stream.
bool dropRequested() override
virtual Portable * getReference()=0
An abstraction for a block of bytes, with optional responsibility for allocating/destroying that bloc...
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
int getExternalLength() const
An interface for writing to a network connection.
size_t length(size_t index) const override
const std::string & getPrompt() const
virtual PortReader * getReplyHandler()=0
A simple abstraction for a block of bytes.
std::string toString(const T &value)
convert an arbitrary type to string.
The main, catch-all namespace for YARP.
size_t length() const override
WireTwiddlerSrc(char *src, int len, int offset)
int getUnitLength() const
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
virtual void stopWrite() const =0
Call when all writing is finished.
Minimal requirements for an efficient Writer.
A class for storing options and configuration information.
std::int32_t NetInt32
Definition of the NetInt32 type.