FieldContainerPtr NFIOName::readFC(const std::string &/*typeName*/)
{
    FDEBUG(("NFIOName::readFC\n"));

    NamePtr name = Name::create();

    UInt8 fcPtrType;
    _in->getValue(fcPtrType);

    UInt16 version;
    _in->getValue(version);

    if(version == 100)
    {
        std::string fieldName;
        std::string fieldType;
        UInt32 size = 0;

        // skip internal bool field
        _in->getValue(fieldName);
        _in->getValue(fieldType);
        _in->getValue(size);
        _in->skip(size);

        // read name field
        _in->getValue(fieldName);
        _in->getValue(fieldType);
        _in->getValue(size);

        SField<std::string> str;
        str.copyFromBin(*_in);

        name->editFieldPtr()->getValue().assign(str.getValue().c_str());

        readEndMarker();
    }
    else
    {
        readFCFields(name);
    }

    return name;
}
Пример #2
0
void runTest1(bool write,BinaryDataHandler &pMem,const T &value)
{
    SField<T,1> sfield;
    MField<T,1> mfield;
    if(write)
    {
        sfield.setValue(value);
        sfield.copyToBin(pMem);
        mfield.clear();
        mfield.push_back(value);
        mfield.push_back(value);
        mfield.copyToBin(pMem);
        SLOG << SField<T,1>::SFieldTraits::getSName() << " size " 
             << sfield.getBinSize() << std::endl;
        SLOG << MField<T,1>::MFieldTraits::getMName() << " size " 
             << mfield.size() << " " << mfield.getBinSize() << std::endl;
    }
    else
    {
        sfield.copyFromBin(pMem);
        if(sfield.getValue() == value)
            SLOG << SField<T,1>::SFieldTraits::getSName() << " " 
                 << "OK" << std::endl;
        else
            SLOG << SField<T,1>::SFieldTraits::getSName() << " " 
                 << "ERROR " << std::endl;
        mfield.copyFromBin(pMem);
        if(mfield[0] == value &&
           mfield[1] == value)
            SLOG << SField<T,1>::SFieldTraits::getMName() << " "
                 << "OK" << std::endl;
        else
            SLOG << SField<T,1>::SFieldTraits::getMName() << " " 
                 << "ERROR" << std::endl;
    }
}