Commit 43eb5377 authored by Spencer Sherwin's avatar Spencer Sherwin

Merge branch 'feature/parseutils-simplify' into 'master'

Minor simplification to ParseUtils to avoid using two functors

See merge request !908
parents 4da6b4c2 8f1f3842
......@@ -22,7 +22,7 @@ v5.0.0
- Simplify RawType typedefs (!840)
- Remove unused files from BasicUtils (!841)
- Remove checks for old boost versions which are no longer supported (!841)
- Refactor ParseUtils to be more consistent (!843, !896)
- Refactor ParseUtils to be more consistent (!843, !896, !908)
- Added support for using the distance to a specific region (e.g. outlet) in the
function definitions for the Absorption Forcing (!769)
- Improve performance of DisContField2D::v_ExtractTracePhys (!824)
......
......@@ -46,8 +46,8 @@ namespace Nektar
{
/**
* @brief Helper functor for boost::spirit. This pushes back values onto a
* std::vector.
* @brief Helper functors for holding a vector of numbers to be parsed by
* boost::spirit.
*
* @see ParseUtils::GenerateSeqVector
*/
......@@ -56,28 +56,17 @@ struct PushBackFunctor
{
PushBackFunctor(std::vector<T> &in) : m_vec(in) {}
/**
* @brief Pushes back values onto #m_vec as given by @p num.
*/
void operator()(T num) const
{
m_vec.push_back(num);
}
private:
std::vector<T> &m_vec;
};
/**
* @brief Helper functor for boost::spirit. This pushes back a range of values
* onto a std::vector. Valid only for integer types.
*
* @see ParseUtils::GenerateSeqVector
*/
template<typename T>
struct SeqFunctor
{
SeqFunctor(std::vector<T> &in) : m_vec(in) {}
/**
* @brief Pushes back values onto #m_vec between the range supplied by @p
* num.
* num. Valid for only integer types.
*/
void operator()(fusion::vector<T, T> num) const
{
......@@ -88,6 +77,7 @@ struct SeqFunctor
}
}
private:
/// Storage vector that will hold parsed variables from boost::spirit.
std::vector<T> &m_vec;
};
......@@ -111,8 +101,7 @@ private:
bool ParseUtils::GenerateSeqVector(
const std::string &str, std::vector<unsigned int> &out)
{
PushBackFunctor<unsigned int> f1(out);
SeqFunctor<unsigned int> f2(out);
PushBackFunctor<unsigned int> f1(out), f2(out);
auto it = str.begin();
bool success = qi::phrase_parse(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment