//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== #include "bbstdFindOptimalParam.h" #include "bbstdPackage.h" namespace bbstd { BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,FindOptimalParam) BBTK_BLACK_BOX_IMPLEMENTATION(FindOptimalParam,bbtk::AtomicBlackBox); std::string FindOptimalParam::Replace(std::string strCommand, double value) { std::string toReplace = std::to_string( value ); int pos = strCommand.find("XXvalueXX"); if (pos>=0) { strCommand.replace(pos,9,toReplace); } // if pos return strCommand; } int FindOptimalParam::Evaluate( double value ) { int result=-9999; std::string strCommand = Replace( bbGetInputString(), value ); strCommand=strCommand+" NameFileTransfer="+bbGetInputTransferFile(); printf("EED FindOptimalParam::Evaluate command=%s\n", strCommand.c_str()); system( strCommand.c_str() ); FILE *ff = fopen( bbGetInputTransferFile().c_str() , "r"); if (ff!=NULL) { fscanf(ff,"%d",&result); } else { printf("EED Warnning!! FindOptimalParam::Evaluate TransferFile not set.\n"); }// ff fclose(ff); return result; } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void FindOptimalParam::Process() { // THE MAIN PROCESSING METHOD BODY // Here we simply set the input 'In' value to the output 'Out' // And print out the output value // INPUT/OUTPUT ACCESSORS ARE OF THE FORM : // void bbSet{Input|Output}NAME(const TYPE&) // const TYPE& bbGet{Input|Output}NAME() const // Where : // * NAME is the name of the input/output // (the one provided in the attribute 'name' of the tag 'input') // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <