Skip to content

File stringconverter.h

File List > code_source > templat > include > TempLat > parameters > stringconverter.h

Go to the documentation of this file

#ifndef TEMPLAT_PARAMETERS_STRINGCONVERTER_H
#define TEMPLAT_PARAMETERS_STRINGCONVERTER_H

/* This file is part of TempLat, available at https://cosmolattice.github.io/templat .
   Copyright 2021-2026 The TempLat authors, see AUTHORS.md.
   Released under the MIT license, see LICENSE.md. */

// File info: Main contributor(s): Adrien Florio, Year: 2019

#include "TempLat/parameters/multipleparametergetter.h"

namespace TempLat
{
  template <class T> class StringConverter
  {
  public:
    // Put public methods here. These should change very little over time.
    StringConverter() = default;
    void operator()(const std::string &str, MultipleParameterGetter<T> &arr, const std::string &name)
    {
      arr.clear();
      T tmp;
      std::istringstream iss(str);

      while (iss >> std::boolalpha >> std::skipws >> tmp) {
        arr.push_back(ParameterGetter<T>(tmp, name));
      }
    }
  };
} // namespace TempLat

#endif