I->InterpretFile(argv[1]);
std::vector<std::string> pythonBBTK= ((bbtk::InterpreterPython*)(I.get()))->pythonBBTK ;
FILE *ff=fopen(file.c_str(),"w+");
+ fprintf(ff,"\n" );
fprintf(ff,"from bbtk.bbtkBlackBox import *\n" );
+ fprintf(ff,"\n" );
fprintf(ff,"class %s:\n",fileBase.c_str() );
+ fprintf(ff,"\n" );
+ fprintf(ff," def __init__(self):\n" );
+ fprintf(ff," self.mCBpy = ComplexBlackBox('appliTest03')\n" );
+ fprintf(ff,"\n" );
fprintf(ff," def Run(self):\n" );
- fprintf(ff," mCBpy = ComplexBlackBox('%s')\n",fileBase.c_str());
int i,size=pythonBBTK.size();
for (i=0; i<size;i++)
{
- fprintf(ff," mCBpy.%s\n", pythonBBTK[i].c_str() );
+ fprintf(ff," self.mCBpy.%s\n", pythonBBTK[i].c_str() );
}// for i
- fprintf(ff," mCBpy.Execute()\n" );
+ fprintf(ff," self.mCBpy.Execute()\n" );
fclose(ff);
} catch (bbtk::Exception e) {
e.Print();
* \brief Class bbtk::BBPInterpreter
*/
-
#include "bbtkInterpreterPython.h"
#include "bbtkExecuter.h"
}
//=========================================================================
-
-
//=========================================================================
InterpreterPython::InterpreterPython()
{
}
//=========================================================================
-
//=========================================================================
/// Creates a new black box in current complex box
void InterpreterPython::commandNew( const std::string& boxType, const std::string& boxName) // virtual
}
//=========================================================================
-
//=========================================================================
/// Connects the output boxOutput to the input boxInput
void InterpreterPython::commandConnection (const std::string &boxfrom,
//=========================================================================
void InterpreterPython::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string &help)
{
+ std::string code("DECLARE_OUTPUT('"+name+"','"+box+"."+output+"')");
+ this->pythonBBTK.push_back(code);
}
//=========================================================================
-
//=========================================================================
/// sets the input of the box with the value
void InterpreterPython::commandSet(const std::string &box,const std::string &input,const std::string &value) // virtual
}
//=========================================================================
-
//=========================================================================
void InterpreterPython::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual
{
BBTK_BEGIN_DESCRIBE_BLACK_BOX(FilesFromDirectory,bbtk::AtomicBlackBox);
BBTK_NAME("FilesFromDirectory");
BBTK_AUTHOR("jpr@creatis.univ-lyon1.fr");
- BBTK_DESCRIPTION("returns the fullPathNames of the files in a Directory");
+ BBTK_DESCRIPTION("returns the fullPathNames of the files in a Directory (C++,Python)");
BBTK_CATEGORY("");
BBTK_INPUT(FilesFromDirectory,Active,"(default true) Active true/false ",bool,"");