Commit 618591f7 authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

added implementation for to_string and findModule, removed abort for getOperatorName

parent 813bf75b
......@@ -43,6 +43,23 @@ std::map<std::string, module_t> modules;
*/
std::map<std::string, std::string> aliases;
std::string
module_t::toString()
{
std::string inp = streamInCnt > 0 ? std::to_string(streamInCnt) : "Arbitrary";
std::string out = streamOutCnt > 0 ? std::to_string(streamOutCnt) : "Output base";
std::string restriction = "none";
if (restrictions == OnlyFirst) restriction = "Can only be the first operator";
if (restrictions == FilesOnly)
restriction != Green("none") ? restriction = Yellow("Can only use files as input.") : restriction += Yellow(", Can only use files as input");
std::string desc = "Input: " + inp + ", Ouput: " + out + ", Restricton: " + restriction;
return desc;
}
static const char *
getOperatorName(const char *operatorCommand)
{
......@@ -362,12 +379,6 @@ get_module_name_to(const std::string &operatorName)
return modules_map[aliases[operatorName]];
}
}
else
{
// TODO: see if depricated since no operator can be added without a
// module
cdoAbort("Module for >%s< not installed", operatorName.c_str());
}
// Only to quell the warning. Function should never reach this.
return "";
}
......@@ -726,6 +737,22 @@ get_original(const char *operatorName)
return name;
}
std::map<std::string, module_t>::iterator
findModule(const std::string &operator_name)
{
auto modIter = modules_map.end();
std::string operName = operator_name;
auto it = aliases.find(operName);
if (it != aliases.end())
{
operName = it->second;
}
modIter = modules_map.find(operName);
return modules.find(get_module_name_to(operator_name));
}
module_t &
getModule(const std::string &operator_name)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment