]> Creatis software - bbtk.git/commitdiff
#3512 clean bbs2 python version
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 10 Nov 2023 15:57:43 +0000 (16:57 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 10 Nov 2023 15:57:43 +0000 (16:57 +0100)
kernel/appli/bbs2cpp/bbs2.cxx
kernel/src/bbtkComplexBlackBox.cxx
kernel/src/bbtkInterpreterPython.cxx

index 25c1290d8fa93d20c878ccfe606301be0f74edeb..184b48c3f9d6de7d85f78a82b550f75eb80ca013 100644 (file)
@@ -97,18 +97,18 @@ int main(int argc, char* argv[])
              fprintf(ff,"\n" );
              fprintf(ff,"from bbtk.bbtkBlackBox import *\n" );
              fprintf(ff,"\n" );
-             fprintf(ff,"class %s:\n",fileBase.c_str() );
+             fprintf(ff,"class %s(ComplexBlackBox):\n",fileBase.c_str() );
              fprintf(ff,"\n" );
-             fprintf(ff,"    def __init__(self):\n" );
-             fprintf(ff,"        self.mCBpy  =  ComplexBlackBox('%s')\n",file.c_str() );
+             fprintf(ff,"    def __init__(self, nameBox):\n" );
+             fprintf(ff,"        super().__init__(nameBox)\n" );
              fprintf(ff,"\n" );
              fprintf(ff,"    def Run(self):\n" );
              int i,size=pythonBBTK.size();
              for (i=0; i<size;i++)
              {
-                 fprintf(ff,"        self.mCBpy.%s\n", pythonBBTK[i].c_str() );
+                 fprintf(ff,"        self.%s\n", pythonBBTK[i].c_str() );
              }// for i
-             fprintf(ff,"        self.mCBpy.Execute()\n" );
+             fprintf(ff,"        self.Execute()\n" );
              fclose(ff);
          } catch (bbtk::Exception e) {
              e.Print();
index 0e823e0360a5011bc763203e732aa3b3ef813329..c07ba9f383b74ef805b56f208243c17ce8aadb51 100644 (file)
@@ -53,12 +53,9 @@ namespace bbtk
   ComplexBlackBox::Pointer ComplexBlackBox::New(const std::string& name,
                                                ComplexBlackBoxDescriptor::Pointer desc)
   {
-    bbtkDebugMessage("object",1,"##> ComplexBlackBox::New('"<<name<<"','"<<
-                    desc->GetTypeName()<<"')" <<bbtkendl);
-    ComplexBlackBox::Pointer p = 
-      MakeBlackBoxPointer(new ComplexBlackBox(name,desc));
-    bbtkDebugMessage("object",2,"<## ComplexBlackBox::New('"<<name<<"','"<<
-                    desc->GetTypeName()<<"')" <<bbtkendl);
+    bbtkDebugMessage("object",1,"##> ComplexBlackBox::New('"<<name<<"','"<< desc->GetTypeName()<<"')" <<bbtkendl);
+    ComplexBlackBox::Pointer p = MakeBlackBoxPointer(new ComplexBlackBox(name,desc));
+    bbtkDebugMessage("object",2,"<## ComplexBlackBox::New('"<<name<<"','"<< desc->GetTypeName()<<"')" <<bbtkendl);
     return p;
   }
   //==========================================================================
index f13ded800b348677874e61d6ac126b9abf2ca91b..e0daa2cb17c35a3f1620d42156c0354a5c2a958d 100644 (file)
@@ -96,6 +96,8 @@ namespace bbtk
   //=========================================================================
   void InterpreterPython::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string  &help)
   {
+      std::string  code("DECLARE_INPUT('"+name+"','"+box+"."+input+"')");
+      this->pythonBBTK.push_back(code);
   }
   //=========================================================================