Virtual base class for storing settings.
More...
#include "timemory/settings/vsettings.hpp"
|
| vsettings (std::string _name="", std::string _env_name="", std::string _descript="", std::vector< std::string > _cmdline={}, int32_t _count=-1, int32_t _max_count=-1, std::vector< std::string > _choices={}) |
|
virtual | ~vsettings ()=default |
|
| vsettings (const vsettings &)=default |
|
| vsettings (vsettings &&)=default |
|
vsettings & | operator= (const vsettings &)=default |
|
vsettings & | operator= (vsettings &&)=default |
|
virtual std::string | as_string () const =0 |
|
virtual void | reset ()=0 |
|
virtual void | parse ()=0 |
|
virtual void | parse (const std::string &)=0 |
|
virtual void | add_argument (argparse::argument_parser &)=0 |
|
virtual std::shared_ptr< vsettings > | clone ()=0 |
|
virtual void | clone (std::shared_ptr< vsettings > rhs) |
|
virtual display_map_t | get_display (std::ios::fmtflags fmt={}, int _w=-1, int _p=-1) |
|
const auto & | get_name () const |
|
const auto & | get_env_name () const |
|
const auto & | get_description () const |
|
const auto & | get_command_line () const |
|
const auto & | get_choices () const |
|
const auto & | get_count () const |
|
const auto & | get_max_count () const |
|
void | set_count (int32_t v) |
|
void | set_max_count (int32_t v) |
|
void | set_choices (const std::vector< std::string > &v) |
|
void | set_command_line (const std::vector< std::string > &v) |
|
auto | get_type_index () const |
|
auto | get_value_index () const |
|
virtual bool | matches (const std::string &, bool exact=true) const |
|
template<typename Tp > |
std::pair< bool, Tp > | get () const |
|
template<typename Tp > |
bool | get (Tp &_val) const |
|
template<typename Tp , enable_if_t< std::is_fundamental< decay_t< Tp > >::value > = 0> |
bool | set (const Tp &_val) |
|
void | set (const std::string &_val) |
|
virtual parser_func_t | get_action (TIMEMORY_API)=0 |
|
Virtual base class for storing settings.
Definition at line 55 of file vsettings.hpp.
◆ tim::vsettings::noparse
struct tim::vsettings::noparse |
◆ display_map_t
◆ parser_func_t
◆ parser_t
◆ vsettings() [1/3]
TIMEMORY_SETTINGS_INLINE tim::vsettings::vsettings |
( |
std::string |
_name = "" , |
|
|
std::string |
_env_name = "" , |
|
|
std::string |
_descript = "" , |
|
|
std::vector< std::string > |
_cmdline = {} , |
|
|
int32_t |
_count = -1 , |
|
|
int32_t |
_max_count = -1 , |
|
|
std::vector< std::string > |
_choices = {} |
|
) |
| |
Definition at line 44 of file vsettings.cpp.
std::vector< std::string > m_choices
std::string m_description
std::vector< std::string > m_cmdline
◆ ~vsettings()
virtual tim::vsettings::~vsettings |
( |
| ) |
|
|
virtualdefault |
◆ vsettings() [2/3]
tim::vsettings::vsettings |
( |
const vsettings & |
| ) |
|
|
default |
◆ vsettings() [3/3]
◆ add_argument()
◆ as_string()
virtual std::string tim::vsettings::as_string |
( |
| ) |
const |
|
pure virtual |
◆ cast() [1/2]
static auto tim::vsettings::cast |
( |
const std::shared_ptr< vsettings > & |
_val | ) |
|
|
inlinestatic |
Definition at line 125 of file vsettings.hpp.
127 return static_cast<const tsettings<decay_t<Tp>, Tp
>*>(_val.get());
◆ cast() [2/2]
static auto tim::vsettings::cast |
( |
std::shared_ptr< vsettings > & |
_val | ) |
|
|
inlinestatic |
Definition at line 119 of file vsettings.hpp.
121 return static_cast<tsettings<decay_t<Tp>, Tp
>*>(_val.get());
◆ clone() [1/2]
virtual std::shared_ptr< vsettings > tim::vsettings::clone |
( |
| ) |
|
|
pure virtual |
◆ clone() [2/2]
virtual void tim::vsettings::clone |
( |
std::shared_ptr< vsettings > |
rhs | ) |
|
|
virtual |
◆ get() [1/2]
std::pair< bool, Tp > tim::vsettings::get |
Definition at line 155 of file vsettings.hpp.
157 auto _ref =
dynamic_cast<const tsettings<Tp, Tp&>*
>(
this);
160 return {
true, _ref->get() };
163 auto _nref =
dynamic_cast<const tsettings<Tp, Tp>*
>(
this);
165 return {
true, _nref->get() };
167 return {
false, Tp{} };
References tim::tsettings< Tp, Vp >::get().
◆ get() [2/2]
bool tim::vsettings::get |
( |
Tp & |
_val | ) |
const |
Definition at line 172 of file vsettings.hpp.
174 auto&&
_ret = this->get<Tp>();
const hash_alias_ptr_t hash_value_t std::string *& _ret
◆ get_action()
◆ get_choices()
const auto & tim::vsettings::get_choices |
( |
| ) |
const |
|
inline |
◆ get_command_line()
const auto & tim::vsettings::get_command_line |
( |
| ) |
const |
|
inline |
◆ get_count()
const auto & tim::vsettings::get_count |
( |
| ) |
const |
|
inline |
◆ get_debug()
static int tim::vsettings::get_debug |
( |
| ) |
|
|
inlinestaticprotected |
Definition at line 131 of file vsettings.hpp.
133 static bool _bool_val =
get_env(
"TIMEMORY_DEBUG_SETTINGS",
false);
134 static int _int_val =
get_env(
"TIMEMORY_DEBUG_SETTINGS", 0);
135 return (_bool_val) ? _int_val : 0;
Tp get_env(const std::string &env_id, Tp _default, bool _store)
References tim::get_env().
Referenced by report_change().
◆ get_description()
const auto & tim::vsettings::get_description |
( |
| ) |
const |
|
inline |
◆ get_display()
virtual display_map_t tim::vsettings::get_display |
( |
std::ios::fmtflags |
fmt = {} , |
|
|
int |
_w = -1 , |
|
|
int |
_p = -1 |
|
) |
| |
|
virtual |
◆ get_env_name()
const auto & tim::vsettings::get_env_name |
( |
| ) |
const |
|
inline |
◆ get_max_count()
const auto & tim::vsettings::get_max_count |
( |
| ) |
const |
|
inline |
◆ get_name()
const auto & tim::vsettings::get_name |
( |
| ) |
const |
|
inline |
◆ get_type_index()
auto tim::vsettings::get_type_index |
( |
| ) |
const |
|
inline |
◆ get_value_index()
auto tim::vsettings::get_value_index |
( |
| ) |
const |
|
inline |
◆ matches()
virtual bool tim::vsettings::matches |
( |
const std::string & |
, |
|
|
bool |
exact = true |
|
) |
| const |
|
virtual |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ parse() [1/2]
virtual void tim::vsettings::parse |
( |
| ) |
|
|
pure virtual |
◆ parse() [2/2]
virtual void tim::vsettings::parse |
( |
const std::string & |
| ) |
|
|
pure virtual |
◆ report_change()
void tim::vsettings::report_change |
( |
Tp |
_old, |
|
|
const Tp & |
_new |
|
) |
| |
|
protected |
Definition at line 203 of file vsettings.hpp.
210 std::ostringstream oss;
211 oss << std::boolalpha;
213 <<
") changed: " << _old <<
" --> " << _new <<
"\n";
216 print_demangled_backtrace<6, 3>(oss);
218 std::cerr << oss.str() << std::flush;
References get_debug(), m_env_name, and m_name.
◆ reset()
virtual void tim::vsettings::reset |
( |
| ) |
|
|
pure virtual |
◆ set() [1/2]
void tim::vsettings::set |
( |
const std::string & |
_val | ) |
|
|
inline |
◆ set() [2/2]
bool tim::vsettings::set |
( |
const Tp & |
_val | ) |
|
◆ set_choices()
void tim::vsettings::set_choices |
( |
const std::vector< std::string > & |
v | ) |
|
|
inline |
◆ set_command_line()
void tim::vsettings::set_command_line |
( |
const std::vector< std::string > & |
v | ) |
|
|
inline |
◆ set_count()
void tim::vsettings::set_count |
( |
int32_t |
v | ) |
|
|
inline |
◆ set_max_count()
void tim::vsettings::set_max_count |
( |
int32_t |
v | ) |
|
|
inline |
◆ m_choices
std::vector<std::string> tim::vsettings::m_choices = {} |
|
protected |
◆ m_cmdline
std::vector<std::string> tim::vsettings::m_cmdline = {} |
|
protected |
◆ m_count
int32_t tim::vsettings::m_count = -1 |
|
protected |
◆ m_description
std::string tim::vsettings::m_description = "" |
|
protected |
◆ m_env_name
std::string tim::vsettings::m_env_name = "" |
|
protected |
◆ m_max_count
int32_t tim::vsettings::m_max_count = -1 |
|
protected |
◆ m_name
std::string tim::vsettings::m_name = "" |
|
protected |
◆ m_type_index
std::type_index tim::vsettings::m_type_index = std::type_index(typeid(void)) |
|
protected |
◆ m_value_index
std::type_index tim::vsettings::m_value_index = std::type_index(typeid(void)) |
|
protected |
The documentation for this struct was generated from the following files: