Program: bbtk
Module: $RCSfile: bbtkBlackBoxDescriptor.cxx,v $
Language: C++
- Date: $Date: 2008/02/04 13:02:57 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2008/02/05 11:07:42 $
+ 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
mDescription(""),
mAuthor(""),
mKeyword(""),
- mCategory(STANDARD),
+ mKind(STANDARD),
mPackage(NULL)
{
bbtkDebugMessage("Core",9,
Program: bbtk
Module: $RCSfile: bbtkBlackBoxDescriptor.h,v $
Language: C++
- Date: $Date: 2008/01/30 09:28:15 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/02/05 11:07:42 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
typedef std::map<std::string, InputDescriptor*> InputDescriptorMapType;
/// The type of dictionnary of outputs= map of output descriptors pointers
typedef std::map<std::string, OutputDescriptor*> OutputDescriptorMapType;
- /// The categories of black box
+ /// The kinds of black box
typedef enum
{
STANDARD,
ADAPTOR,
DEFAULT_ADAPTOR
}
- Category;
+ Kind;
/// Default ctor
BlackBoxDescriptor();
/// Returns the Package to which the box belongs
const Package* GetPackage() const { return mPackage; }
- /// Returns the category of box
- Category GetCategory() const { return mCategory; }
+ /// Returns the kind of box
+ Kind GetKind() const { return mKind; }
/// Prints help on the black box
virtual void GetHelp(bool full=true) const;
/// Sets the Package to which the box belongs
void SetPackage(Package *package) { mPackage = package; }
- /// Sets the category of box
- void SetCategory(Category category) { mCategory = category; }
+ /// Sets the kind of box
+ void SetKind(Kind kind) { mKind = kind; }
/*
virtual void InsertHTMLGraph( std::ofstream& s, int detail, int level,
std::string mAuthor;
/// The keyword of the black box
std::string mKeyword;
- /// The category of box
- Category mCategory;
+ /// The kind of box
+ Kind mKind;
/// The Package to which the box belongs
Package *mPackage;
/// The inputs
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/05 11:07:42 $
+ 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
* \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 <fstream>
#ifdef _USE_WXWIDGETS_
/**
*
*/
- Executer::Executer()
+ Executer::Executer()
: mPackage(0),
mRoot(0),
mNoExecMode(false),
Reset();
bbtkDebugDecTab("Core",9);
}
-
+
/**
*
*/
void Executer::BeginPackage (const std::string &name)
{
- bbtkDebugMessageInc("Core",9,"Executer::BeginPackage(\""<<name<<"\")"
- <<std::endl);
+ bbtkDebugMessageInc("Core",9,"Executer::BeginPackage(\""<<name<<"\")"
+ <<std::endl);
Package* p;
try
{
BBTK_STRINGIFY_SYMBOL(BBTK_VERSION));
InsertPackage(p);
}
- mOpenPackage.push_back(p);
+ mOpenPackage.push_back(p);
}
void Executer::EndPackage()
<<std::endl);
// Does current package exist ?
Package* p;
-
std::string pname(mOpenDefinition.back().package);
if (pname.size()>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();
}
/*
void Executer::Remove (const std::string &nodeName)
- {
+ {
// Current()->RemoveBlackBox(nodeName);
}
*/
const std::string &nodeTo,
const std::string &inputLabel)
{
- Current()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel);
+ Current()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel);
}
-
+
/**
*
*/
}
#endif
}
-
+
Current()->DefineInput(name,box,input,help);
-
+
}
/**
{
Current()->DefineOutput(name,box,output,help);
}
-
+
/**
*
*/
bbtkDecTab("Help",1);
}
-
std::string Executer::ShowGraph(const std::string &nameblackbox,
const std::string &detailStr,
const std::string &levelStr,
const std::string &custom_title,
bool system_display )
{
-
int detail = atoi(detailStr.c_str());
int level = atoi(levelStr.c_str());
// 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"<<std::endl;
- page = ShowGraphInstances(nameblackbox,detail,level,system_display);
- }
+ {
+ ShowGraphTypes(nameblackbox);
+ }
+ catch (bbtk::Exception a)
+ {
+ std::cout <<"EXC"<<std::endl;
+ page = ShowGraphInstances(nameblackbox,detail,level,system_display);
+ }
*/
return page;
}
BlackBox* blackbox=NULL;
if (nameblackbox==".")
- {
- blackbox=Current()->GetPrototype();
- }
+ {
+ blackbox=Current()->GetPrototype();
+ }
else
- {
- blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox);
- }
+ {
+ blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox);
+ }
std::string page;
}
return page;
}
-
void Executer::ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr)
{
/*
/// 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);
}
*/
Program: bbtk
Module: $RCSfile: bbtkExecuter.h,v $ $
Language: C++
- Date: $Date: 2008/01/30 09:28:15 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2008/02/05 11:07:42 $
+ 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
* \class bbtk::Executer
* \brief class Executer: level 0 of script execution
*/
-
+
#ifndef __bbtkExecuter_h__
#define __bbtkExecuter_h__
/// Constructor
Executer();
- ///
+ ///
// void SetFactory(Factory* f);
/// Destructor
///Adds the authorName to the Box author list
void Author(const std::string &authorName);
- ///Adds the categories to the Box keyword list
+ ///Adds the Keywords to the Box keyword list
void Keyword(const std::string &keyword);
-
+
/// The description string which explains what does the ComplexBox
void Description(const std::string & d);
void Reset();
- // static const std::string& GetObjectDescription()
+ // static const std::string& GetObjectDescription();
// { static std::string s("Executer"); return s; }
protected:
/// only contains the root when outside a define/endefine block
std::deque<CBBDefinition> mOpenDefinition;
- /// The stack of current working package
+ /// The stack of current working package
/// (is a stack for nested definitions)
std::deque<Package*> mOpenPackage;
Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $ $
Language: C++
- Date: $Date: 2008/02/05 09:38:31 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2008/02/05 11:07:42 $
+ Version: $Revision: 1.22 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
info.argmin = 0;
info.argmax = 2;
info.code = cMessage;
- info.syntax = "message <category> <level>";
- info.help = "Sets the level of the category of messages <category> to <level>.\n If category='All' then sets the level for all categories. If no category nor level is passed then prints info on available categories of messages and their current level.";
- mCommandDict[info.keyword] = info;
+ info.syntax = "message <kind> <level>";
+ info.help = "Sets the level of the kind of messages <kind> to <level>.\n If kind='All' then sets the level for all kinds. If no kind nor level is passed then prints info on available kinds of messages and their current level."; mCommandDict[info.keyword] = info;
info.keyword = "include";
info.argmin = 1;
Program: bbtk
Module: $RCSfile: bbtkMessageManager.cxx,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/02/05 11:07:42 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
bbtkMessage("Help",1,"================ Messages ================="
<< bbtkendl);
- bbtkMessage("Help",1, "Category");
+ bbtkMessage("Help",1, "Kind");
for (int k=0;
k<(int)(GetInstance()->mMaxMessageLength-8);
k++) {
Program: bbtk
Module: $RCSfile: bbtkPackage.cxx,v $
Language: C++
- Date: $Date: 2008/01/30 12:14:43 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/02/05 11:07:42 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
d->SetPackage(this);
// If it is a default adaptor, also register it in the adaptors map
- if ( d->GetCategory() == BlackBoxDescriptor::DEFAULT_ADAPTOR)
+ if ( d->GetKind() == BlackBoxDescriptor::DEFAULT_ADAPTOR)
{
TypeInfo typein = d->GetInputDescriptor("In")->GetTypeInfo();
TypeInfo typeout = d->GetOutputDescriptor("Out")->GetTypeInfo();
{
unsigned int lmax = 0;
std::vector<std::string> names;
- std::vector<std::string> categs;
+ std::vector<std::string> kinds;
std::vector<std::string> descrs;
BlackBoxMapType::const_iterator i;
++i)
{
if ( adaptors ||
- ( i->second->GetCategory() == BlackBoxDescriptor::STANDARD) )
+ ( i->second->GetKind() == BlackBoxDescriptor::STANDARD) )
{
std::string name(" ");
name += i->second->GetTypeName();
names.push_back(name);
- std::string categ;
- if ( i->second->GetCategory() == BlackBoxDescriptor::ADAPTOR )
+ std::string kind;
+ if ( i->second->GetKind() == BlackBoxDescriptor::ADAPTOR )
{
- categ = std::string("[A]");
+ kind = std::string("[A]");
}
- else if ( i->second->GetCategory() ==
+ else if ( i->second->GetKind() ==
BlackBoxDescriptor::DEFAULT_ADAPTOR )
{
- categ = std::string("[DA]");
+ kind = std::string("[DA]");
}
- categs.push_back(categ);
+ kinds.push_back(kind);
- unsigned int l = name.size()+categ.size();
+ unsigned int l = name.size()+kind.size();
if (l>lmax) lmax = l;
std::string descr;
std::string offs;
offs.append(lmax+3,' ');
std::vector<std::string>::iterator ni,ci,di;
- for (ni = names.begin(), ci = categs.begin(), di = descrs.begin();
+ for (ni = names.begin(), ci = kinds.begin(), di = descrs.begin();
ni != names.end(); ++ni, ++ci, ++di)
{
std::string space;
i!=mBlackBoxMap.end();
++i)
{
- if ( i->second->GetCategory() != BlackBoxDescriptor::STANDARD )
+ if ( i->second->GetKind() != BlackBoxDescriptor::STANDARD )
{
bbtkMessage("Help",1,
" "<<i->second->GetTypeName());
- if ( i->second->GetCategory() ==
+ if ( i->second->GetKind() ==
BlackBoxDescriptor::DEFAULT_ADAPTOR )
{
bbtkMessage("Help",1,
BlackBoxMapType::const_iterator i;
for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end(); ++i)
{
- if ( i->second->GetCategory() != BlackBoxDescriptor::STANDARD)
+ if ( i->second->GetKind() != BlackBoxDescriptor::STANDARD)
continue;
std::string name = i->second->GetTypeName();
s << "<p><TABLE cellspacing=0 cellpadding=3>\n";
for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end();++i)
{
- if ( i->second->GetCategory() == BlackBoxDescriptor::STANDARD)
+ if ( i->second->GetKind() == BlackBoxDescriptor::STANDARD)
continue;
std::string name = i->second->GetTypeName();
Program: bbtk
Module: $RCSfile: bbtkTranscriptor.h,v $ $
Language: C++
- Date: $Date: 2008/01/22 17:00:17 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/02/05 11:07:42 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
#ifndef __bbtkTranscriptor_h__
-#define __bbtkTranscriptor_h__
+#define __bbtkTranscriptor_h__
#include "bbtkVirtualExec.h"
+#include "bbtkSystem.h"
+#include "bbtkComplexBlackBox.h"
+#include "bbtkFactory.h"
+#include <string>
+#include <deque>
#include <iostream>
namespace bbtk
class /*BBTK_EXPORT*/ Transcriptor : public VirtualExec
{
- public:
+ public:
/// Constructor
Transcriptor(std::string filename);
-
+
/// Destructor
~Transcriptor( );
//void SetNoExecMode(bool b) { mNoExecMode = b; }
void SetNoExecMode(bool b)
{
- m_Fp << "e->SetNoExecMode(true);" << std::endl;
- }
+ m_Fp << "e->SetNoExecMode(true);" << std::endl;
+ }
bool GetNoExecMode() const { return mNoExecMode; }
/*
- bool GetNoExecMode() const
+ bool GetNoExecMode() const
{
// cannot compile, since ethos is 'const' !
- //m_Fp << "e->GetNoExecMode(true);" << std::endl;
+ //m_Fp << "e->GetNoExecMode(true);" << std::endl;
}
*/
/// Sets the mode of dialog of the executer for Root inputs
void SetDialogMode(DialogModeType t) { mDialogMode = t; }
+ /// Starts a package block
+ void BeginPackage (const std::string &name );
+
+ /// Ends a package block
+ void EndPackage ();
+
/// Starts the definition of a new ComplexBlackBox in package pack
/// scriptfilename is the file from which the def is read
void Define (const std::string &name,
/// changes the workspace name
void SetWorkspaceName( const std::string& n );
- ///Adds the authorName to the Box's author list
+ ///Adds the authorName to the Box author list
void Author(const std::string &authorName);
+ ///Adds the Keywords to the Box keyword list
+ void Keyword(const std::string &keyword);
+
/// The description string which explains what does the ComplexBox
void Description(const std::string & d);
void Reset();
- // static const std::string& GetObjectDescription()
+ // static const std::string& GetObjectDescription()
// { static std::string s("Executer"); return s; }
protected:
private:
/// Gets the current working black box
- ComplexBlackBoxDescriptor* Current() { return mCurrent.back().box; }
+ ComplexBlackBoxDescriptor* Current()
+ { return mOpenDefinition.back().box; }
/// Returns true when we are inside a define/endefine block
- // bool InDefinitionBlock() { return (mCurrent.size()>1); }
+ // bool InDefinitionBlock() { return (mOpenDefinition.size()>1); }
//==================================================================
// ATTRIBUTES
/// The root ComplexBlackBox, in which operations are done when outside a define/endefine block
/// Its name in bbi is 'workspace'
ComplexBlackBoxDescriptor* mRoot;
-
+
/// Struct that stores info on user defined complex black boxes
struct CBBDefinition
{
/// The stack of current working ComplexBlackBox
/// (is a stack for nested definitions)
/// only contains the root when outside a define/endefine block
- std::deque<CBBDefinition> mCurrent;
+ std::deque<CBBDefinition> mOpenDefinition;
+
+ /// The stack of current working package
+ /// (is a stack for nested definitions)
+ std::deque<Package*> mOpenPackage;
/// flag which is true when we are inside a Define/EndDefine block
// bool mDefineFlag;
DialogModeType mDialogMode;
/// File Pointer, to hold generated C++ code.
- // std::ofstream *m_Fp;
- std::ofstream m_Fp;
+ // std::ofstream *m_Fp;
+ std::ofstream m_Fp;
};
}
#endif
Program: bbtk
Module: $RCSfile: bbtkUserBlackBoxMacros.h,v $
Language: C++
- Date: $Date: 2008/01/30 09:28:16 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2008/02/05 11:07:43 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//============================================================================
//============================================================================
-/// Declares the category of a UserBlackBox (to be put inside the UBB description block)
-//#define BBTK_CATEGORY(CATEGORY) SetCategory(CATEGORY)
+/// Declares the kind of a UserBlackBox (to be put inside the UBB description block)
+//#define BBTK_KIND(KIND) SetKind(KIND)
//============================================================================
//============================================================================
/// Declares that the UserBlackBox is an adaptor (to be put inside the UBB description block)
-#define BBTK_ADAPTOR() SetCategory(bbtk::BlackBoxDescriptor::ADAPTOR)
+#define BBTK_ADAPTOR() SetKInd(bbtk::BlackBoxDescriptor::ADAPTOR)
//============================================================================
//============================================================================
/// Declares that the UserBlackBox is the default adaptor of the package (to be put inside the UBB description block)
-#define BBTK_DEFAULT_ADAPTOR() SetCategory(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR)
+#define BBTK_DEFAULT_ADAPTOR() SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR)
//============================================================================
//============================================================================
Program: bbtk
Module: $RCSfile: bbtkVirtualExec.h,v $ $
Language: C++
- Date: $Date: 2008/01/30 09:28:16 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2008/02/05 11:07:43 $
+ 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
{
public:
- typedef enum
+ typedef enum
{
NoDialog,
TextDialog,
GraphicalDialog
}
DialogModeType;
-
-/*
- /// Constructor
- VirtualExec();
-
- ///
- // void SetFactory(Factory* f);
-
- /// Destructor
- virtual ~VirtualExec() = 0;
-*/
+
/// Sets the inputs of the workspace :
virtual void SetInputs(const std::map<std::string,std::string>& m) = 0;
const std::string &input,
const std::string &value) = 0;
- /// gets the output of the box
+ /// gets the output of the box
virtual std::string Get (const std::string &box,
const std::string &output) = 0;
const std::string &custom_title,
bool system_display = true) = 0;
- /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
+ /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
virtual std::string ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display=true) = 0;
-/// Description of the actual pipeline
+ /// Description of the actual pipeline
virtual void ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr) = 0;
virtual void Reset() = 0;
-/*
+
+
// static const std::string& GetObjectDescription() = 0;
// { static std::string s("VirtualExec"); return s; }
-*/
protected:
private:
/// The root ComplexBlackBox, in which operations are done when outside a define/endefine block
/// Its name in bbi is 'workspace'
ComplexBlackBoxDescriptor* mRoot;
-
+
/// Struct that stores info on user defined complex black boxes
struct CBBDefinition
{
/// The stack of current working ComplexBlackBox
/// (is a stack for nested definitions)
/// only contains the root when outside a define/endefine block
- std::deque<CBBDefinition> mCurrent;
+ std::deque<CBBDefinition> mOpenDefinition;
+
+ /// The stack of current working package
+ /// (is a stack for nested definitions)
+ std::deque<Package*> mOpenPackage;
/// flag which is true when we are inside a Define/EndDefine block
// bool mDefineFlag;
define DoubleSlider
description "test object"
+ keyword "box;wx;slider"
author "laurent.guigues at creatis.insa-lyon.fr"
new Slider slider1
new Slider slider2