+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ # pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ # This software is governed by the CeCILL-B license under French law and
+ # abiding by the rules of distribution of free software. You can use,
+ # modify and/ or redistribute the software under the terms of the CeCILL-B
+ # license as circulated by CEA, CNRS and INRIA at the following URL
+ # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ # or in the file LICENSE.txt.
+ #
+ # As a counterpart to the access to the source code and rights to copy,
+ # modify and redistribute granted by the license, users are provided only
+ # with a limited warranty and the software's author, the holder of the
+ # economic rights, and the successive licensors have only limited
+ # liability.
+ #
+ # The fact that you are presently reading this means that you have had
+ # knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
/*=========================================================================
-
Program: bbtk
- Module: $RCSfile: bbtkTranscriptor.cxx,v $ $
+ Module: $RCSfile: bbtkTranscriptor.cxx,v $
Language: C++
- Date: $Date: 2008/02/14 20:23:51 $
- Version: $Revision: 1.5 $
-
- 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.
-
+ Date: $Date: 2012/11/16 08:49:01 $
+ Version: $Revision: 1.19 $
=========================================================================*/
+
+
+
/**
* \file
* \brief class Transcriptor: level 0 of script execution (code)
namespace bbtk
{
+ Transcriptor::Pointer Transcriptor::New(const std::string& filename)
+ {
+ return MakePointer(new Transcriptor(filename));
+ }
+
/**
*
*/
- Transcriptor::Transcriptor(std::string filename)
- : mPackage(0),
- mRoot(0),
- mNoExecMode(false),
+ Transcriptor::Transcriptor(const std::string& filename)
+ :
mDialogMode(NoDialog)
{
//VirtualExec();
- bbtkDebugMessageInc("Kernel",9,"Transcriptor::Transcriptor()" <<std::endl);
- Reset();
- bbtkDebugDecTab("Kernel",9);
-
- //std::ofstream *m_Fp = new std::ofstream();
+ bbtkDebugMessageInc("kernel",9,"Transcriptor()" <<std::endl);
+
+ //std::ofstream *m_Fp = new std::ofstream();
m_Fp.open (filename.c_str(), std::ios::out );
- m_Fp << "#include \"bbtkExecuter.h\"" << std::endl;
+ std::string file,path;
+ file = bbtk::Utilities::ExtractScriptName(filename,path);
+
+ m_Fp << "#include \"bbtkExecuter.h\"" << std::endl;
+ m_Fp << "void " << file << "(bbtk::Executer::Pointer e)"<<std::endl;
+ m_Fp << "{"<<std::endl;
+
+ /*
+#ifdef _USE_WXWIDGETS_
+ m_Fp << "#ifdef _USE_WXWIDGETS_"<<std::endl;
+ m_Fp << "#include \"bbtkWx.h\""<< std::endl<<std::endl;
+ m_Fp << "class myApp : public wxApp"<<std::endl;
+ m_Fp << "{"<<std::endl;
+ m_Fp << "public:"<<std::endl;
+ m_Fp << " bool OnInit( );"<<std::endl;
+ m_Fp << " int OnExit() { delete e; return true; }"<<std::endl;
+ m_Fp << " bbtk::Executer* e;"<<std::endl;
+ m_Fp << "};"<<std::endl<<std::endl;
+ m_Fp << "IMPLEMENT_APP(myApp);"<<std::endl<<std::endl;
+ m_Fp << "bool myApp::OnInit( )"<<std::endl;
+ m_Fp << "{"<<std::endl;
+ m_Fp << " wxApp::OnInit();"<<std::endl;
+ m_Fp << "#ifdef __WXGTK__"<<std::endl;
+ m_Fp << " //See http://www.wxwindows.org/faqgtk.htm#locale"<<std::endl;
+ m_Fp << " setlocale(LC_NUMERIC, \"C\");"<<std::endl;
+ m_Fp << "#endif"<<std::endl;
+ m_Fp << " wxInitAllImageHandlers();"<<std::endl;
+ m_Fp << " bbtk::Wx::CreateInvisibleTopWindow();"<<std::endl;
+ m_Fp << " try {"<<std::endl;
+ m_Fp << " e = new bbtk::Executer();"<<std::endl;
+#else
m_Fp << "main(int argc, char *argv[]) {" << std::endl;
m_Fp << " bbtk::Executer *e = new bbtk::Executer();" << std::endl;
- }
+#endif
+ */
+ bbtkDebugDecTab("kernel",9);
+ }
/**
*
Transcriptor::~Transcriptor()
{
-std::cout << "====================================================== delete Transcriptor\n";
- bbtkDebugMessageInc("Kernel",9,"Transcriptor::~Transcriptor()" <<std::endl);
- if (mRoot)
- {
- mPackage->UnRegisterBlackBox("workspace");
- delete mRoot;
- }
- if (mPackage)
- {
- GetGlobalFactory()->UnLoadPackage("user");
- }
+ bbtkDebugMessageInc("kernel",9,"~Transcriptor()" <<std::endl);
+ /*
+#ifdef _USE_WXWIDGETS_
+ m_Fp << " }"<<std::endl;
+ m_Fp << " catch (bbtk::Exception err)"<<std::endl;
+ m_Fp << " {"<<std::endl;
+ m_Fp << " err.Print();"<<std::endl;
+ m_Fp << " } "<<std::endl;
+ m_Fp << " return true;"<<std::endl;
+ m_Fp << "}" << std::endl;
+ m_Fp << "#endif"<<std::endl;
+#else
+ m_Fp << "}" << std::endl;
+#endif
+ */
+ m_Fp << "}" << std::endl;
+ m_Fp.close();
- if(m_Fp)
- {
- bbtkDebugDecTab("Kernel",9);
- m_Fp << " }" << std::endl;
- m_Fp.close();
- // delete m_Fp;
- }
+ bbtkDebugDecTab("kernel",9);
}
+
-
-// ========================= Begin of Battlefield ========================================================================
-
-
-/**
- *
- */
void Transcriptor::Reset()
{
m_Fp << " e->Reset( );" << std::endl;
+ }
- /*
- bbtkDebugMessageInc("Kernel",9,"Transcriptor::Reset()" <<std::endl);
-
- // The 'user' package must be closed before all other
- // because box destructors must not be unloaded when bb are deleted!
- // Similarly, the 'workspace' CBB must be destroyed before
- // 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)
- {
- mPackage->UnRegisterBlackBox(mRoot->GetTypeName());
- delete mRoot;
- }
- if (mPackage)
- {
- GetGlobalFactory()->UnLoadPackage("user");
- }
- GetGlobalFactory()->Reset();
- // Create user package
- mPackage = new Package("user","internal to bbi",
- "User defined black boxes",
- "",
- BBTK_STRINGIFY_SYMBOL(BBTK_VERSION));
- // Create user workspace
- mRoot = new ComplexBlackBoxDescriptor("workspace"); //,f);
- mRoot->AddToAuthor("bbi (internal)");
- mRoot->AddToDescription("User's workspace");
- mOpenDefinition.push_back(CBBDefinition(mRoot,"user"));
- // Register it into the user package
- mPackage->RegisterBlackBox(mRoot);
- // Insert the user package in the factory
- InsertPackage(mPackage);
- mOpenPackage.push_back(mPackage);
- bbtkDebugDecTab("Kernel",9);
- */
+ void Transcriptor::Clear()
+ {
+ m_Fp << " e->Clear( );" << std::endl;
}
- /// changes the workspace name
void Transcriptor::SetWorkspaceName( const std::string& name )
{
- m_Fp << " e->SetWorkspaceName( \"" << name << "\" );" << std::endl;
-
- // mPackage->ChangeBlackBoxName( mRoot->GetTypeName(), name );
+ m_Fp << " e->SetWorkspaceName( \"" << name << "\" );" << std::endl;
}
void Transcriptor::BeginPackage (const std::string &name)
{
m_Fp << " e->BeginPackage( \"" << name << "\" );" << std::endl;
- /*
- bbtkDebugMessageInc("Kernel",9,"Executer::BeginPackage(\""<<name<<"\")"
- <<std::endl);
- Package* p;
- try
- {
- p = GetGlobalFactory()->GetPackage(name);
- }
- catch (Exception e)
- {
- p = new Package(name,
- "",
- "",
- "",
- BBTK_STRINGIFY_SYMBOL(BBTK_VERSION));
- InsertPackage(p);
- }
- mOpenPackage.push_back(p);
- */
}
void Transcriptor::EndPackage()
{
m_Fp << " e->EndPackage( );" << std::endl;
- // if (mOpenPackage.size()>1) mOpenPackage.pop_back();
}
void Transcriptor::Define (const std::string &name,
{
m_Fp << " e->Define(\"" << name << "\", \"" << pack << "\", \""
<< scriptfilename << "\" );" << std::endl;
- /*
- bbtkDebugMessageInc("Kernel",9,"Executer::Define(\""<<name<<
- ","<<pack<<"\")"
- <<std::endl);
-
- ComplexBlackBoxDescriptor* b = new ComplexBlackBoxDescriptor(name);
- b->SetScriptFileName(scriptfilename);
- mOpenDefinition.push_back( CBBDefinition( b, pack ) );
-
- bbtkDebugDecTab("Kernel",9);
- */
}
- /// Sets the file name to use for the current definition
- /// (Used to set it after the Define command)
void Transcriptor::SetCurrentFileName (const std::string &name )
{
m_Fp << " e->SetCurrentFileName( \"" << name << "\" );" << std::endl;
- // mOpenDefinition.back().box->SetScriptFileName(name);
}
void Transcriptor::EndDefine ()
{
m_Fp << " e->EndDefine( );" << std::endl;
+ }
- /*
- bbtkDebugMessageInc("Kernel",9,"Executer::EndDefine(\""
- <<Current()->GetTypeName()<<"\")"
- <<std::endl);
- // Does current package exist ?
- Package* p;
- std::string pname(mOpenDefinition.back().package);
- if (pname.size()>0)
- {
- try
- {
- p = GetGlobalFactory()->GetPackage(pname);
- }
- catch (Exception e)
- {
- p = new Package(pname,
- "",
- "",
- "",
- BBTK_STRINGIFY_SYMBOL(BBTK_VERSION));
- InsertPackage(p);
- }
- }
- else
- {
- p = mOpenPackage.back();
- }
- p->RegisterBlackBox(Current());
-
- mOpenDefinition.pop_back();
- */
-
+ void Transcriptor::Kind(const std::string& kind)
+ {
+ m_Fp << " e->Kind( \""<<kind<<"\" );" << std::endl;
}
void Transcriptor::Create ( const std::string& nodeType,
const std::string& nodeName)
{
- // Current()->Add(nodeType,nodeName);\"
- m_Fp << " e->Add(\"" << nodeType << "\", \"" << nodeName << "\");" << std::endl;
+ m_Fp << " e->Create(\"" << nodeType << "\", \""
+ << nodeName << "\");" << std::endl;
}
- /*
- void Transcriptor::Remove (const std::string &nodeName)
+ void Transcriptor::Destroy (const std::string &nodeName)
{
- /// \todo Remove
- // Current()->RemoveBlackBox(nodeName);
- // m_Fp << " e->Remove(" << nodeName << ");" << std::endl;
+ 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)
{
- //Current()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel);
- m_Fp << " e->Connect(\""<< nodeFrom << "\", \"" << outputLabel << "\", \""
- << nodeTo << "\", \"" << inputLabel<< "\");" << std::endl;
+ m_Fp << " e->Connect(\""<< nodeFrom << "\", \""
+ << outputLabel << "\", \""
+ << nodeTo << "\", \"" << inputLabel<< "\");" << std::endl;
}
- /**
- *
- */
- void Transcriptor::Update (const std::string &nodeName) // would 'Execute' be more meaningfull ?
+
+ void Transcriptor::Execute (const std::string &nodeName)
{
-
- 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;
- }
- }
- else
- {
- //Current()->AddToExecutionList(nodeName) ;
- m_Fp << " e->AddToExecutionList(\"" << nodeName << "\");" << std::endl;
- }
-*/
+ 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;
-
- /*
- // If the input is defined in the Root box
- if (Current()==mRoot)
- {
- // If the dialog mode is set to NoDialog
- // and the user passed the name in the Inputs map
- // then the associated value is set to the box.input
- // This is the way command line parameters are passed to the Root box
- if (mDialogMode == NoDialog)
- {
- // find if name is in mInputs
- std::map<std::string,std::string>::iterator i;
- i = mInputs.find(name);
- if (i!=mInputs.end()) {
- Set(box,input,(*i).second);
- }
- }
- // If the dialog mode is set to TextDialog
- // The user is prompted for the value
- else if (mDialogMode == TextDialog)
- {
- std::cout << name << "=";
- std::string ans;
- std::cin >> ans;
- Set(box,input,ans);
- }
-#ifdef _USE_WXWIDGETS_
- // If the dialog mode is set to GraphicalDialog
- // A dialog box is pop up
- else if (mDialogMode == GraphicalDialog)
- {
- std::string mess("Enter the value of '");
- mess += name;
- mess += "' (";
- mess += help;
- mess += ")";
- std::string title(name);
- title += " ?";
- std::string ans = wx2std ( wxGetTextFromUser( std2wx (mess), std2wx(title)));
- Set(box,input,ans);
- }
-#endif
- }
-
- Current()->DefineInput(name,box,input,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)
+
+ void Transcriptor::DefineOutput ( const std::string &name,
+ const std::string &box,
+ const std::string &output,
+ const std::string& help)
{
- // Current()->DefineOutput(name,box,output,help);
- m_Fp << " e->DefineOutput(\""<< name << "\", \"" << box << "\", \""
- << output << "\", \"" << help << "\");" << std::endl;
+ 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 << "\");"
+ 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 =
- NewAdaptor(typeid(std::string),
- b->bbGetInputType(input),
- "tmp");
- if (!a)
- {
- bbtkError("No <"<<
- TypeName(b->bbGetInputType(input))
- <<"> to <std::string> found");
- }
- std::string v(value);
- a->bbSetInput("In",v);
- a->bbExecute();
- b->bbSetInput(input,a->bbGetOutput("Out"));
- a->bbDelete();
- }
- else
- {
- std::string v(value);
- b->bbSetInput(input,v);
- }
-*/
- }
-
- /**
- *
- */
std::string Transcriptor::Get(const std::string &box,
const std::string &output)
{
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 =
- NewAdaptor(
- b->bbGetOutputType(output),
- typeid(std::string),
- "tmp");
- if (!a)
- {
- bbtkError("No <"<<
- TypeName(b->bbGetOutputType(output))
- <<"> to <std::string> found");
- }
- b->bbExecute();
-
- a->bbSetInput("In",b->bbGetOutput(output));
- a->bbExecute();
- std::string r = a->bbGetOutput("Out").unsafe_get<std::string>();
- //std::string v = *((std::string*)a->bbGetOutput("Out")) ;
- // std::cout << a->bbGetOutput("Out").unsafe_get<std::string>()
- // << std::endl;
- //std::string v(value);
- //b->bbSetInput(input,a->bbGetOutput("Out"));
- a->bbDelete();
- return r;
- }
- else
- {
- b->bbExecute();
- return b->bbGetOutput(output).unsafe_get<std::string>();
- // std::string v = *((std::string*)b->bbGetOutput(output)) ;
- // std::cout << b->bbGetOutput("Out").unsafe_get<std::string>()
- // << std::endl;
- // b->bbSetInput(input,&v);
- }
-*/
+ return "";
}
void Transcriptor::Author(const std::string &authorName)
{
-
- m_Fp << " e->AddToAuthor(\"" << authorName << "\")" << std::endl;
- return; // just to see
-
- //Current()->AddToAuthor(authorName,Current()==mRoot);
+
+ m_Fp << " e->Author(\"" << authorName << "\");" << std::endl;
}
void Transcriptor::Category(const std::string &category)
{
- m_Fp << " e->AddToCategory(\"" << category << "\")" << std::endl;
- //Current()->AddToCategory(category,Current()==mRoot);
+ m_Fp << " e->Category(\"" << category << "\");" << std::endl;
}
void Transcriptor::Description(const std::string &d)
{
- m_Fp << " e->AddToDescription(\"" << d << "\")" << std::endl;
- // Current()->AddToDescription(d,Current()==mRoot);
+ m_Fp << " e->Description(\"" << d << "\");" << std::endl;
}
/// prints the list of the boxes of the current descriptor
- void Transcriptor::PrintBoxes()
- {
- m_Fp << " e->PrintBoxes( )" << std::endl;
- /*
- bbtkMessageInc("Help",1,"The black box descriptor \""
- <<Current()->GetTypeName()<<"\" contains : "<<std::endl);
- Current()->PrintBlackBoxes();
- bbtkDecTab("Help",1);
- */
+ void Transcriptor::PrintHelpListBoxes()
+ {
+ 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,
bool system_display )
{
- m_Fp << " e->DefineOutput(\"" << nameblackbox << "\", \""
+ m_Fp << " e->ShowGraph(\"" << nameblackbox << "\", \""
<< detailStr << "\", \""
<< levelStr << "\", \""
<< output_html << "\", \""
<< custom_header << "\", \""
<< custom_title << "\");"
<< std::endl;
- /*
- int detail = atoi(detailStr.c_str());
- int level = atoi(levelStr.c_str());
- std::string filename_rootHtml (output_html) ;
- std::string simplefilename_rootHtml ( Utilities::get_file_name(output_html));
+ return "";
+ }
- bool relative_link = true;
+ std::string Transcriptor::ShowGraphInstances(const std::string &nameblackbox, int detail, int level,
+ bool system_display)
+ {
+ return "";
+
+ }
- // No output provided : automatic generation
- if (output_html.length() == 0)
- {
- // 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";
-
- filename_rootHtml = directory + "/" + "User.html";
- simplefilename_rootHtml = "User.html" ;
-
- // Creating directory
- std::string command0("mkdir \"" +directory + "\"");
- system( command0.c_str() );
-
- relative_link = false;
- }
-
- Package* p;
- try
- {
- p = GetGlobalFactory()->GetPackage(nameblackbox);
- }
- catch (Exception e)
- {
- 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"<<std::endl;
- page = ShowGraphInstances(nameblackbox,detail,level,system_display);
- }
- */
- //return page;
- return ""; // to avoid warnings
+void Transcriptor::PrintHelpBlackBox(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr)
+ {
+
}
- /// Generate a png file with the actual pipeline (Graphviz-dot needed)
- std::string Transcriptor::ShowGraphInstances(const std::string &nameblackbox, int detail, int level,
- bool system_display)
+ void Transcriptor::Print(const std::string & message)
{
+ m_Fp << " e->Print(\"" <<message<<"\");"<<std::endl;
+ }
- BlackBox* blackbox=NULL;
- if (nameblackbox==".")
- {
- blackbox=Current()->GetPrototype();
- }
- else
- {
- blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox);
- }
-
- std::string page;
- if (blackbox)
- {
- // 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];
+
+ void Transcriptor::SetMessageLevel(const std::string &kind,
+ int level)
+ {
+ m_Fp << " e->SetMessageLevel(\"" <<kind<<"\","<<level<<");"<<std::endl;
+ }
+
- std::string directory = default_doc_dir;
- if (c != '/' && c !='\\') directory = directory + "/";
+ void Transcriptor::HelpMessages()
+ {
+ m_Fp << " e->HelpMessages();"<<std::endl;
+ }
+
+ void Transcriptor::LoadPackage(const std::string &name )
+ {
+ m_Fp << " e->LoadPackage(\"" <<name<<"\");"<<std::endl;
+ }
+
+
+ void Transcriptor::UnLoadPackage(const std::string &name )
+ {
+ m_Fp << " e->UnLoadPackage(\"" <<name<<"\");"<<std::endl;
+ }
- 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 + "\"");
+ //==========================================================================
+ std::string Transcriptor::GetObjectName() const
+ {
+ return std::string("Transcriptor");
+ }
+ //==========================================================================
+
+ //==========================================================================
+ std::string Transcriptor::GetObjectInfo() const
+ {
+ std::stringstream i;
+ return i.str();
+ }
+ //==========================================================================
-#if defined(_WIN32)
- std::string command2("start ");
-#else
- std::string command2("gnome-open ");
-#endif
+ //==========================================================================
+size_t Transcriptor::GetObjectSize() const
+{
+ size_t s = Superclass::GetObjectSize();
+ s += Transcriptor::GetObjectInternalSize();
+ return s;
+ }
+ //==========================================================================
+ //==========================================================================
+size_t Transcriptor::GetObjectInternalSize() const
+{
+ size_t s = sizeof(Transcriptor);
+ return s;
+ }
+ //==========================================================================
+ //==========================================================================
+ size_t Transcriptor::GetObjectRecursiveSize() const
+ {
+ size_t s = Superclass::GetObjectRecursiveSize();
+ s += Transcriptor::GetObjectInternalSize();
+ return s;
+ }
+ //==========================================================================
- command2=command2+filename_html;
- page = filename_html;
- // 1. Generate Html Diagram
- std::ofstream s;
- s.open(filename_html.c_str());
- if (s.good())
- {
- s << "<html><head><title>BBtk graph diagram</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>\n";
- s << "<body bgcolor=\"#FFFFFF\" text=\"#000000\"> \n\n";
- if ( blackbox->bbGetName()=="workspacePrototype" )
- {
- s << "<center>Current workspace</center>";
- } else {
- s << "<center>" << blackbox->bbGetName()<< "</center>";
- }
-
- blackbox->bbInsertHTMLGraph( s, detail, level, true, directory, false );
- s << "</body></html>\n";
- }
- s.close();
- // 2. Starting Browser
- if (system_display) system( command2.c_str() );
- }
- else
- {
- bbtkMessageInc("Help",1,"No black box: \""
- <<nameblackbox<<"\" " <<std::endl);
- }
- return page;
- }
-
-void Transcriptor::ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr)
- {
- bool found=false;
-
- int detail = atoi(detailStr.c_str());
- int level = atoi(levelStr.c_str());
- BlackBox* blackbox=NULL;
- if (nameblackbox.compare(".")==0)
- {
- blackbox=Current()->GetPrototype();
- } else {
- blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox);
- }
-
- if (blackbox)
- {
- found=true;
- blackbox->bbShowRelations(blackbox,detail,level); //,mFactory);
- }
-
- if (!found)
- {
- bbtkError("Blackbox Name not found.. <" <<nameblackbox<<">");
- }
- }
-
- /*
- /// sets the level of message
- void Transcriptor::Message(const std::string &kind,
- const std::string& level)
- {
- int l;
- sscanf(level.c_str(),"%d",&l);
- bbtk::MessageManager::SetMessageLevel(kind,l);
- }
- */
+ //==========================================================================
+ void Transcriptor::SetTypeOfScript_Application()
+ {
+ }
+ //==========================================================================
}//namespace