1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
/***********************************************/
/**
* @file parameterNamesRename.h
*
* @brief Single parameter name.
*
* @author Torsten Mayer-Guerr
* @date 2020-05-29
*/
/***********************************************/
#ifndef __GROOPS_PARAMETERNAMESRENAME__
#define __GROOPS_PARAMETERNAMESRENAME__
// Latex documentation
static const char *docstringParameterNamesRename = R"(
\subsection{Rename}
Replaces parts of \configClass{parameterName}{parameterNamesType}s.
The star "\verb|*|" left this part untouched.
)";
/***********************************************/
#include "base/import.h"
#include "config/config.h"
#include "classes/parameterNames/parameterNames.h"
/***** CLASS ***********************************/
/** @brief Single parameter name.
* @ingroup parameterNamesGroup
* @see ParameterNames */
class ParameterNamesRename : public ParameterNamesBase
{
public:
ParameterNamesRename(Config &config)
{
try
{
ParameterNamesPtr parameterNames;
std::string object, type, temporal, interval;
readConfig(config, "parameterName", parameterNames, Config::MUSTSET, "", "");
readConfig(config, "object", object, Config::OPTIONAL, "*", "*: left this part untouched, object");
readConfig(config, "type", type, Config::OPTIONAL, "*", "*: left this part untouched, type");
readConfig(config, "temporal", temporal, Config::OPTIONAL, "*", "*: left this part untouched, temporal representation");
readConfig(config, "interval", interval, Config::OPTIONAL, "*", "*: left this part untouched, interval/epoch");
if(isCreateSchema(config)) return;
names = parameterNames->parameterNames();
for(auto &name : names)
{
if(object != "*") name.object = object;
if(type != "*") name.type = type;
if(temporal != "*") name.temporal = temporal;
if(interval != "*") name.interval = interval;
}
}
catch(std::exception &e)
{
GROOPS_RETHROW(e)
}
}
};
/***********************************************/
#endif /* __GROOPS__ */
|