Exemplo n.º 1
0
void PrinterPlain::beginUnionArray(const PVUnionArray& pv)
{
    indentN(S(), ilvl);
    S() << pv.getUnionArray()->getID() << " "
        << pv.getFieldName() << "[] ";
    ilvl++;
}
Exemplo n.º 2
0
void PVField::copy(const PVField& from)
{
    if(isImmutable())
        throw std::invalid_argument("destination is immutable");

    if (getField()->getType() != from.getField()->getType())
        throw std::invalid_argument("field types do not match");

    switch(getField()->getType())
    {
    case scalar:
        {
             const PVScalar* fromS = static_cast<const PVScalar*>(&from);
             PVScalar* toS = static_cast<PVScalar*>(this);
             toS->copy(*fromS);
             break;
        }
    case scalarArray:
        {
             const PVScalarArray* fromS = static_cast<const PVScalarArray*>(&from);
             PVScalarArray* toS = static_cast<PVScalarArray*>(this);
             toS->copy(*fromS);
             break;
        }
    case structure:
        {
             const PVStructure* fromS = static_cast<const PVStructure*>(&from);
             PVStructure* toS = static_cast<PVStructure*>(this);
             toS->copy(*fromS);
             break;
        }
    case structureArray:
        {
             const PVStructureArray* fromS = static_cast<const PVStructureArray*>(&from);
             PVStructureArray* toS = static_cast<PVStructureArray*>(this);
             toS->copy(*fromS);
             break;
        }
    case union_:
        {
             const PVUnion* fromS = static_cast<const PVUnion*>(&from);
             PVUnion* toS = static_cast<PVUnion*>(this);
             toS->copy(*fromS);
             break;
        }
    case unionArray:
        {
             const PVUnionArray* fromS = static_cast<const PVUnionArray*>(&from);
             PVUnionArray* toS = static_cast<PVUnionArray*>(this);
             toS->copy(*fromS);
             break;
        }
    default:
        {
            throw std::logic_error("PVField::copy unknown type");
        }
    }
}
Exemplo n.º 3
0
void PVField::copyUnchecked(const PVField& from)
{
    switch(getField()->getType())
    {
    case scalar:
        {
             const PVScalar* fromS = static_cast<const PVScalar*>(&from);
             PVScalar* toS = static_cast<PVScalar*>(this);
             toS->copyUnchecked(*fromS);
             break;
        }
    case scalarArray:
        {
             const PVScalarArray* fromS = static_cast<const PVScalarArray*>(&from);
             PVScalarArray* toS = static_cast<PVScalarArray*>(this);
             toS->copyUnchecked(*fromS);
             break;
        }
    case structure:
        {
             const PVStructure* fromS = static_cast<const PVStructure*>(&from);
             PVStructure* toS = static_cast<PVStructure*>(this);
             toS->copyUnchecked(*fromS);
             break;
        }
    case structureArray:
        {
             const PVStructureArray* fromS = static_cast<const PVStructureArray*>(&from);
             PVStructureArray* toS = static_cast<PVStructureArray*>(this);
             toS->copyUnchecked(*fromS);
             break;
        }
    case union_:
        {
             const PVUnion* fromS = static_cast<const PVUnion*>(&from);
             PVUnion* toS = static_cast<PVUnion*>(this);
             toS->copyUnchecked(*fromS);
             break;
        }
    case unionArray:
        {
             const PVUnionArray* fromS = static_cast<const PVUnionArray*>(&from);
             PVUnionArray* toS = static_cast<PVUnionArray*>(this);
             toS->copyUnchecked(*fromS);
             break;
        }
    default:
        {
            throw std::logic_error("PVField::copy unknown type");
        }
    }
}
Exemplo n.º 4
0
void PVUnionArray::copyUnchecked(const PVUnionArray& from)
{
    if (this == &from)
        return;

    replace(from.view());
}
Exemplo n.º 5
0
void PVUnionArray::copy(const PVUnionArray& from)
{
    if(isImmutable())
        throw std::invalid_argument("destination is immutable");

    if(*getUnionArray() != *from.getUnionArray())
        throw std::invalid_argument("unionArray definitions do not match");

    copyUnchecked(from);
}