MeteoIODoc 20241222.207bde49
mio::ACDD::ACDD_ATTR Struct Reference

Detailed Description

This structure provides low level functions to handle and store individual ACDD fields.

It is designed to retrieve ACDD values from configuration keys (including from a file pointed to by such a key), from a default value provided to the constructor or as provided by the user. Several modes of combining these different sources can be chosen from.

#include <libacdd.h>

Public Member Functions

 ACDD_ATTR ()
 
 ACDD_ATTR (const std::string &i_name, const std::string &i_cfg_key, const std::string &i_default_value="")
 
 ACDD_ATTR (const std::string &i_name, const std::string &i_value, const std::string &i_cfg_key, const std::string &i_default_value)
 
std::string getValue () const
 
std::string getName () const
 
void setUserConfig (const mio::Config &cfg, const std::string &section, const bool &allow_multi_line)
 Set the value of the attribute, either from a config file key, or from an environment variable of the same name or some hard-coded default value (in this order of priorities). The key "ACDD_SUMMARY" is handled in a special way: if an "ACDD_SUMMARY_FILE" key is found, the file pointed to by the later will be read and copied into ACDD_SUMMARY. Line breaks are either kept as such or converted to a single white space, depending on the parameter allow_multi_line More...
 
void setValue (const std::string &i_value, const Mode &mode=MERGE)
 Set an ACDD value. More...
 
bool isDefault () const
 

Constructor & Destructor Documentation

◆ ACDD_ATTR() [1/3]

mio::ACDD::ACDD_ATTR::ACDD_ATTR ( )
inline

◆ ACDD_ATTR() [2/3]

mio::ACDD::ACDD_ATTR::ACDD_ATTR ( const std::string &  i_name,
const std::string &  i_cfg_key,
const std::string &  i_default_value = "" 
)
inline

◆ ACDD_ATTR() [3/3]

mio::ACDD::ACDD_ATTR::ACDD_ATTR ( const std::string &  i_name,
const std::string &  i_value,
const std::string &  i_cfg_key,
const std::string &  i_default_value 
)
inline

Member Function Documentation

◆ getName()

std::string mio::ACDD::ACDD_ATTR::getName ( ) const
inline

◆ getValue()

std::string mio::ACDD::ACDD_ATTR::getValue ( ) const
inline

◆ isDefault()

bool mio::ACDD::ACDD_ATTR::isDefault ( ) const
inline

◆ setUserConfig()

void mio::ACDD::acdd_attrs::setUserConfig ( const mio::Config cfg,
const std::string &  section,
const bool &  allow_multi_line 
)

Set the value of the attribute, either from a config file key, or from an environment variable of the same name or some hard-coded default value (in this order of priorities). The key "ACDD_SUMMARY" is handled in a special way: if an "ACDD_SUMMARY_FILE" key is found, the file pointed to by the later will be read and copied into ACDD_SUMMARY. Line breaks are either kept as such or converted to a single white space, depending on the parameter allow_multi_line

Parameters
[in]cfgThe configuration file to read the keys from (for the attributes that can be set from such a config key)
[in]sectionSection in the configuration file to read the keys from
[in]allow_multi_lineIf an "ACDD_SUMMARY_FILE" is set, either keep line breaks in the file it points to or replace them by spaces.

◆ setValue()

void mio::ACDD::acdd_attrs::setValue ( const std::string &  i_value,
const Mode mode = MERGE 
)

Set an ACDD value.

Several modes of setting a value can be configured: MERGE (only set the provided value if the variable was previously empty), APPEND, REPLACE (overwrite any previous value with the new one).

Parameters
[in]i_valueNew value to set
[in]modeChosen mode, either MERGE, APPEND or REPLACE

The documentation for this struct was generated from the following files: