/*========================================================================= Program: bbtk Module: $RCSfile: bbtkTranscriptor.cxx,v $ $ Language: C++ Date: $Date: 2008/03/26 08:27:19 $ Version: $Revision: 1.8 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ /** * \file * \brief class Transcriptor: level 0 of script execution (code) */ #include "bbtkTranscriptor.h" #include "bbtkMessageManager.h" #include "bbtkFactory.h" #include "bbtkUtilities.h" #include //#ifdef _USE_WXWIDGETS_ //#include //#endif //#include "bbtkWxBlackBox.h" #include "bbtkConfigurationFile.h" namespace bbtk { /** * */ Transcriptor::Transcriptor(std::string filename) : mPackage(0), mRoot(0), mNoExecMode(false), mDialogMode(NoDialog) { //VirtualExec(); bbtkDebugMessageInc("Kernel",9,"Transcriptor::Transcriptor()" <UnRegisterBlackBox("workspace"); delete mRoot; } if (mPackage) { //GetGlobalFactory()->UnLoadPackage("user"); } if(m_Fp) { bbtkDebugDecTab("Kernel",9); m_Fp << " }" << std::endl; m_Fp.close(); // delete m_Fp; } } // ================= Begin of Battlefield ============================= void Transcriptor::Reset() { m_Fp << " e->Reset( );" << std::endl; } void Transcriptor::SetWorkspaceName( const std::string& name ) { m_Fp << " e->SetWorkspaceName( \"" << name << "\" );" << std::endl; } void Transcriptor::BeginPackage (const std::string &name) { m_Fp << " e->BeginPackage( \"" << name << "\" );" << std::endl; } void Transcriptor::EndPackage() { m_Fp << " e->EndPackage( );" << std::endl; } void Transcriptor::Define (const std::string &name, const std::string &pack, const std::string &scriptfilename) { m_Fp << " e->Define(\"" << name << "\", \"" << pack << "\", \"" << scriptfilename << "\" );" << std::endl; } void Transcriptor::SetCurrentFileName (const std::string &name ) { m_Fp << " e->SetCurrentFileName( \"" << name << "\" );" << std::endl; } void Transcriptor::EndDefine () { m_Fp << " e->EndDefine( );" << std::endl; } void Transcriptor::Create ( const std::string& nodeType, const std::string& nodeName) { m_Fp << " e->Add(\"" << nodeType << "\", \"" << nodeName << "\");" << std::endl; } void Transcriptor::Destroy (const std::string &nodeName) { m_Fp << " e->Destroy(" << nodeName << ");" << std::endl; } void Transcriptor::Connect (const std::string &nodeFrom, const std::string &outputLabel, const std::string &nodeTo, const std::string &inputLabel) { m_Fp << " e->Connect(\""<< nodeFrom << "\", \"" << outputLabel << "\", \"" << nodeTo << "\", \"" << inputLabel<< "\");" << std::endl; } void Transcriptor::Execute (const std::string &nodeName) { m_Fp << " e->Execute(\"" << nodeName << "\");" << std::endl; } void Transcriptor::DefineInput ( const std::string &name, const std::string &box, const std::string &input, const std::string& help) { m_Fp << " e->DefineInput(\""<< name << "\", " << box << ", " << input << ", \"" << help << "\");" << std::endl; } void Transcriptor::DefineOutput ( const std::string &name, const std::string &box, const std::string &output, const std::string& help) { m_Fp << " e->DefineOutput(\""<< name << "\", \"" << box << "\", \"" << output << "\", \"" << help << "\");" << std::endl; } void Transcriptor::Set (const std::string &box, const std::string &input, const std::string &value) { m_Fp << " e->Set(\""<< box << "\", \"" << input << "\", \"" << value << "\");" << std::endl; } std::string Transcriptor::Get(const std::string &box, const std::string &output) { m_Fp << " e->Get(\""<< box << "\", \"" << output << "\");" << std::endl; return ""; } void Transcriptor::Author(const std::string &authorName) { m_Fp << " e->AddToAuthor(\"" << authorName << "\")" << std::endl; } void Transcriptor::Category(const std::string &category) { m_Fp << " e->AddToCategory(\"" << category << "\")" << std::endl; } void Transcriptor::Description(const std::string &d) { m_Fp << " e->AddToDescription(\"" << d << "\")" << std::endl; } /// prints the list of the boxes of the current descriptor void Transcriptor::PrintBoxes() { m_Fp << " e->PrintBoxes( )" << std::endl; } // =========================End of Battlefield ======================================================================== std::string Transcriptor::ShowGraph(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr, const std::string &output_html, const std::string &custom_header, const std::string &custom_title, bool system_display ) { m_Fp << " e->ShowGraph(\"" << nameblackbox << "\", \"" << detailStr << "\", \"" << levelStr << "\", \"" << output_html << "\", \"" << custom_header << "\", \"" << custom_title << "\");" << std::endl; return ""; } std::string Transcriptor::ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display) { return ""; } void Transcriptor::ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr) { } void Transcriptor::Print(const std::string & message) { m_Fp << " e->Print(\"" <SetMessageLevel(\"" <HelpMessages()"<LoadPackage(\"" <UnLoadPackage(\"" <