More efficient implementation of NTTable

Cache the value field. Allows simpler implementation of getColumn().
This commit is contained in:
Dave Hickin
2015-08-31 23:50:51 +01:00
parent 6ec5fb6ef9
commit ed9a707f14
2 changed files with 3 additions and 2 deletions

View File

@@ -245,11 +245,11 @@ StringArray const & NTTable::getColumnNames() const
PVFieldPtr NTTable::getColumn(std::string const & columnName) const
{
return pvNTTable->getSubField("value." + columnName);
return pvValue->getSubField(columnName);
}
NTTable::NTTable(PVStructurePtr const & pvStructure) :
pvNTTable(pvStructure)
pvNTTable(pvStructure), pvValue(pvNTTable->getSubField<PVStructure>("value"))
{}

View File

@@ -288,6 +288,7 @@ public:
private:
NTTable(epics::pvData::PVStructurePtr const & pvStructure);
epics::pvData::PVStructurePtr pvNTTable;
epics::pvData::PVStructurePtr pvValue;
friend class detail::NTTableBuilder;
};