39void Module::swap(
const Module &mod)
43 strName = mod.strName;
44 arguments = mod.arguments;
45 strVersion = mod.strVersion;
46 strDescription = mod.strDescription;
47 strHost = mod.strHost;
48 bForced = mod.bForced;
49 authors = mod.authors;
50 outputs = mod.outputs;
52 strXmlFile = mod.strXmlFile;
53 strParam = mod.strParam;
54 strWorkDir = mod.strWorkDir;
55 strStdio = mod.strStdio;
56 strBroker = mod.strBroker;
57 bNeedDeployer = mod.bNeedDeployer;
58 strPrefix = mod.strPrefix;
59 strEnvironment = mod.strEnvironment;
60 strBasePrefix = mod.strBasePrefix;
61 strDisplay = mod.strDisplay;
62 modOwner = mod.modOwner;
63 waitStart = mod.waitStart;
64 waitStop = mod.waitStop;
77 auto* mod =
new Module(*
this);
84 arguments.push_back(argument);
91 auto itr = findArgument(argument);
92 if (itr == arguments.end()) {
103 outputs.push_back(output);
112 auto itr = findOutput(output);
113 if (itr == outputs.end()) {
124 inputs.push_back(input);
133 auto itr = findInput(input);
134 if (itr == inputs.end()) {
145 newres->setOwner(
this);
146 resources.push_back(newres);
153 auto itr = findResource(res);
154 if (itr == resources.end()) {
157 resources.erase(itr);
165 for (itr = authors.begin(); itr < authors.end(); itr++) {
179 for (itr = arguments.begin(); itr < arguments.end(); itr++) {
180 if ((*itr) == argument) {
184 return arguments.end();
191 for (itr = inputs.begin(); itr < inputs.end(); itr++) {
192 if ((*itr) == input) {
203 for (itr = outputs.begin(); itr < outputs.end(); itr++) {
204 if ((*itr) == output) {
208 return outputs.end();
214 for (itr = resources.begin(); itr < resources.end(); itr++) {
215 if (*(*itr) == res) {
219 return resources.end();
229 strDescription.clear();
232 bNeedDeployer =
false;
242 strEnvironment.clear();
243 strBasePrefix.clear();
245 for(
auto& resource : resources)
251 waitStart = waitStop = 0.0;
262 for(itr=arguments.begin(); itr<arguments.end(); itr++)
265 bool ret = getParamValue((*itr).getParam(), (*itr).isSwitch(), strVal);
269 msg<<
"Error in parsing parameters of "<<
getName() \
270 <<
". ( '"<< (*itr).getParam()<<
"' is not correct. )";
276 if ((*itr).isSwitch()) {
277 (*itr).setValue(strVal.c_str());
279 if (strVal !=
"off") {
280 (*itr).setValue(strVal.c_str());
288bool Module::getParamValue(
const char* key,
bool bSwitch, std::string ¶m)
295 std::string strKey = std::string(
"--") + std::string(key);
296 size_t pos = strParam.find(strKey);
297 if(pos == std::string::npos)
310 pos += strKey.size();
311 if ((pos >= strParam.length()) || (strParam.at(pos) !=
' ')) {
316 while(strParam.at(pos++) ==
' ')
318 if (pos >= strParam.length()) {
325 while ((pos2 < strParam.length()) && (strParam.at(pos2) !=
' ')) {
328 param = strParam.substr(pos, pos2-pos);
Singleton class ErrorLogger.
void addWarning(const char *szWarning)
static ErrorLogger * Instance()
Singleton class ErrorLogger.
bool removeInput(InputData &input)
bool removeOutput(OutputData &output)
bool removeResource(GenericResource &res)
bool removeAuthor(Author &author)
int resourceCount() const
bool removeArgument(Argument &argument)
bool setParam(const char *szParam)
void setName(const char *szName)
bool addArgument(Argument &arg)
Module & operator=(const Module &rhs)
GenericResource & getResourceAt(int index) const
bool addInput(InputData &input)
bool addResource(GenericResource &res)
bool addOutput(OutputData &output)
std::vector< Author >::iterator AuthorIterator
std::vector< GenericResource * >::iterator ResourcePIterator
std::vector< InputData >::iterator InputIterator
std::stringstream OSTRINGSTREAM
std::vector< OutputData >::iterator OutputIterator
std::vector< Argument >::iterator ArgumentIterator
#define __CHECK_NULLPTR(_ptr)