Use template getSubField when type known

Replace non-template getSubField with template version when PVField is
of a known, derived type.
This commit is contained in:
Dave Hickin
2016-07-04 17:03:07 +01:00
parent e5b6a88551
commit 1e980651a9
6 changed files with 89 additions and 102 deletions

View File

@@ -41,21 +41,18 @@ static void testPVScalar(
PVCopyPtr const & pvCopy)
{
PVStructurePtr pvStructureCopy;
PVFieldPtr pvField;
PVScalarPtr pvValueMaster;
PVScalarPtr pvValueCopy;
BitSetPtr bitSet;
size_t offset;
ConvertPtr convert = getConvert();
pvField = pvMaster->getSubField(valueNameMaster);
pvValueMaster = static_pointer_cast<PVScalar>(pvField);
pvValueMaster = pvMaster->getSubField<PVScalar>(valueNameMaster);
convert->fromDouble(pvValueMaster,.04);
StructureConstPtr structure = pvCopy->getStructure();
if(debug) { cout << "structure from copy" << endl << *structure << endl; }
pvStructureCopy = pvCopy->createPVStructure();
pvField = pvStructureCopy->getSubField(valueNameCopy);
pvValueCopy = static_pointer_cast<PVScalar>(pvField);
pvValueCopy = pvStructureCopy->getSubField<PVScalar>(valueNameCopy);
bitSet = BitSetPtr(new BitSet(pvStructureCopy->getNumberFields()));
pvCopy->initCopy(pvStructureCopy, bitSet);
if(debug) { cout << "after initCopy pvValueCopy " << convert->toDouble(pvValueCopy); }