|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
10 #ifndef YARPDB_NAMESERVERCONNECTIONHANDLER_INC
11 #define YARPDB_NAMESERVERCONNECTIONHANDLER_INC
30 class NameServerConnectionHandler;
46 this->service = service;
51 return apply(reader,
nullptr);
61 bool ok = cmd.
read(reader);
70 service->
apply(cmd,reply,event,remote);
71 for (
size_t i=0; i<
event.size(); i++) {
80 if (writer ==
nullptr) {
83 if (writer !=
nullptr) {
87 for (
size_t i=1; i<reply.
size(); i++) {
93 si.erase(std::remove(si.begin(), si.end(),
'\"'), si.end());
109 reply.
write(*writer);
A simple collection of objects that can be described and transmitted in a portable way.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
size_type size() const
Gets the number of elements in the bottle.
bool read(yarp::os::ConnectionReader &reader) override
Read this object from a network connection.
virtual bool apply(yarp::os::ConnectionReader &reader, yarp::os::ConnectionWriter *writer, bool lock=true)
virtual void onEvent(yarp::os::Bottle &event)
NameServerConnectionHandler(NameService *service)
virtual bool isString() const
Checks if value is a string.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
An interface for writing to a network connection.
virtual std::string asString() const
Get string value.
virtual ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
virtual bool isList() const
Checks if value is a list.
An interface for reading from a network connection.
Abstract interface for a name server operator.
virtual bool apply(yarp::os::Bottle &cmd, yarp::os::Bottle &reply, yarp::os::Bottle &event, const yarp::os::Contact &remote)=0
The main, catch-all namespace for YARP.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
virtual Bottle * asList() const
Get list value.
Manage a single connection to the name server.
void add(const Value &value)
Add a Value to the bottle, at the end of the list.
virtual Contact getRemoteContact() const =0
Gets information about who is supplying the data being read, if that information is available.
std::string toString() const override
Return a standard text representation of the content of the object.
A single value (typically within a Bottle).
virtual void appendText(const std::string &str, const char terminate='\n')=0
Send a terminated string to the network connection.