Loading [MathJax]/extensions/TeX/AMSsymbols.js
Radium Engine  1.6.3
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VariableSetEnumManagement.cpp
1#include <Core/Containers/VariableSet.hpp>
2#include <Core/Containers/VariableSetEnumManagement.hpp>
3#include <Core/Utils/Log.hpp>
4#include <functional>
5#include <map>
6#include <ostream>
7#include <string>
8#include <utility>
9
10namespace Ra {
11namespace Core {
12namespace VariableSetEnumManagement {
13
14void setEnumVariable( VariableSet& vs, const std::string& name, const std::string& value ) {
15 auto converterFunc = vs.existsVariable<
16 std::function<void( Core::VariableSet&, const std::string&, const std::string& )>>( name );
17 if ( converterFunc ) { ( *converterFunc )->second( vs, name, value ); }
18 else {
19 LOG( Core::Utils::logWARNING ) << "VariableSet: try to set enum value from string without "
20 "converter, ignored. Variable name: ["
21 << name << "], value: [" << value << "]";
22 }
23}
24
25void setEnumVariable( VariableSet& vs, const std::string& name, const char* value ) {
26 setEnumVariable( vs, name, std::string( value ) );
27}
28
29} // namespace VariableSetEnumManagement
30} // namespace Core
31} // namespace Ra
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:4