void SchemaStatisticImpl::encode(Buffer& buffer) const { FieldTable map; map.setString("name", name); map.setInt("type", (int) typecode); if (!unit.empty()) map.setString("unit", unit); if (!description.empty()) map.setString("desc", description); map.encode(buffer); }
void SchemaMethodImpl::encode(Buffer& buffer) const { FieldTable map; map.setString("name", name); map.setInt("argCount", arguments.size()); if (!description.empty()) map.setString("desc", description); map.encode(buffer); for (vector<const SchemaArgument*>::const_iterator iter = arguments.begin(); iter != arguments.end(); iter++) (*iter)->impl->encode(buffer); }
void SchemaPropertyImpl::encode(Buffer& buffer) const { FieldTable map; map.setString("name", name); map.setInt("type", (int) typecode); map.setInt("access", (int) access); map.setInt("index", index ? 1 : 0); map.setInt("optional", optional ? 1 : 0); if (!unit.empty()) map.setString("unit", unit); if (!description.empty()) map.setString("desc", description); map.encode(buffer); }
void SchemaArgumentImpl::encode(Buffer& buffer) const { FieldTable map; map.setString("name", name); map.setInt("type", (int) typecode); if (dir == DIR_IN) map.setString("dir", "I"); else if (dir == DIR_OUT) map.setString("dir", "O"); else map.setString("dir", "IO"); if (!unit.empty()) map.setString("unit", unit); if (!description.empty()) map.setString("desc", description); map.encode(buffer); }
void ValueImpl::encode(Buffer& buf) const { FieldTable ft; List fl; switch (typecode) { case TYPE_UINT8 : buf.putOctet((uint8_t) value.u32); break; case TYPE_UINT16 : buf.putShort((uint16_t) value.u32); break; case TYPE_UINT32 : buf.putLong(value.u32); break; case TYPE_UINT64 : buf.putLongLong(value.u64); break; case TYPE_SSTR : buf.putShortString(stringVal); break; case TYPE_LSTR : buf.putMediumString(stringVal); break; case TYPE_ABSTIME : buf.putLongLong(value.s64); break; case TYPE_DELTATIME : buf.putLongLong(value.u64); break; case TYPE_BOOL : buf.putOctet(value.boolVal ? 1 : 0); break; case TYPE_FLOAT : buf.putFloat(value.floatVal); break; case TYPE_DOUBLE : buf.putDouble(value.doubleVal); break; case TYPE_INT8 : buf.putOctet((uint8_t) value.s32); break; case TYPE_INT16 : buf.putShort((uint16_t) value.s32); break; case TYPE_INT32 : buf.putLong(value.s32); break; case TYPE_INT64 : buf.putLongLong(value.s64); break; case TYPE_UUID : buf.putBin128(value.uuidVal); break; case TYPE_REF : refVal.impl->encode(buf); break; case TYPE_MAP: mapToFieldTable(ft); ft.encode(buf); break; case TYPE_LIST: listToFramingList(fl); fl.encode(buf); break; case TYPE_ARRAY: case TYPE_OBJECT: default: break; } }