Make overloads of getSubField and getSubFieldT match

For each getSubField overload a throwing getSubFieldT has been added and
vice versa. These have been documented in doxygen and in the module
documentation.

Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
This commit is contained in:
Dave Hickin
2015-07-13 12:41:47 +01:00
parent ebe2d6196c
commit 9827caa3e3
4 changed files with 107 additions and 20 deletions

View File

@@ -134,6 +134,20 @@ PVFieldPtr PVStructure::getSubField(size_t fieldOffset) const
throw std::logic_error("PVStructure.getSubField: Logic error");
}
PVField& PVStructure::getSubFieldT(std::size_t fieldOffset) const
{
PVField * raw = getSubField(fieldOffset).get();
if (raw)
return *raw;
else
{
std::stringstream ss;
ss << "Failed to get field with offset "
<< fieldOffset << "(Invalid offset)" ;
throw std::runtime_error(ss.str());
}
}
PVField* PVStructure::getSubFieldImpl(const char *name, bool throws) const
{
const PVStructure *parent = this;