Move getSubFieldT definitions out of class body

Move definitions of 2 getSubFieldT overloads:
shared_ptr<PVT> PVStructure::getSubFieldT(const char *name) const
shared_ptr<PVT> PVStructure::getSubFieldT(size_t fieldOffset) const
out of class body so not implicitly inlined.
This commit is contained in:
Dave Hickin
2015-07-15 11:34:44 +01:00
parent 35ca5f3aed
commit 52bc6d060d

View File

@@ -757,20 +757,8 @@ public:
}
template<typename PVT>
std::tr1::shared_ptr<PVT> getSubFieldT(const char *name) const
{
std::tr1::shared_ptr<PVT> pvField = std::tr1::dynamic_pointer_cast<PVT>(
getSubFieldImpl(name)->shared_from_this());
std::tr1::shared_ptr<PVT> getSubFieldT(const char *name) const;
if (pvField.get())
return pvField;
else
{
std::stringstream ss;
ss << "Failed to get field: " << name << " (Field has wrong type)";
throw std::runtime_error(ss.str());
}
}
/**
* Get the subfield with the specified offset.
* @param fieldOffset The offset.
@@ -786,20 +774,7 @@ public:
* @throws std::runtime_error if the requested sub-field doesn't exist, or has a different type
*/
template<typename PVT>
std::tr1::shared_ptr<PVT> getSubFieldT(std::size_t fieldOffset) const
{
std::tr1::shared_ptr<PVT> pvField = std::tr1::dynamic_pointer_cast<PVT>(
getSubFieldT(fieldOffset));
if (pvField.get())
return pvField;
else
{
std::stringstream ss;
ss << "Failed to get field with offset "
<< fieldOffset << " (Field has wrong type)";
throw std::runtime_error(ss.str());
}
}
std::tr1::shared_ptr<PVT> getSubFieldT(std::size_t fieldOffset) const;
/**
* Get a boolean field with the specified name.
@@ -1001,6 +976,38 @@ private:
};
template<typename PVT>
std::tr1::shared_ptr<PVT> PVStructure::getSubFieldT(const char *name) const
{
std::tr1::shared_ptr<PVT> pvField = std::tr1::dynamic_pointer_cast<PVT>(
getSubFieldImpl(name)->shared_from_this());
if (pvField.get())
return pvField;
else
{
std::stringstream ss;
ss << "Failed to get field: " << name << " (Field has wrong type)";
throw std::runtime_error(ss.str());
}
}
template<typename PVT>
std::tr1::shared_ptr<PVT> PVStructure::getSubFieldT(std::size_t fieldOffset) const
{
std::tr1::shared_ptr<PVT> pvField = std::tr1::dynamic_pointer_cast<PVT>(
getSubFieldT(fieldOffset));
if (pvField.get())
return pvField;
else
{
std::stringstream ss;
ss << "Failed to get field with offset "
<< fieldOffset << " (Field has wrong type)";
throw std::runtime_error(ss.str());
}
}
/**
* @brief PVUnion has a single subfield.
*