Exemple #1
0
SchemaStatisticImpl::SchemaStatisticImpl(Buffer& buffer)
{
    FieldTable map;
    map.decode(buffer);

    name = map.getAsString("name");
    typecode = (Typecode) map.getAsInt("type");
    unit = map.getAsString("unit");
    description = map.getAsString("desc");
}
Exemple #2
0
SchemaPropertyImpl::SchemaPropertyImpl(Buffer& buffer)
{
    FieldTable map;
    map.decode(buffer);

    name = map.getAsString("name");
    typecode = (Typecode) map.getAsInt("type");
    access = (Access) map.getAsInt("access");
    index = map.getAsInt("index") != 0;
    optional = map.getAsInt("optional") != 0;
    unit = map.getAsString("unit");
    description = map.getAsString("desc");
}
Exemple #3
0
SchemaMethodImpl::SchemaMethodImpl(Buffer& buffer)
{
    FieldTable map;
    int argCount;

    map.decode(buffer);
    name = map.getAsString("name");
    argCount = map.getAsInt("argCount");
    description = map.getAsString("desc");

    for (int idx = 0; idx < argCount; idx++) {
        SchemaArgument* arg = SchemaArgumentImpl::factory(buffer);
        addArgument(arg);
    }
}
Exemple #4
0
SchemaArgumentImpl::SchemaArgumentImpl(Buffer& buffer)
{
    FieldTable map;
    map.decode(buffer);

    name = map.getAsString("name");
    typecode = (Typecode) map.getAsInt("type");
    unit = map.getAsString("unit");
    description = map.getAsString("desc");

    dir = DIR_IN;
    string dstr(map.getAsString("dir"));
    if (dstr == "O")
        dir = DIR_OUT;
    else if (dstr == "IO")
        dir = DIR_IN_OUT;
}
Exemple #5
0
ValueImpl::ValueImpl(Typecode t, Buffer& buf) : typecode(t)
{
    uint64_t first;
    uint64_t second;
    FieldTable ft;
    List fl;

    switch (typecode) {
    case TYPE_UINT8     : value.u32 = (uint32_t) buf.getOctet();  break;
    case TYPE_UINT16    : value.u32 = (uint32_t) buf.getShort();  break;
    case TYPE_UINT32    : value.u32 = (uint32_t) buf.getLong();   break;
    case TYPE_UINT64    : value.u64 = buf.getLongLong();          break;
    case TYPE_SSTR      : buf.getShortString(stringVal);          break;
    case TYPE_LSTR      : buf.getMediumString(stringVal);         break;
    case TYPE_ABSTIME   : value.s64 = buf.getLongLong();          break;
    case TYPE_DELTATIME : value.u64 = buf.getLongLong();          break;
    case TYPE_BOOL      : value.boolVal = (buf.getOctet() != 0);  break;
    case TYPE_FLOAT     : value.floatVal = buf.getFloat();        break;
    case TYPE_DOUBLE    : value.doubleVal = buf.getDouble();      break;
    case TYPE_INT8      : value.s32 = (int32_t) ((int8_t) buf.getOctet()); break;
    case TYPE_INT16     : value.s32 = (int32_t) ((int16_t) buf.getShort()); break;
    case TYPE_INT32     : value.s32 = (int32_t) buf.getLong();    break;
    case TYPE_INT64     : value.s64 = buf.getLongLong();          break;
    case TYPE_UUID      : buf.getBin128(value.uuidVal);           break;
    case TYPE_REF:
        first = buf.getLongLong();
        second = buf.getLongLong();
        refVal.impl->setValue(first, second);
        break;

    case TYPE_MAP:
        ft.decode(buf);
        initMap(ft);
        break;

    case TYPE_LIST:
        fl.decode(buf);
        initList(fl);
        break;

    case TYPE_ARRAY:
    case TYPE_OBJECT:
    default:
        break;
    }
}
Exemple #6
0
void translate(const Variant::Map& from, const std::string& efield, const Variant& evalue, FieldTable& to)
{
    // Create buffer of correct size to encode Variant::Map
    uint32_t len = encodedSize(from, efield, evalue);
    std::vector<char> space(len);
    qpid::framing::Buffer buff(&space[0], len);

    // Encode Variant::Map into buffer directly -
    // We pass the already calculated length in to avoid
    // recalculating it.
    encode(from, efield, evalue, len, buff);

    // Give buffer to FieldTable
    // Could speed this up a bit by avoiding copying
    // the buffer we just created into the FieldTable
    assert( len == buff.getPosition() );
    buff.reset();
    to.decode(buff);
}