An interface for writing to a network connection. More...
#include <ConnectionWriter.h>
Public Member Functions | |
| virtual | ~ConnectionWriter () |
| Destructor. | |
| virtual void | appendBlock (const char *data, int len)=0 |
| Send a block of data to the network connection. | |
| virtual void | appendInt (int data)=0 |
| Send a representation of an integer to the network connection. | |
| virtual void | appendDouble (double data)=0 |
| Send a representation of a floating point number to the network connection. | |
| virtual void | appendString (const char *str, int terminate= '\n')=0 |
| Send a character sequence to the network connection. | |
| virtual void | appendExternalBlock (const char *data, int len)=0 |
| Send a block of data to the network connection, without making a copy. | |
| virtual bool | isTextMode ()=0 |
| Check if the connection is text mode. | |
| 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. | |
| virtual void | setReplyHandler (PortReader &reader)=0 |
| This sets a handler to deal with replies to the message. | |
| virtual void | setReference (Portable *obj)=0 |
| Stores a direct pointer to the object being sent. | |
| virtual bool | convertTextMode ()=0 |
| Converts a standard description in binary into a textual description, if the connection is in text-mode. | |
| virtual bool | isValid ()=0 |
| virtual bool | isActive ()=0 |
| virtual bool | isError ()=0 |
An interface for writing to a network connection.
port_power/ex0402_port_callback_reply.cpp, port_power/ex0403_bufferedport_callback_reply.cpp, port_power/TargetVer2.h, and port_power/TargetVer3.h.
Definition at line 29 of file libYARP_OS/include/yarp/os/ConnectionWriter.h.
| virtual yarp::os::ConnectionWriter::~ConnectionWriter | ( | ) | [inline, virtual] |
Destructor.
Definition at line 35 of file libYARP_OS/include/yarp/os/ConnectionWriter.h.
| virtual void yarp::os::ConnectionWriter::appendBlock | ( | const char * | data, | |
| int | len | |||
| ) | [pure virtual] |
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.
| data | the start of the data block | |
| len | the length of the data block |
Referenced by yarp::os::impl::ConnectionRecorder::appendBlock(), yarp::os::impl::BufferedConnectionWriter::write(), and yarp::os::BinPortable< T >::write().
| virtual void yarp::os::ConnectionWriter::appendInt | ( | int | data | ) | [pure virtual] |
Send a representation of an integer to the network connection.
| data | the integer to send |
Referenced by yarp::os::impl::ConnectionRecorder::appendInt(), yarp::os::impl::ConnectionRecorder::write(), and yarp::os::PortablePair< HEAD, BODY >::writePair().
| virtual void yarp::os::ConnectionWriter::appendDouble | ( | double | data | ) | [pure virtual] |
Send a representation of a floating point number to the network connection.
| data | the floating point number to send |
Referenced by yarp::os::impl::ConnectionRecorder::appendDouble().
| virtual void yarp::os::ConnectionWriter::appendString | ( | const char * | str, | |
| int | terminate = '\n' | |||
| ) | [pure virtual] |
Send a character sequence to the network connection.
| str | the character sequence to send | |
| terminate | the terminating character to use |
Referenced by yarp::os::impl::ConnectionRecorder::appendString().
| virtual void yarp::os::ConnectionWriter::appendExternalBlock | ( | const char * | data, | |
| int | len | |||
| ) | [pure virtual] |
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, then call ConnectionWriter::appendBlock instead.
| data | the start of the data block | |
| len | the length of the data block |
Referenced by yarp::os::impl::ConnectionRecorder::appendExternalBlock().
| virtual bool yarp::os::ConnectionWriter::isTextMode | ( | ) | [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.
Referenced by yarp::os::impl::ConnectionRecorder::fini().
| virtual void yarp::os::ConnectionWriter::declareSizes | ( | int | argc, | |
| int * | argv | |||
| ) | [pure virtual] |
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.
| argc | Number of blocks | |
| argv | An array of integers, giving the length of each block |
Referenced by yarp::os::impl::ConnectionRecorder::declareSizes().
| virtual void yarp::os::ConnectionWriter::setReplyHandler | ( | PortReader & | reader | ) | [pure virtual] |
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.
| reader | the object that handles replies. |
Referenced by yarp::os::impl::ConnectionRecorder::setReplyHandler().
| virtual void yarp::os::ConnectionWriter::setReference | ( | Portable * | obj | ) | [pure virtual] |
Stores a direct pointer to the object being sent.
This is useful for local communication, to bypass serialization.
Referenced by yarp::os::impl::ConnectionRecorder::setReference().
| virtual bool yarp::os::ConnectionWriter::convertTextMode | ( | ) | [pure virtual] |
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.
Referenced by yarp::os::impl::ConnectionRecorder::fini(), yarp::os::BinPortable< T >::write(), and yarp::os::PortablePair< HEAD, BODY >::writePair().
| virtual bool yarp::os::ConnectionWriter::isValid | ( | ) | [pure virtual] |
Referenced by yarp::os::impl::ConnectionRecorder::isValid().
| virtual bool yarp::os::ConnectionWriter::isActive | ( | ) | [pure virtual] |
Referenced by yarp::os::impl::ConnectionRecorder::isActive().
| virtual bool yarp::os::ConnectionWriter::isError | ( | ) | [pure virtual] |
Referenced by yarp::os::impl::ConnectionRecorder::isError(), and yarp::os::impl::BufferedConnectionWriter::write().
1.7.1