X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkExecuter.cxx;h=2bb24d8e12b8eec87092a6d6b6056a061313c206;hb=51be19a0b4d980ef0bdcbbfc5c8255d811de1883;hp=bd715119fffa4b453dc59b9308bd339e19b36632;hpb=2d76cd309d74d5f83d701d6bb0a4140d5d122b36;p=bbtk.git diff --git a/kernel/src/bbtkExecuter.cxx b/kernel/src/bbtkExecuter.cxx index bd71511..2bb24d8 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/01/30 09:28:15 $ - Version: $Revision: 1.4 $ + Date: $Date: 2008/02/06 10:53:02 $ + Version: $Revision: 1.9 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -20,11 +20,10 @@ * \brief class Executer: level 0 of script execution (code) */ -#include "bbtkExecuter.h" +#include "bbtkExecuter.h" #include "bbtkMessageManager.h" #include "bbtkFactory.h" #include "bbtkUtilities.h" - #include #ifdef _USE_WXWIDGETS_ @@ -40,7 +39,7 @@ namespace bbtk /** * */ - Executer::Executer() + Executer::Executer() : mPackage(0), mRoot(0), mNoExecMode(false), @@ -48,17 +47,17 @@ namespace bbtk { //VirtualExec(); - bbtkDebugMessageInc("Core",9,"Executer::Executer()" <UnRegisterBlackBox("workspace"); @@ -68,7 +67,7 @@ namespace bbtk { GetGlobalFactory()->UnLoadPackage("user"); } - bbtkDebugDecTab("Core",9); + bbtkDebugDecTab("Kernel",9); } @@ -77,7 +76,7 @@ namespace bbtk */ void Executer::Reset() { - bbtkDebugMessageInc("Core",9,"Executer::Reset()" <SetScriptFileName(scriptfilename); mOpenDefinition.push_back( CBBDefinition( b, pack ) ); - bbtkDebugDecTab("Core",9); + 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("Core",9,"Executer::EndDefine(\"" + bbtkDebugMessageInc("Kernel",9,"Executer::EndDefine(\"" <GetTypeName()<<"\")" <0) + { + try { - try - { - p = GetGlobalFactory()->GetPackage(pname); + p = GetGlobalFactory()->GetPackage(pname); } - catch (Exception e) + catch (Exception e) { - p = new Package(pname, + p = new Package(pname, "", "", "", BBTK_STRINGIFY_SYMBOL(BBTK_VERSION)); - InsertPackage(p); - } - } - else - { - p = mOpenPackage.back(); + InsertPackage(p); } + } + else + { + p = mOpenPackage.back(); + } p->RegisterBlackBox(Current()); - + mOpenDefinition.pop_back(); } @@ -204,7 +210,7 @@ namespace bbtk /* void Executer::Remove (const std::string &nodeName) - { + { // Current()->RemoveBlackBox(nodeName); } */ @@ -217,9 +223,9 @@ namespace bbtk const std::string &nodeTo, const std::string &inputLabel) { - Current()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel); + Current()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel); } - + /** * */ @@ -290,9 +296,9 @@ namespace bbtk } #endif } - + Current()->DefineInput(name,box,input,help); - + } /** @@ -305,7 +311,7 @@ namespace bbtk { Current()->DefineOutput(name,box,output,help); } - + /** * */ @@ -392,9 +398,9 @@ namespace bbtk Current()->AddToAuthor(authorName,Current()==mRoot); } - void Executer::Keyword(const std::string &keyword) + void Executer::Category(const std::string &category) { - Current()->AddToKeyword(keyword,Current()==mRoot); + Current()->AddToCategory(category,Current()==mRoot); } void Executer::Description(const std::string &d) @@ -412,7 +418,6 @@ namespace bbtk bbtkDecTab("Help",1); } - std::string Executer::ShowGraph(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr, @@ -421,7 +426,6 @@ namespace bbtk const std::string &custom_title, bool system_display ) { - int detail = atoi(detailStr.c_str()); int level = atoi(levelStr.c_str()); @@ -433,52 +437,52 @@ 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" ; // Creating directory std::string command0("mkdir \"" +directory + "\""); - system( command0.c_str() ); + system( command0.c_str() ); relative_link = false; } - + Package* p; - try - { - p = GetGlobalFactory()->GetPackage(nameblackbox); - } + try + { + p = GetGlobalFactory()->GetPackage(nameblackbox); + } catch (Exception e) - { - p = mPackage; - } + { + p = mPackage; + } // Generating documentation-help of workspace p->SetDocURL(filename_rootHtml); p->SetDocRelativeURL(simplefilename_rootHtml); p->CreateHtmlPage(filename_rootHtml,"bbi","user package",custom_header,custom_title,detail,level,relative_link); - + std::string page = filename_rootHtml; /* try - { - ShowGraphTypes(nameblackbox); - } - catch (bbtk::Exception a) - { - std::cout <<"EXC"<GetPrototype(); - } + { + blackbox=Current()->GetPrototype(); + } else - { - blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox); - } + { + blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox); + } std::string page; 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"; + directory = directory + "temp_dir"; - //std::string directory("doc_tmp"); + //std::string directory("temp_dir"); std::string filename(directory + "/" + "bbtk_graph_pipeline"); std::string filename_html(filename+".html"); std::string command0("mkdir \""+directory + "\""); @@ -554,7 +558,6 @@ namespace bbtk } return page; } - void Executer::ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr) { @@ -584,12 +587,12 @@ void Executer::ShowRelations(const std::string &nameblackbox, const std::string /* /// sets the level of message - void Executer::Message(const std::string &category, + void Executer::Message(const std::string &kind, const std::string& level) { int l; sscanf(level.c_str(),"%d",&l); - bbtk::MessageManager::SetMessageLevel(category,l); + bbtk::MessageManager::SetMessageLevel(kind,l); } */