YARP
Yet Another Robot Platform
yarp::os::NullConnectionWriter Class Reference

A dummy ConnectionWriter that consumes data without effect. More...

#include <yarp/os/NullConnectionWriter.h>

+ Inheritance diagram for yarp::os::NullConnectionWriter:

Public Member Functions

void appendBlock (const char *data, size_t len) override
 Send a block of data to the network connection. More...
 
void appendInt8 (std::int8_t data) override
 Send a representation of a 8-bit integer to the network connection. More...
 
void appendInt16 (std::int16_t data) override
 Send a representation of a 16-bit integer to the network connection. More...
 
void appendInt32 (std::int32_t data) override
 Send a representation of a 32-bit integer to the network connection. More...
 
void appendInt64 (std::int64_t data) override
 Send a representation of a 64-bit integer to the network connection. More...
 
void appendFloat32 (yarp::conf::float32_t data) override
 Send a representation of a 32-bit floating point number to the network connection. More...
 
void appendFloat64 (yarp::conf::float64_t data) override
 Send a representation of a 64-bit floating point number to the network connection. More...
 
void appendText (const std::string &str, const char terminate='\n') override
 Send a terminated string to the network connection. More...
 
void appendExternalBlock (const char *data, size_t len) override
 Send a block of data to the network connection, without making a copy. More...
 
bool isTextMode () const override
 Check if the connection is text mode. More...
 
bool isBareMode () const override
 Check if the connection is bare mode. More...
 
void declareSizes (int argc, int *argv) override
 If you can easily determine how many blocks there are in a message, call this first, before anything else. More...
 
void setReplyHandler (PortReader &reader) override
 This sets a handler to deal with replies to the message. More...
 
void setReference (Portable *obj) override
 Stores a direct pointer to the object being sent. More...
 
bool convertTextMode () override
 Converts a standard description in binary into a textual description, if the connection is in text-mode. More...
 
bool isValid () const override
 
bool isActive () const override
 
bool isError () const override
 
void requestDrop () override
 Tag the connection to be dropped after the current message. More...
 
bool isNull () const override
 
SizedWritergetBuffer () override
 
const SizedWritergetBuffer () const override
 
- Public Member Functions inherited from yarp::os::ConnectionWriter
virtual ~ConnectionWriter ()
 Destructor. More...
 
virtual void appendBlock (const char *data, size_t len)=0
 Send a block of data to the network connection. More...
 
virtual void appendInt8 (std::int8_t data)=0
 Send a representation of a 8-bit integer to the network connection. More...
 
virtual void appendInt16 (std::int16_t data)=0
 Send a representation of a 16-bit integer to the network connection. More...
 
virtual void appendInt32 (std::int32_t data)=0
 Send a representation of a 32-bit integer to the network connection. More...
 
virtual void appendInt64 (std::int64_t data)=0
 Send a representation of a 64-bit integer to the network connection. More...
 
virtual void appendFloat32 (yarp::conf::float32_t data)=0
 Send a representation of a 32-bit floating point number to the network connection. More...
 
virtual void appendFloat64 (yarp::conf::float64_t data)=0
 Send a representation of a 64-bit floating point number to the network connection. More...
 
virtual void appendText (const std::string &str, const char terminate='\n')=0
 Send a terminated string to the network connection. More...
 
void appendString (const std::string &str)
 Send a string to the network connection. More...
 
virtual void appendExternalBlock (const char *data, size_t len)=0
 Send a block of data to the network connection, without making a copy. 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 void declareSizes (int argc, int *argv)=0
 If you can easily determine how many blocks there are in a message, call this first, before anything else. More...
 
virtual void setReplyHandler (PortReader &reader)=0
 This sets a handler to deal with replies to the message. More...
 
virtual void setReference (Portable *obj)=0
 Stores a direct pointer to the object being sent. More...
 
virtual bool convertTextMode ()=0
 Converts a standard description in binary into a textual description, if the connection is in text-mode. 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 bool isNull () const
 
virtual SizedWritergetBuffer ()=0
 
virtual const SizedWritergetBuffer () const =0
 

Additional Inherited Members

- Static Public Member Functions inherited from yarp::os::ConnectionWriter
static ConnectionWritercreateBufferedConnectionWriter ()
 Create a connection writer implementation that stores to a buffer which can be read later using getBuffer() More...
 
static bool writeToStream (PortWriter &portable, OutputStream &os)
 

Detailed Description

A dummy ConnectionWriter that consumes data without effect.

Definition at line 20 of file NullConnectionWriter.h.

Member Function Documentation

◆ appendBlock()

void yarp::os::NullConnectionWriter::appendBlock ( const char *  data,
size_t  len 
)
overridevirtual

Send a block of data to the network connection.

Since communication may not happen immediately, or may happen multiple times, a copy of this data is made. If you know the block of data will remain valid, and it is a large block of data, please call ConnectionWriter::appendExternalBlock instead.

Parameters
datathe start of the data block
lenthe length of the data block

Implements yarp::os::ConnectionWriter.

Definition at line 9 of file NullConnectionWriter.cpp.

◆ appendExternalBlock()

void yarp::os::NullConnectionWriter::appendExternalBlock ( const char *  data,
size_t  len 
)
overridevirtual

Send a block of data to the network connection, without making a copy.

If you are not confident that the block of data will remain valid throughout transmission, call ConnectionWriter::appendBlock instead.

Parameters
datathe start of the data block
lenthe length of the data block

Implements yarp::os::ConnectionWriter.

Definition at line 51 of file NullConnectionWriter.cpp.

◆ appendFloat32()

void yarp::os::NullConnectionWriter::appendFloat32 ( yarp::conf::float32_t  data)
overridevirtual

Send a representation of a 32-bit floating point number to the network connection.

Parameters
datathe floating point number to send

Implements yarp::os::ConnectionWriter.

Definition at line 35 of file NullConnectionWriter.cpp.

◆ appendFloat64()

void yarp::os::NullConnectionWriter::appendFloat64 ( yarp::conf::float64_t  data)
overridevirtual

Send a representation of a 64-bit floating point number to the network connection.

Parameters
datathe floating point number to send

Implements yarp::os::ConnectionWriter.

Definition at line 40 of file NullConnectionWriter.cpp.

◆ appendInt16()

void yarp::os::NullConnectionWriter::appendInt16 ( std::int16_t  data)
overridevirtual

Send a representation of a 16-bit integer to the network connection.

Parameters
datathe integer to send

Implements yarp::os::ConnectionWriter.

Definition at line 20 of file NullConnectionWriter.cpp.

◆ appendInt32()

void yarp::os::NullConnectionWriter::appendInt32 ( std::int32_t  data)
overridevirtual

Send a representation of a 32-bit integer to the network connection.

Parameters
datathe integer to send

Implements yarp::os::ConnectionWriter.

Definition at line 25 of file NullConnectionWriter.cpp.

◆ appendInt64()

void yarp::os::NullConnectionWriter::appendInt64 ( std::int64_t  data)
overridevirtual

Send a representation of a 64-bit integer to the network connection.

Parameters
datathe integer to send

Implements yarp::os::ConnectionWriter.

Definition at line 30 of file NullConnectionWriter.cpp.

◆ appendInt8()

void yarp::os::NullConnectionWriter::appendInt8 ( std::int8_t  data)
overridevirtual

Send a representation of a 8-bit integer to the network connection.

Parameters
datathe integer to send

Implements yarp::os::ConnectionWriter.

Definition at line 15 of file NullConnectionWriter.cpp.

◆ appendText()

void yarp::os::NullConnectionWriter::appendText ( const std::string &  str,
const char  terminate = '\n' 
)
overridevirtual

Send a terminated string to the network connection.

The lenght of string is not specified in advance, therefore the reader should read until the terminating character is found.

Parameters
strthe string to send
terminatethe terminating character to use

Implements yarp::os::ConnectionWriter.

Definition at line 45 of file NullConnectionWriter.cpp.

◆ convertTextMode()

bool yarp::os::NullConnectionWriter::convertTextMode ( )
overridevirtual

Converts a standard description in binary into a textual description, if the connection is in text-mode.

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.

Returns
true if the conversion was possible

Implements yarp::os::ConnectionWriter.

Definition at line 83 of file NullConnectionWriter.cpp.

◆ declareSizes()

void yarp::os::NullConnectionWriter::declareSizes ( int  argc,
int *  argv 
)
overridevirtual

If you can easily determine how many blocks there are in a message, call this first, before anything else.

This may improve efficiency in some situations.

Parameters
argcNumber of blocks
argvAn array of integers, giving the length of each block

Implements yarp::os::ConnectionWriter.

Definition at line 67 of file NullConnectionWriter.cpp.

◆ getBuffer() [1/2]

const yarp::os::SizedWriter * yarp::os::NullConnectionWriter::getBuffer ( ) const
overridevirtual
Returns
a buffer if one is present (const version).

Implements yarp::os::ConnectionWriter.

Definition at line 117 of file NullConnectionWriter.cpp.

◆ getBuffer() [2/2]

yarp::os::SizedWriter * yarp::os::NullConnectionWriter::getBuffer ( )
overridevirtual
Returns
a buffer if one is present.

Implements yarp::os::ConnectionWriter.

Definition at line 112 of file NullConnectionWriter.cpp.

◆ isActive()

bool yarp::os::NullConnectionWriter::isActive ( ) const
overridevirtual
Returns
true if the writer is active. Writers may become inactive if the connection they are associated with breaks.

Implements yarp::os::ConnectionWriter.

Definition at line 93 of file NullConnectionWriter.cpp.

◆ isBareMode()

bool yarp::os::NullConnectionWriter::isBareMode ( ) const
overridevirtual

Check if the connection is bare mode.

If it is, you are encouraged to omit type information from your serialization.

Returns
true if the connection is bare

Implements yarp::os::ConnectionWriter.

Definition at line 62 of file NullConnectionWriter.cpp.

◆ isError()

bool yarp::os::NullConnectionWriter::isError ( ) const
overridevirtual
Returns
true if the writer encountered an error. Writers can encounter an error if there is some data loss. For unreliable protocols like UDP/Multicast, where losses are not unexpected, this error flag will be reset for the next incoming message.

Implements yarp::os::ConnectionWriter.

Definition at line 98 of file NullConnectionWriter.cpp.

◆ isNull()

bool yarp::os::NullConnectionWriter::isNull ( ) const
overridevirtual
Returns
true if writer goes nowhere.

Reimplemented from yarp::os::ConnectionWriter.

Definition at line 107 of file NullConnectionWriter.cpp.

◆ isTextMode()

bool yarp::os::NullConnectionWriter::isTextMode ( ) const
overridevirtual

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.

Returns
true if the connection is text mode (as opposed to binary)

Implements yarp::os::ConnectionWriter.

Definition at line 57 of file NullConnectionWriter.cpp.

◆ isValid()

bool yarp::os::NullConnectionWriter::isValid ( ) const
overridevirtual
Returns
true if the writer is valid. A writer may be invalid if a connection has closed.

Implements yarp::os::ConnectionWriter.

Definition at line 88 of file NullConnectionWriter.cpp.

◆ requestDrop()

void yarp::os::NullConnectionWriter::requestDrop ( )
overridevirtual

Tag the connection to be dropped after the current message.

Implements yarp::os::ConnectionWriter.

Definition at line 103 of file NullConnectionWriter.cpp.

◆ setReference()

void yarp::os::NullConnectionWriter::setReference ( Portable obj)
overridevirtual

Stores a direct pointer to the object being sent.

This is useful for local communication, to bypass serialization.

Implements yarp::os::ConnectionWriter.

Definition at line 78 of file NullConnectionWriter.cpp.

◆ setReplyHandler()

void yarp::os::NullConnectionWriter::setReplyHandler ( PortReader reader)
overridevirtual

This sets a handler to deal with replies to the message.

The handler will be called once per connection. There will be problems for connections using carriers that don't support replies.

Parameters
readerthe object that handles replies.

Implements yarp::os::ConnectionWriter.

Definition at line 73 of file NullConnectionWriter.cpp.


The documentation for this class was generated from the following files: