Commit a47b1f9f authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

added check for FIRST_ONLY flag, added debug function getStackAsString, added...

added check for FIRST_ONLY flag, added debug function getStackAsString, added handling of OperatorNotFirst error
parent 4acd5e15
......@@ -9,7 +9,7 @@
#ifdef HAVE_LIBPTHREAD
static pthread_mutex_t processMutex = PTHREAD_MUTEX_INITIALIZER;
#endif
static std::string parse_err_msg = "";
void
ProcessManager::runProcesses()
{
......@@ -169,6 +169,23 @@ ProcessManager::createProcesses(int argc, const char **argv)
}
validateProcesses();
}
#include <algorithm>
std::string getStackAsString(std::stack<Process*> p_stack)
{
std::string stackString = "";
std::vector<std::string> strVec;
while(!p_stack.empty())
{
strVec.push_back(p_stack.top()->operatorName);
p_stack.pop();
}
std::reverse(strVec.begin(), strVec.end());
for (auto strEle : strVec)
{
stackString += " " + strEle;
}
return stackString;
}
/* comment FOR DEVELOPERS ONLY (do not include in docu)
*
......@@ -245,6 +262,7 @@ ProcessManager::createProcessesFromInput(int argc, const char **argv)
processStack.push(root_process);
while (!processStack.empty() && idx < lastNonOutputIdx)
{
Debug(PROCESS, "%s", getStackAsString(processStack));
currentProcess = processStack.top();
Debug(PROCESS, "iteration %d, current argv:%s ,currentProcess: ", idx, argv[idx], currentProcess->m_operatorCommand);
......@@ -255,6 +273,11 @@ ProcessManager::createProcessesFromInput(int argc, const char **argv)
{
Debug(PROCESS, "Found new Operator: %s", argvEntry);
currentProcess = addProcess(currentProcess, argvEntry);
if (currentProcess->m_module.onlyFirst == true)
{
parse_err_msg += "Operator " + std::string(argvEntry) +" can only be used if it is first in the operator chain";
return ParseStatus::OperatorNotFirst;
}
processStack.push(currentProcess);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
......@@ -341,6 +364,11 @@ ProcessManager::handleParseError(ParseStatus p_errCode)
cdoAbort("Missing out file for first operator");
break;
}
case ParseStatus::OperatorNotFirst:
{
cdoAbort("%s",parse_err_msg);
break;
}
case ParseStatus::Ok:
{
return;
......
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