X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fsrc%2FbbtkTranscriptor.cxx;h=0609b5fb065e01d34a41f00a964f0f177436a93b;hb=63005ec659612d567c00bfbb9ecbd62566a3217d;hp=48fffe21e9617add10a461884607ef4f0406b558;hpb=3d97d77f3fd7cfd5f1c75f0cabb7a03585b2f45c;p=bbtk.git diff --git a/kernel/src/bbtkTranscriptor.cxx b/kernel/src/bbtkTranscriptor.cxx index 48fffe2..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 13:53:01 $ - Version: $Revision: 1.3 $ + 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; - 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,32 +135,33 @@ 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(\""<GetPackage(name); + p = GetGlobalFactory()->GetPackage(name); } catch (Exception e) { - p = new Package(name, - "", - "", - "", - BBTK_STRINGIFY_SYMBOL(BBTK_VERSION)); - InsertPackage(p); + p = new Package(name, + "", + "", + "", + BBTK_STRINGIFY_SYMBOL(BBTK_VERSION)); + InsertPackage(p); } mOpenPackage.push_back(p); */ @@ -166,18 +169,19 @@ namespace bbtk void Transcriptor::EndPackage() { - m_Fp << "// ==> EndPackage() called here" << std::endl; + m_Fp << " e->EndPackage( );" << std::endl; // if (mOpenPackage.size()>1) mOpenPackage.pop_back(); } void Transcriptor::Define (const std::string &name, - const std::string &pack, - const std::string &scriptfilename) + 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(\"" @@ -212,7 +215,7 @@ namespace bbtk { try { - p = GetGlobalFactory()->GetPackage(pname); + p = GetGlobalFactory()->GetPackage(pname); } catch (Exception e) { @@ -226,7 +229,7 @@ namespace bbtk } else { - p = mOpenPackage.back(); + p = mOpenPackage.back(); } p->RegisterBlackBox(Current()); @@ -240,7 +243,7 @@ namespace bbtk const std::string& nodeName) { // Current()->Add(nodeType,nodeName);\" - m_Fp << "e->Add(\"" << nodeType << "\", \"" << nodeName << "\");" << std::endl; + m_Fp << " e->Add(\"" << nodeType << "\", \"" << nodeName << "\");" << std::endl; } @@ -249,61 +252,59 @@ namespace bbtk { /// \todo Remove // Current()->RemoveBlackBox(nodeName); - // m_Fp << "e->Remove(" << nodeName << ");" << std::endl; + // m_Fp << " e->Remove(" << nodeName << ");" << std::endl; } - */ + */ /** - * + * */ - void Transcriptor::Connect (const std::string &nodeFrom, - const std::string &outputLabel, - const std::string &nodeTo, - const std::string &inputLabel) + void Transcriptor::Connect (const std::string &nodeFrom, + const std::string &outputLabel, + const std::string &nodeTo, + const std::string &inputLabel) { //Current()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel); - m_Fp << "e->Connect("<< nodeFrom << "\", \"" << outputLabel << "\", \"" + m_Fp << " e->Connect(\""<< nodeFrom << "\", \"" << outputLabel << "\", \"" << nodeTo << "\", \"" << inputLabel<< "\");" << std::endl; } /** - * + * */ 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) { if (!mNoExecMode) { //Current()->GetPrototype()->bbGetBlackBox(nodeName)->bbExecute(true); - m_Fp << "e->GetPrototype()->bbGetBlackBox(\"" << nodeName << "\", true );" << std::endl; + m_Fp << " e->GetPrototype()->bbGetBlackBox(\"" << nodeName << "\", true );" << std::endl; } } else { //Current()->AddToExecutionList(nodeName) ; - m_Fp << "e->AddToExecutionList(\"" << nodeName << "\");" << std::endl; + m_Fp << " e->AddToExecutionList(\"" << nodeName << "\");" << std::endl; } +*/ } - + /** - * + * */ void Transcriptor::DefineInput ( const std::string &name, - const std::string &box, - const std::string &input, - const std::string& help) + const std::string &box, + 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; - + + m_Fp << " e->DefineInput(\""<< name << "\", " << box << ", " + << input << ", \"" << help << "\");" << std::endl; /* // If the input is defined in the Root box @@ -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,17 +354,17 @@ namespace bbtk */ } - + /** * */ void Transcriptor::DefineOutput ( const std::string &name, - const std::string &box, - const std::string &output, - const std::string& help) + const std::string &box, + const std::string &output, + const std::string& help) { // Current()->DefineOutput(name,box,output,help); - m_Fp << "e->DefineOutput(\""<< name << "\", \"" << box << "\", \"" + m_Fp << " e->DefineOutput(\""<< name << "\", \"" << box << "\", \"" << output << "\", \"" << help << "\");" << std::endl; } @@ -372,18 +372,19 @@ namespace bbtk * */ void Transcriptor::Set (const std::string &box, - const std::string &input, - const std::string &value) + const std::string &input, + const std::string &value) { - - m_Fp << "// ==> Set() called here" << 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"); @@ -408,19 +409,20 @@ namespace bbtk } /** - * - */ + * + */ std::string Transcriptor::Get(const std::string &box, - const std::string &output) + 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), @@ -444,7 +446,7 @@ namespace bbtk a->bbDelete(); return r; } - else + else { b->bbExecute(); return b->bbGetOutput(output).unsafe_get(); @@ -454,41 +456,36 @@ namespace bbtk // b->bbSetInput(input,&v); } */ +// EED Windows +return ""; } void Transcriptor::Author(const std::string &authorName) { + + 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 << "\")" << 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 << "\")" << 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()); @@ -540,11 +546,11 @@ namespace bbtk Package* p; try { - p = GetGlobalFactory()->GetPackage(nameblackbox); + p = GetGlobalFactory()->GetPackage(nameblackbox); } catch (Exception e) { - p = mPackage; + p = mPackage; } // Generating documentation-help of workspace p->SetDocURL(filename_rootHtml); @@ -556,51 +562,51 @@ namespace bbtk /* try { - ShowGraphTypes(nameblackbox); + ShowGraphTypes(nameblackbox); } catch (bbtk::Exception a) { - std::cout <<"EXC"<GetPrototype(); + blackbox=Current()->GetPrototype(); } - else + else { - blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox); + blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox); } std::string page; 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 "); @@ -623,7 +629,7 @@ namespace bbtk } blackbox->bbInsertHTMLGraph( s, detail, level, true, directory, false ); - s << "\n"; + s << "\n"; } s.close(); @@ -634,7 +640,6 @@ namespace bbtk { bbtkMessageInc("Help",1,"No black box: \"" <