|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
10 #include "XmlRpcValue.h"
18 using YarpXmlRpc::XmlRpcValue;
24 case XmlRpcValue::TypeInt:
27 case XmlRpcValue::TypeDouble:
28 return Value((
double)v);
30 case XmlRpcValue::TypeString:
33 if (s.length()==0 || s[0]!=
'[') {
42 case XmlRpcValue::TypeArray:
46 for (
int i=0; i<v.size(); i++) {
47 XmlRpcValue& v2 = v[i];
48 if (v2.getType()!=XmlRpcValue::TypeInvalid) {
52 if (tag==
"list"||tag==
"dict") {
64 case XmlRpcValue::TypeStruct:
68 XmlRpcValue::ValueStruct& vals = v;
70 for (
auto& val : vals) {
71 XmlRpcValue& v2 = val.second;
74 if (v2.getType()!=XmlRpcValue::TypeInvalid) {
81 case XmlRpcValue::TypeInvalid:
86 return Value(
"(type not supported yet out of laziness)");
108 client.read(
"POST /RP");
110 server.read(
"POST /RP");
115 Bytes bytes(buf,
sizeof(buf));
117 int result2 = delegate->getInputStream().partialRead(bytes);
121 string s(buf,result2);
134 client.parseResponse(xresult);
136 cprefix = server.parseRequest(xresult);
137 bool isAdmin =
false;
139 if (cprefix==
"publisherUpdate") {
142 if (cprefix==
"requestTopic") {
145 if (cprefix==
"getPid") {
148 if (cprefix==
"getBusInfo") {
152 prefix = isAdmin?
"a\n":
"d\n";
159 sis.reset(prefix + v.
toString() +
"\n");
161 sis.reset(prefix +
"\n");
164 result = sis.read(b);
170 return (result>0)?result:-1;
176 delegate->getOutputStream().write(b);
A simple collection of objects that can be described and transmitted in a portable way.
static Value & getNullValue()
Return an invalid, "null" Value.
Value toValue(XmlRpcValue &v, bool outer)
void write(const yarp::os::Bytes &b) override
Write a block of bytes to the stream.
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
const yarp::os::LogComponent & XMLRPCCARRIER()
virtual std::string asString() const
Get string value.
bool isNull() const override
Checks if the object is invalid.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
A simple abstraction for a block of bytes.
An interface to the operating system, including Port based communication.
void fromString(const char *str)
Set value to correspond to a textual representation.
virtual Bottle * asList() const
Get list value.
void add(const Value &value)
Add a Value to the bottle, at the end of the list.
#define yCTrace(component,...)
std::string toString() const override
Return a standard text representation of the content of the object.
A single value (typically within a Bottle).