bool BottleImpl::fromBytes(ConnectionReader& reader) { if (reader.isError()) return false; int id = speciality; YMSG(("READING, nest flag is %d\n", nested)); if (id==0) { id = reader.expectInt(); YMSG(("READ subcode %d\n", id)); } else { YMSG(("READ skipped subcode %d\n", speciality)); } Storable *storable = Storable::createByCode(id); if (storable==NULL) { YARP_SPRINTF1(Logger::get(),error,"BottleImpl reader failed, unrecognized object code %d",id); return false; } storable->readRaw(reader); add(storable); return true; }
bool Value::read(ConnectionReader& connection) { if (proxy) { delete proxy; proxy = 0; } int x = connection.expectInt(); if ((x&0xffff) != x) return false; if (!(x&BOTTLE_TAG_LIST)) return false; int len = connection.expectInt(); if (len==0) return true; if (len!=1) return false; if (x==BOTTLE_TAG_LIST) { x = connection.expectInt(); } else { x &= ~BOTTLE_TAG_LIST; } if (connection.isError()) return false; Storable *s = Storable::createByCode(x); setProxy(s); if (!proxy) return false; return s->readRaw(connection); }