X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkExecuter.cxx;h=7564baf85337198a81111d65f2c6478aef454ea2;hb=fe455ba4df3ec334ad809d82a51f261f1edcd343;hp=8348d062a47182452edb6871997a98b50749de8d;hpb=71376d8384d5d21b5c56d36ecc8cbf31315c039a;p=bbtk.git diff --git a/kernel/src/bbtkExecuter.cxx b/kernel/src/bbtkExecuter.cxx index 8348d06..7564baf 100644 --- a/kernel/src/bbtkExecuter.cxx +++ b/kernel/src/bbtkExecuter.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkExecuter.cxx,v $ $ Language: C++ - Date: $Date: 2008/02/05 13:23:46 $ - Version: $Revision: 1.7 $ + Date: $Date: 2008/02/14 11:38:58 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -37,7 +37,7 @@ namespace bbtk { /** - * + * */ Executer::Executer() : mPackage(0), @@ -53,7 +53,7 @@ namespace bbtk } /** - * + * */ Executer::~Executer() { @@ -61,9 +61,9 @@ namespace bbtk if (mRoot) { mPackage->UnRegisterBlackBox("workspace"); - delete mRoot; + delete mRoot; } - if (mPackage) + if (mPackage) { GetGlobalFactory()->UnLoadPackage("user"); } @@ -72,7 +72,7 @@ namespace bbtk /** - * + * */ void Executer::Reset() { @@ -84,10 +84,10 @@ namespace bbtk // all user defined CBB otherwise any instance // of a user CBB that is in the 'workspace' would try to // access a user CBB descriptor which has been previously freed - if (mRoot) + if (mRoot) { mPackage->UnRegisterBlackBox(mRoot->GetTypeName()); - delete mRoot; + delete mRoot; } if (mPackage) { @@ -111,7 +111,7 @@ namespace bbtk mOpenPackage.push_back(mPackage); bbtkDebugDecTab("Kernel",9); } - + /// changes the workspace name void Executer::SetWorkspaceName( const std::string& n ) { @@ -159,6 +159,13 @@ namespace bbtk bbtkDebugDecTab("Kernel",9); } + /// Sets the file name to use for the current definition + /// (Used to set it after the Define command) + void Executer::SetCurrentFileName (const std::string &name ) + { + mOpenDefinition.back().box->SetScriptFileName(name); + } + void Executer::EndDefine () { bbtkDebugMessageInc("Kernel",9,"Executer::EndDefine(\"" @@ -198,20 +205,19 @@ namespace bbtk { Current()->Add(nodeType,nodeName); } - /* void Executer::Remove (const std::string &nodeName) { // Current()->RemoveBlackBox(nodeName); } - */ + */ /** - * + * */ void Executer::Connect (const std::string &nodeFrom, - const std::string &outputLabel, + const std::string &outputLabel, const std::string &nodeTo, const std::string &inputLabel) { @@ -219,7 +225,7 @@ namespace bbtk } /** - * + * */ void Executer::Update (const std::string &nodeName) // would 'Execute' be more meaningfull ? { @@ -236,9 +242,9 @@ namespace bbtk Current()->AddToExecutionList(nodeName) ; } } - + /** - * + * */ void Executer::DefineInput ( const std::string &name, const std::string &box, @@ -282,7 +288,6 @@ namespace bbtk mess += ")"; std::string title(name); title += " ?"; - std::string ans = wx2std ( wxGetTextFromUser( std2wx (mess), std2wx(title))); Set(box,input,ans); } @@ -292,7 +297,7 @@ namespace bbtk Current()->DefineInput(name,box,input,help); } - + /** * */ @@ -340,8 +345,8 @@ namespace bbtk } /** - * - */ + * + */ std::string Executer::Get(const std::string &box, const std::string &output) { @@ -373,7 +378,7 @@ namespace bbtk a->bbDelete(); return r; } - else + else { b->bbExecute(); return b->bbGetOutput(output).unsafe_get(); @@ -429,14 +434,14 @@ namespace bbtk // No output provided : automatic generation if (output_html.length() == 0) { - // Don't pollute the file store with "doc_tmp" directories ... - std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_doc_tmp(); + // Don't pollute the file store with "temp_dir" directories ... + std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1]; std::string directory = default_doc_dir; if (c != '/' && c !='\\') directory = directory + "/"; - directory = directory + "doc_tmp"; + directory = directory + "temp_dir"; filename_rootHtml = directory + "/" + "User.html"; simplefilename_rootHtml = "User.html" ; @@ -489,7 +494,7 @@ namespace bbtk { blackbox=Current()->GetPrototype(); } - else + else { blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox); } @@ -498,21 +503,20 @@ namespace bbtk if (blackbox) { - // Don't pollute the file store with "doc_tmp" directories ... - std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_doc_tmp(); + // Don't pollute the file store with "temp_dir" directories ... + std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1]; - + std::string directory = default_doc_dir; if (c != '/' && c !='\\') directory = directory + "/"; - directory = directory + "doc_tmp"; - - //std::string directory("doc_tmp"); + directory = directory + "temp_dir"; + //std::string directory("temp_dir"); std::string filename(directory + "/" + "bbtk_graph_pipeline"); std::string filename_html(filename+".html"); std::string command0("mkdir \""+directory + "\""); -#if defined(_WIN32) +#if defined(_WIN32) std::string command2("start "); #else std::string command2("gnome-open "); @@ -535,7 +539,7 @@ namespace bbtk } blackbox->bbInsertHTMLGraph( s, detail, level, true, directory, false ); - s << "\n"; + s << "\n"; } s.close(); @@ -546,7 +550,6 @@ namespace bbtk { bbtkMessageInc("Help",1,"No black box: \"" <