10 _name(details::convert<void*>::to_string(this)) {
12 _logger->setLevel(
"MESSAGE" ) ;
48 return log<loglevel::DEBUG>() ;
54 return log<loglevel::MESSAGE>() ;
60 return log<loglevel::WARNING>() ;
66 return log<loglevel::ERROR>() ;
119 printParameters<MESSAGE>() ;
126 for(
auto n : names ) {
129 iter->second->str( section.
parameter<std::string>( n ) ) ;
131 else if( throwIfNotFound ) {
132 MARLINMT_THROW(
"Input parameter '" + n +
"' from section '" + section.
name() +
"' can't be set (not found)" ) ;
140 auto &metadata = section.
metadata() ;
142 metadata[
"name"] =
name() ;
143 metadata[
"type"] =
type() ;
145 if( exclude.end() != exclude.find( iter.first ) ) {
148 auto value = iter.second->hasDefault() ? iter.second->defaultStr() :
"" ;
150 metadata[ iter.first +
".description" ] = iter.second->description() ;
151 metadata[ iter.first +
".optional" ] = iter.second->hasDefault() ?
"true" :
"false" ;
const Metadata & metadata() const
Get the section metadata.
Logging::StreamType error() const
Shortcut for log<ERROR>()
static Logger createLogger(const std::string &name)
Create a standalone logger instance.
T parameter(const std::string &n) const
Get a parameter value as type T.
std::string _type
The component type.
Logging::StreamType debug() const
Shortcut for log<DEBUG>()
const std::string & name() const
Get the component name.
Application * _application
The application in which the component has been registered.
const std::string & name() const
Get the section name.
std::vector< std::string > parameterNames() const
Get the list of parameter names.
Logger createLogger(const std::string &name) const
Create a new logger instance.
void setup(Application *app)
Setup the component.
void setName(const std::string &n)
Set the component name.
std::string _name
The component name.
void setParameters(const ConfigSection §ion, bool throwIfNotFound=false)
Set the parameters from the configuration section.
LoggerPtr _logger
The logger instance.
constexpr unsigned long long value(const Flag_t &flag)
Logging::StreamType message() const
Shortcut for log<MESSAGE>()
Component()=delete
No default constructor.
const std::string & type() const
Get the component name.
Logger::element_type::stream_type StreamType
std::string _description
The component description.
void setDescription(const std::string &desc)
Set the component description.
const std::string & description() const
Get the component description.
#define MARLINMT_THROW(message)
Application class Base application interface for running a Marlin application.
void setVerbosity(const std::string &level)
Set the verbosity level.
const Application & application() const
Get the application in which the component is registered.
bool isInitialized() const
Whether the component has been initialized.
StringParameter _verbosity
The verbosity level of the logger (parameter)
T get() const
Get the parameter value.
ConfigSection & setParameter(const std::string &n, const T &val)
Set a parameter value.
const std::string & verbosity() const
Get the verbosity level.
virtual void initialize()
Initialize the component.
ConfigSection class Holds a set of parameters and subsection.
void getParameters(ConfigSection §ion, const std::set< std::string > &exclude={}) const
Get the parameters from configurable object and populate the config section with. ...
void printParameters() const
Print the component parameters.
ParameterMap _parameters
The parameter map.
bool isSet() const
Whether the parameter has been set.
Logging::StreamType warning() const
Shortcut for log<WARNING>()