Page MenuHomec4science

options_handler.hpp
No OneTemporary

File Metadata

Created
Sat, Nov 23, 23:10

options_handler.hpp

#ifndef SPECMICP_UTILS_OPTIONSHANDLER_HPP
#define SPECMICP_UTILS_OPTIONSHANDLER_HPP
namespace specmicp {
//! \brief Class that handles the options
template <class OptionsClass>
class OptionsHandler
{
public:
//! \brief Initializa with the default options
OptionsHandler() {}
//! \brief Initialise the options class using the arguments provided
template <typename... Args>
OptionsHandler(Args... args):
m_options(args...)
{}
//! \brief Initialize with given options
OptionsHandler(const OptionsClass& options):
m_options(options)
{}
//! \brief Return a reference to the options
OptionsClass& get_options() {return m_options;}
//! \brief Return a const reference to the options
const OptionsClass& get_options() const {return m_options;}
//! \brief Set the options
void set_options(const OptionsClass& options) {m_options = options;}
//! \brief Swap the options with another set
//!
//! May be useful for temporary change
void swap(OptionsClass& options) {std::swap(m_options, options);}
//! \brief Reset to default options
void reset_to_default() {m_options = OptionsClass();}
private:
OptionsClass m_options; //!< The options
};
} // end namespace specmicp
#endif // SPECMICP_UTILS_OPTIONSHANDLER_HPP

Event Timeline