X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkTranscriptor.cxx;h=0609b5fb065e01d34a41f00a964f0f177436a93b;hb=63005ec659612d567c00bfbb9ecbd62566a3217d;hp=5eee475d6c77c840f87b9c63e1b83255c3afd77d;hpb=53a57e67e61140c33be22645c9d47649bcf96b8d;p=bbtk.git diff --git a/kernel/src/bbtkTranscriptor.cxx b/kernel/src/bbtkTranscriptor.cxx index 5eee475..0609b5f 100644 --- a/kernel/src/bbtkTranscriptor.cxx +++ b/kernel/src/bbtkTranscriptor.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkTranscriptor.cxx,v $ $ Language: C++ - Date: $Date: 2008/02/14 17:40:09 $ - Version: $Revision: 1.4 $ + Date: $Date: 2008/02/18 10:41:02 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -49,27 +49,29 @@ namespace bbtk bbtkDebugMessageInc("Kernel",9,"Transcriptor::Transcriptor()" <UnRegisterBlackBox("workspace"); - delete mRoot; + delete mRoot; } - if (mPackage) + if (mPackage) { GetGlobalFactory()->UnLoadPackage("user"); } @@ -84,16 +86,16 @@ namespace bbtk } -// ========================= Begin of Battelfield ======================================================================== +// ========================= Begin of Battlefield ======================================================================== /** - * + * */ void Transcriptor::Reset() { - m_Fp << " e->Reset( );" << std::endl; + /* bbtkDebugMessageInc("Kernel",9,"Transcriptor::Reset()" <UnRegisterBlackBox(mRoot->GetTypeName()); - delete mRoot; + delete mRoot; } - if (mPackage) + if (mPackage) { GetGlobalFactory()->UnLoadPackage("user"); } @@ -133,16 +135,17 @@ namespace bbtk } /// changes the workspace name - void Transcriptor::SetWorkspaceName( const std::string& n ) + void Transcriptor::SetWorkspaceName( const std::string& name ) { - m_Fp << "// ==> SetWorkspaceName() called here" << std::endl; - // mPackage->ChangeBlackBoxName( mRoot->GetTypeName(), n ); + m_Fp << " e->SetWorkspaceName( \"" << name << "\" );" << std::endl; + + // mPackage->ChangeBlackBoxName( mRoot->GetTypeName(), name ); } void Transcriptor::BeginPackage (const std::string &name) { - m_Fp << "// ==> BeginPackage() called here" << std::endl; + m_Fp << " e->BeginPackage( \"" << name << "\" );" << std::endl; /* bbtkDebugMessageInc("Kernel",9,"Executer::BeginPackage(\""< EndPackage() called here" << std::endl; + m_Fp << " e->EndPackage( );" << std::endl; // if (mOpenPackage.size()>1) mOpenPackage.pop_back(); } @@ -174,10 +177,11 @@ namespace bbtk const std::string &pack, const std::string &scriptfilename) { - m_Fp << "// on Define, Define() called here" << std::endl; + m_Fp << " e->Define(\"" << name << "\", \"" << pack << "\", \"" + << scriptfilename << "\" );" << std::endl; /* bbtkDebugMessageInc("Kernel",9,"Executer::Define(\""<on Include : SetCurrentFileName( ) called here" << std::endl; + m_Fp << " e->SetCurrentFileName( \"" << name << "\" );" << std::endl; // mOpenDefinition.back().box->SetScriptFileName(name); } void Transcriptor::EndDefine () { - m_Fp << "// ==> on EndDefine, EndDefine( ); called here " << std::endl; + m_Fp << " e->EndDefine( );" << std::endl; /* bbtkDebugMessageInc("Kernel",9,"Executer::EndDefine(\"" @@ -251,13 +254,13 @@ namespace bbtk // Current()->RemoveBlackBox(nodeName); // m_Fp << " e->Remove(" << nodeName << ");" << std::endl; } - */ + */ /** - * + * */ - void Transcriptor::Connect (const std::string &nodeFrom, - const std::string &outputLabel, + void Transcriptor::Connect (const std::string &nodeFrom, + const std::string &outputLabel, const std::string &nodeTo, const std::string &inputLabel) { @@ -267,10 +270,13 @@ namespace bbtk } /** - * + * */ void Transcriptor::Update (const std::string &nodeName) // would 'Execute' be more meaningfull ? { + + m_Fp << " e->Update(\"" << nodeName << "\");" << std::endl; +/* // if in root if (Current()==mRoot) { @@ -285,6 +291,7 @@ namespace bbtk //Current()->AddToExecutionList(nodeName) ; m_Fp << " e->AddToExecutionList(\"" << nodeName << "\");" << std::endl; } +*/ } /** @@ -295,16 +302,10 @@ namespace bbtk const std::string &input, const std::string& help) { - // If the input is defined in the Root box - if (Current()==mRoot) - { - m_Fp << "// ==> Some extra work to do when Current()==mRoot" << std::endl; - - } + m_Fp << " e->DefineInput(\""<< name << "\", " << box << ", " << input << ", \"" << help << "\");" << std::endl; - /* // If the input is defined in the Root box if (Current()==mRoot) @@ -343,7 +344,6 @@ namespace bbtk mess += ")"; std::string title(name); title += " ?"; - std::string ans = wx2std ( wxGetTextFromUser( std2wx (mess), std2wx(title))); Set(box,input,ans); } @@ -354,7 +354,7 @@ namespace bbtk */ } - + /** * */ @@ -375,17 +375,16 @@ namespace bbtk const std::string &input, const std::string &value) { - - m_Fp << "// ==> Set() called here" << std::endl; - m_Fp << " e->GetPrototype()->bbGetBlackBox(\""<< box << "\");" << std::endl; - + m_Fp << " e->Set(\""<< box << "\", \"" << input<< "\", \"" << value << "\");" + << std::endl; + /* BlackBox* b = Current()->GetPrototype()->bbGetBlackBox(box); // Looks for the adaptor if ( b->bbGetInputType(input) != typeid(std::string) ) { - BlackBox* a = + BlackBox* a = NewAdaptor(typeid(std::string), b->bbGetInputType(input), "tmp"); @@ -410,19 +409,20 @@ namespace bbtk } /** - * - */ + * + */ std::string Transcriptor::Get(const std::string &box, const std::string &output) { - m_Fp << "// ==> Get() called here" << std::endl; + m_Fp << " e->Get(\""<< box << "\", \"" << output << "\");" + << std::endl; /* BlackBox* b = Current()->GetPrototype()->bbGetBlackBox(box); // Looks for the adaptor if (b->bbGetOutputType(output) != typeid(std::string)) { - BlackBox* a = + BlackBox* a = NewAdaptor( b->bbGetOutputType(output), typeid(std::string), @@ -446,7 +446,7 @@ namespace bbtk a->bbDelete(); return r; } - else + else { b->bbExecute(); return b->bbGetOutput(output).unsafe_get(); @@ -456,47 +456,36 @@ namespace bbtk // b->bbSetInput(input,&v); } */ +// EED Windows +return ""; } void Transcriptor::Author(const std::string &authorName) { - m_Fp << " e->AddToAuthor(\"" << authorName << "\", true)" << std::endl; + + m_Fp << " e->AddToAuthor(\"" << authorName << "\")" << std::endl; return; // just to see + //Current()->AddToAuthor(authorName,Current()==mRoot); - if (Current()==mRoot) - m_Fp << " e->AddToAuthor(\"" << authorName << "\", true)" << std::endl; - else - m_Fp << " e->AddToAuthor(\"" << authorName << "\", false)" << std::endl; } void Transcriptor::Category(const std::string &category) { - m_Fp << " e->AddToCategory(\"" << category << "\", true)" << std::endl; - return; // just to see + m_Fp << " e->AddToCategory(\"" << category << "\")" << std::endl; //Current()->AddToCategory(category,Current()==mRoot); - if (Current()==mRoot) - m_Fp << " e->AddToCategory(\"" << category << "\", true)" << std::endl; - else - m_Fp << " e->AddToCategory(\"" << category << "\", false)" << std::endl; } void Transcriptor::Description(const std::string &d) { - m_Fp << " e->AddToDescription(\"" << d << "\", true)" << std::endl; - return; // just to see + m_Fp << " e->AddToDescription(\"" << d << "\")" << std::endl; // Current()->AddToDescription(d,Current()==mRoot); - if (Current()==mRoot) - m_Fp << " e->AddToDescription(\"" << d << "\", true)" << std::endl; - else - m_Fp << " e->AddToDescription(\"" << d << "\", false)" << std::endl; } - /// prints the list of the boxes of the current descriptor void Transcriptor::PrintBoxes() - { - m_Fp << "// ==> :PrintBoxes() called here" << std::endl; + { + m_Fp << " e->PrintBoxes( )" << std::endl; /* bbtkMessageInc("Help",1,"The black box descriptor \"" <GetTypeName()<<"\" contains : "<DefineOutput(\"" << nameblackbox << "\", \"" + << detailStr << "\", \"" + << levelStr << "\", \"" + << output_html << "\", \"" + << custom_header << "\", \"" + << custom_title << "\");" + << std::endl; + /* int detail = atoi(detailStr.c_str()); int level = atoi(levelStr.c_str()); @@ -572,7 +570,8 @@ namespace bbtk page = ShowGraphInstances(nameblackbox,detail,level,system_display); } */ - return page; + //return page; + return ""; // to avoid warnings } /// Generate a png file with the actual pipeline (Graphviz-dot needed) @@ -585,7 +584,7 @@ namespace bbtk { blackbox=Current()->GetPrototype(); } - else + else { blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox); } @@ -594,21 +593,20 @@ namespace bbtk if (blackbox) { - // Don't pollute the file store with "temp_dir" directories ... + // 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 + "temp_dir"; - + 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 "); @@ -631,7 +629,7 @@ namespace bbtk } blackbox->bbInsertHTMLGraph( s, detail, level, true, directory, false ); - s << "\n"; + s << "\n"; } s.close(); @@ -642,7 +640,6 @@ namespace bbtk { bbtkMessageInc("Help",1,"No black box: \"" <