bbtk::Executer Class Reference

class Executer: level 0 of script execution More...

#include <bbtkExecuter.h>

Inheritance diagram for bbtk::Executer:

Inheritance graph
[legend]
Collaboration diagram for bbtk::Executer:

Collaboration graph
[legend]

List of all members.

Classes

struct  CBBDefinition
 Struct that stores info on user defined complex black boxes. More...

Public Types

typedef Executer Self
typedef boost::shared_ptr< SelfPointer
typedef boost::weak_ptr< SelfWeakPointer
enum  DialogModeType { NoDialog, TextDialog, GraphicalDialog }

Public Member Functions

std::string GetObjectName () const
std::string GetObjectInfo () const
size_t GetObjectSize () const
size_t GetObjectInternalSize () const
size_t GetObjectRecursiveSize () const
Factory::Pointer GetFactory ()
 Gets the factory used by the executer.
void SetInputs (const std::map< std::string, std::string > &m)
 Gets the factory used by the executer (const).
void SetNoExecMode (bool b)
bool GetNoExecMode () const
void SetDialogMode (DialogModeType t)
 Sets the mode of dialog of the executer for Root inputs.
void SetNoErrorMode (bool b)
bool GetNoErrorMode () const
void LoadPackage (const std::string &name)
 Loads a package.
void UnLoadPackage (const std::string &name)
 Unloads a package.
void BeginPackage (const std::string &name)
 Starts a package block.
void EndPackage ()
 Ends a package block.
void Define (const std::string &name, const std::string &pack, const std::string &scriptfilename)
void SetCurrentFileName (const std::string &name)
void EndDefine ()
 End the definition of a ComplexBlackBox.
void Kind (const std::string &kind)
 Sets the kind of the currently defined ComplexBlackBox.
void Create (const std::string &boxType, const std::string &boxName)
 Creates a new black box in current complex box.
void Destroy (const std::string &boxName)
 Destroys a black box.
void Clear ()
 Clears the currently defined ComplexBlackBox.
void Connect (const std::string &boxfrom, const std::string &output, const std::string &boxto, const std::string &input)
 Connects the output boxOutput to the input boxInput.
void Execute (const std::string &box)
 Executes the box.
void DefineInput (const std::string &name, const std::string &box, const std::string &input, const std::string &help)
 Defines an input of the current complex box.
void DefineOutput (const std::string &name, const std::string &box, const std::string &output, const std::string &help)
 Defines an output of the current complex box.
void Set (const std::string &box, const std::string &input, const std::string &value)
 sets the input of the box with the value
std::string Get (const std::string &box, const std::string &output)
 gets the output of the box
void SetWorkspaceName (const std::string &n)
 changes the workspace name
void Author (const std::string &authorName)
 Adds the authorName to the Box author list.
void Category (const std::string &category)
 Adds the Categories to the Box category list.
void Description (const std::string &d)
 The description string which explains what does the ComplexBox.
void PrintHelpListBoxes ()
 prints the list off the boxes of the current box
std::string ShowGraph (const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr, const std::string &output_file, const std::string &custom_header, const std::string &custom_title, bool system_display=true)
 Generate a HTML with a gif file with the current pipeline (Graphviz-dot needed). Returns the file path.
std::string ShowGraphInstances (const std::string &nameblackbox, int detail, int level, bool system_display=true)
 Generate a HTML with a gif file with the current pipeline (Graphviz-dot needed). Returns the file path.
void PrintHelpBlackBox (const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr)
 Prints help on a black box.
void Reset ()
 Resets the workspace : destroys all boxes / unloads all packages.
void SetMessageLevel (const std::string &kind, int level)
 Sets the level of message for kind.
void HelpMessages ()
 Prints help on the messages.
void Print (const std::string &message)
 Prints the string ... MORE : TO EXPLAIN.
ComplexBlackBoxDescriptor::Pointer GetWorkspace ()
Package::Pointer GetUserPackage ()
ComplexBlackBoxDescriptor::Pointer GetCurrentDescriptor ()
 Gets the current working black box.
void SetInterpreter (InterpreterPointer i)
 Sets the interpreter who uses it.
InterpreterPointer GetInterpreter ()
 Gets the interpreter who uses it.
long GetUseCount ()

Static Public Member Functions

static Pointer New ()
static void InsertInObjectList (Pointer)
static void RemoveFromObjectList (WeakPointer)
static void InsertInPackageList (Pointer)
static void ReleasePackages ()
static void PrintObjectListInfo (const std::string &name)
static void PrintObjectInfo (const Pointer &o)
static long GetObjectsCount ()

Protected Types

typedef VirtualExec Superclass

Protected Member Functions

 Executer ()
 Executer (const Executer &)
 ~Executer ()
void LockThis ()
void UnLockThis ()
template<class U >
boost::shared_ptr< U > GetThisPointer () const

Static Protected Member Functions

template<class U >
static boost::shared_ptr< U > MakePointer (U *s, bool lock=false)
template<class U , class D >
static boost::shared_ptr< U > MakePointer (U *s, const D &del, bool lock=false)

Private Attributes

Factory::Pointer mFactory
 Returns true when we are inside a define/endefine block.
Package::WeakPointer mRootPackage
ComplexBlackBoxDescriptor::WeakPointer mRootCBB
std::deque< CBBDefinitionmOpenDefinition
std::deque< Package::WeakPointermOpenPackage
std::map< std::string,
std::string > 
mInputs
 The input values of the Root ComplexBlackBox.
bool mNoExecMode
 no exec mode flag
DialogModeType mDialogMode
 Dialog mode.
bool mNoErrorMode
 no error mode flag

Friends

struct Object::Deleter


Detailed Description

class Executer: level 0 of script execution

Definition at line 57 of file bbtkExecuter.h.


Member Typedef Documentation

typedef boost::shared_ptr<Self> bbtk::Executer::Pointer

Reimplemented from bbtk::VirtualExec.

Definition at line 59 of file bbtkExecuter.h.

Reimplemented from bbtk::VirtualExec.

Definition at line 59 of file bbtkExecuter.h.

Definition at line 59 of file bbtkExecuter.h.

typedef boost::weak_ptr<Self> bbtk::Executer::WeakPointer

Reimplemented from bbtk::VirtualExec.

Definition at line 59 of file bbtkExecuter.h.


Member Enumeration Documentation

Enumerator:
NoDialog 
TextDialog 
GraphicalDialog 

Definition at line 57 of file bbtkVirtualExec.h.

00058     {
00059        NoDialog,
00060        TextDialog,
00061        GraphicalDialog
00062     }


Constructor & Destructor Documentation

bbtk::Executer::Executer (  )  [protected]

Definition at line 62 of file bbtkExecuter.cxx.

References bbtkDebugMessage, bbtk::Object::MakePointer(), mFactory, New(), and Reset().

Referenced by New().

00063     : 
00064     mFactory(),
00065     mRootPackage(),
00066     mRootCBB(),
00067     mNoExecMode(false),
00068     mDialogMode(NoDialog),
00069     mNoErrorMode(false)
00070   {
00071     bbtkDebugMessage("object",2,"==> Executer()" <<std::endl);
00072     mFactory = Factory::New();
00073     // The smart pointer on this is not made yet (is made by New) 
00074     // -> create it to pass it to the factory
00075     // We have to "lock" the smart pointer because the factory
00076     // only keeps a weak pointer on the executer
00077     // -> this would auto-destroy !!
00078     mFactory->SetExecuter(MakePointer(this,true));
00079     Reset();
00080     bbtkDebugMessage("object",2,"<== Executer()" <<std::endl);
00081   }

Here is the call graph for this function:

Here is the caller graph for this function:

bbtk::Executer::Executer ( const Executer  )  [protected]

bbtk::Executer::~Executer (  )  [protected]

Definition at line 85 of file bbtkExecuter.cxx.

References bbtkDebugMessage, mFactory, mOpenDefinition, and mOpenPackage.

00086   {
00087      bbtkDebugMessage("object",2,"==> ~Executer()" <<std::endl);
00088      mOpenDefinition.clear();
00089      mOpenPackage.clear();
00090      mFactory->Reset();
00091      mFactory.reset();
00092      bbtkDebugMessage("object",2,"<== ~Executer()" <<std::endl);
00093   }


Member Function Documentation

void bbtk::Executer::Author ( const std::string &  authorName  )  [virtual]

Adds the authorName to the Box author list.

Implements bbtk::VirtualExec.

Definition at line 487 of file bbtkExecuter.cxx.

References GetCurrentDescriptor(), and GetWorkspace().

00488   {
00489     GetCurrentDescriptor()->AddToAuthor(authorName,GetCurrentDescriptor()==GetWorkspace());
00490   }

Here is the call graph for this function:

void bbtk::Executer::BeginPackage ( const std::string &  name  )  [virtual]

Starts a package block.

Implements bbtk::VirtualExec.

Definition at line 166 of file bbtkExecuter.cxx.

References bbtkDebugMessage, GetFactory(), mOpenPackage, and New().

00167   {
00168      bbtkDebugMessage("kernel",9,"==> Executer::BeginPackage(\""<<name<<"\")"
00169                         <<std::endl);
00170      Package::Pointer p;
00171      try 
00172       {
00173          p = GetFactory()->GetPackage(name);
00174       }
00175     catch (Exception e)
00176       {
00177         p = Package::New(name,"","","");
00178         GetFactory()->InsertPackage(p);
00179       }
00180      mOpenPackage.push_back(p);
00181 
00182      bbtkDebugMessage("kernel",9,"<== Executer::BeginPackage(\""<<name<<"\")"
00183                       <<std::endl);
00184   }

Here is the call graph for this function:

void bbtk::Executer::Category ( const std::string &  category  )  [virtual]

Adds the Categories to the Box category list.

Implements bbtk::VirtualExec.

Definition at line 494 of file bbtkExecuter.cxx.

References GetCurrentDescriptor(), and GetWorkspace().

00495   {
00496     GetCurrentDescriptor()->AddToCategory(category,GetCurrentDescriptor()==GetWorkspace());
00497   }

Here is the call graph for this function:

void bbtk::Executer::Clear (  )  [virtual]

Clears the currently defined ComplexBlackBox.

Implements bbtk::VirtualExec.

Definition at line 225 of file bbtkExecuter.cxx.

References bbtkDebugMessage, and GetCurrentDescriptor().

00226   {
00227     bbtkDebugMessage("kernel",9,"==> Executer::Clear()" <<std::endl);
00228     GetCurrentDescriptor()->GetPrototype()->Clear();
00229     bbtkDebugMessage("kernel",9,"<== Executer::Clear()" <<std::endl);
00230   }

Here is the call graph for this function:

void bbtk::Executer::Connect ( const std::string &  boxfrom,
const std::string &  output,
const std::string &  boxto,
const std::string &  input 
) [virtual]

Connects the output boxOutput to the input boxInput.

Implements bbtk::VirtualExec.

Definition at line 316 of file bbtkExecuter.cxx.

References GetCurrentDescriptor().

00320   {
00321     GetCurrentDescriptor()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel);
00322   }

Here is the call graph for this function:

void bbtk::Executer::Create ( const std::string &  boxType,
const std::string &  boxName 
) [virtual]

Creates a new black box in current complex box.

Implements bbtk::VirtualExec.

Definition at line 301 of file bbtkExecuter.cxx.

References GetCurrentDescriptor().

00303   {
00304      GetCurrentDescriptor()->Add(nodeType,nodeName);
00305   }

Here is the call graph for this function:

void bbtk::Executer::Define ( const std::string &  name,
const std::string &  pack,
const std::string &  scriptfilename 
) [virtual]

Starts the definition of a new ComplexBlackBox in package pack scriptfilename is the file from which the def is read

Implements bbtk::VirtualExec.

Definition at line 195 of file bbtkExecuter.cxx.

References bbtkDebugMessage, GetFactory(), mOpenDefinition, and New().

00198   {
00199     bbtkDebugMessage("kernel",9,"==> Executer::Define(\""<<name<<
00200                      ","<<pack<<"\")"
00201                      <<std::endl);
00202 
00203     ComplexBlackBoxDescriptor::Pointer b 
00204       = ComplexBlackBoxDescriptor::New(name);
00205     b->SetFactory(GetFactory());
00206     b->SetScriptFileName(scriptfilename);
00207     mOpenDefinition.push_back( CBBDefinition( b, pack ) );
00208     
00209     bbtkDebugMessage("kernel",9,"<== Executer::Define(\""<<name<<
00210                      ","<<pack<<"\")"
00211                      <<std::endl);
00212   }

Here is the call graph for this function:

void bbtk::Executer::DefineInput ( const std::string &  name,
const std::string &  box,
const std::string &  input,
const std::string &  help 
) [virtual]

Defines an input of the current complex box.

Implements bbtk::VirtualExec.

Definition at line 344 of file bbtkExecuter.cxx.

References GetCurrentDescriptor(), GetWorkspace(), bbtk::VirtualExec::GraphicalDialog, bbtk::i, mDialogMode, mInputs, bbtk::VirtualExec::NoDialog, Set(), bbtk::std2wx(), bbtk::VirtualExec::TextDialog, and bbtk::wx2std().

00348   {
00349     // If the input is defined in the Root box
00350     if (GetCurrentDescriptor()==GetWorkspace()) 
00351       {
00352       // If the dialog mode is set to NoDialog
00353       // and the user passed the name in the Inputs map 
00354       // then the associated value is set to the box.input
00355       // This is the way command line parameters are passed to the Root box
00356          if (mDialogMode == NoDialog) 
00357          {
00358          // find if name is in mInputs
00359             std::map<std::string,std::string>::iterator i;
00360             i = mInputs.find(name);
00361             if (i!=mInputs.end()) {
00362                Set(box,input,(*i).second);
00363             }
00364          }
00365         // If the dialog mode is set to TextDialog
00366         // The user is prompted for the value
00367         else if (mDialogMode == TextDialog) 
00368         {
00369            std::cout << name << "=";
00370            std::string ans;
00371            std::cin >> ans;
00372            Set(box,input,ans);
00373         }
00374 #ifdef USE_WXWIDGETS
00375        // If the dialog mode is set to GraphicalDialog
00376        // A dialog box is pop up
00377        else if (mDialogMode == GraphicalDialog) 
00378        {
00379           std::string mess("Enter the value of '");
00380           mess += name;
00381           mess += "' (";
00382           mess += help;
00383           mess += ")";
00384           std::string title(name);
00385           title += " ?";
00386           std::string ans = wx2std ( wxGetTextFromUser( std2wx (mess), std2wx(title)));
00387           Set(box,input,ans); 
00388        }
00389 #endif
00390     }
00391 
00392     GetCurrentDescriptor()->DefineInput(name,box,input,help);
00393 
00394   }

Here is the call graph for this function:

void bbtk::Executer::DefineOutput ( const std::string &  name,
const std::string &  box,
const std::string &  output,
const std::string &  help 
) [virtual]

Defines an output of the current complex box.

Implements bbtk::VirtualExec.

Definition at line 398 of file bbtkExecuter.cxx.

References GetCurrentDescriptor().

00402   {
00403     GetCurrentDescriptor()->DefineOutput(name,box,output,help);
00404   }

Here is the call graph for this function:

void bbtk::Executer::Description ( const std::string &  d  )  [virtual]

The description string which explains what does the ComplexBox.

Implements bbtk::VirtualExec.

Definition at line 501 of file bbtkExecuter.cxx.

References GetCurrentDescriptor(), and GetWorkspace().

00502   {
00503     GetCurrentDescriptor()->AddToDescription(d,GetCurrentDescriptor()==GetWorkspace());
00504   }

Here is the call graph for this function:

void bbtk::Executer::Destroy ( const std::string &  boxName  )  [virtual]

Destroys a black box.

Implements bbtk::VirtualExec.

Definition at line 309 of file bbtkExecuter.cxx.

References GetCurrentDescriptor().

00310   {
00311     GetCurrentDescriptor()->Remove(boxName,true);
00312   }

Here is the call graph for this function:

void bbtk::Executer::EndDefine (  )  [virtual]

End the definition of a ComplexBlackBox.

Implements bbtk::VirtualExec.

Definition at line 234 of file bbtkExecuter.cxx.

References bbtkDebugMessage, GetCurrentDescriptor(), GetFactory(), mOpenDefinition, mOpenPackage, and New().

00235   {
00236     bbtkDebugMessage("kernel",9,"==> Executer::EndDefine(\""
00237                      <<GetCurrentDescriptor()->GetTypeName()<<"\")" 
00238                      <<std::endl);
00239     // Does current package exist ?
00240     Package::Pointer p;
00241     std::string pname(mOpenDefinition.back().package);
00242     if (pname.size()>0)
00243       {
00244         try
00245           {
00246             p = GetFactory()->GetPackage(pname);
00247           }
00248         catch (Exception e)
00249           {
00250             p = Package::New(pname,"","","");
00251             GetFactory()->InsertPackage(p);
00252           }
00253       }
00254     else
00255       {
00256         p = mOpenPackage.back().lock();
00257       }
00258     // Register the descriptor in the current package
00259     p->Register(GetCurrentDescriptor());
00260     
00261     bbtkDebugMessage("kernel",9,"<== Executer::EndDefine(\""
00262                      <<GetCurrentDescriptor()->GetTypeName()<<"\")" 
00263                      <<std::endl);
00264     mOpenDefinition.pop_back();
00265   }

Here is the call graph for this function:

void bbtk::Executer::EndPackage (  )  [virtual]

Ends a package block.

Implements bbtk::VirtualExec.

Definition at line 188 of file bbtkExecuter.cxx.

References mOpenPackage.

00189   {
00190     if (mOpenPackage.size()>1) mOpenPackage.pop_back();
00191   }

void bbtk::Executer::Execute ( const std::string &  box  )  [virtual]

Executes the box.

Implements bbtk::VirtualExec.

Definition at line 326 of file bbtkExecuter.cxx.

References GetCurrentDescriptor(), GetWorkspace(), and mNoExecMode.

00327   {
00328     // if in root
00329     if (GetCurrentDescriptor()==GetWorkspace()) 
00330      {
00331         if (!mNoExecMode) 
00332         {
00333            GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(nodeName)->bbExecute(true);
00334         }
00335      }
00336      else 
00337      {
00338         GetCurrentDescriptor()->AddToExecutionList(nodeName) ;
00339      }
00340   }

Here is the call graph for this function:

std::string bbtk::Executer::Get ( const std::string &  box,
const std::string &  output 
) [virtual]

gets the output of the box

Implements bbtk::VirtualExec.

Definition at line 443 of file bbtkExecuter.cxx.

References bbtkError, GetCurrentDescriptor(), GetFactory(), and bbtk::TypeName().

Referenced by Print().

00445   {
00446     BlackBox::Pointer b = GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(box);
00447     // Looks for the adaptor
00448     if (b->bbGetOutputType(output) != typeid(std::string)) 
00449       {
00450         BlackBox::Pointer a =
00451           GetFactory()->NewAdaptor(
00452                                    b->bbGetOutputType(output),
00453                                    typeid(std::string),
00454                                    "tmp");
00455         if (!a) 
00456           {
00457             bbtkError("No <"<<
00458                       TypeName(b->bbGetOutputType(output))
00459                       <<"> to <std::string> found");
00460           }
00461         b->bbExecute();
00462         
00463         a->bbSetInput("In",b->bbGetOutput(output));
00464         a->bbExecute();
00465         std::string r = a->bbGetOutput("Out").unsafe_get<std::string>();
00466         //std::string v = *((std::string*)a->bbGetOutput("Out")) ;
00467         //   std::cout << a->bbGetOutput("Out").unsafe_get<std::string>() 
00468         //             << std::endl;
00469         //std::string v(value);
00470         //b->bbSetInput(input,a->bbGetOutput("Out"));
00471         //        a->bbDelete();
00472         return r;
00473       }
00474     else
00475       {
00476         b->bbExecute();
00477         return b->bbGetOutput(output).unsafe_get<std::string>();
00478         // std::string v = *((std::string*)b->bbGetOutput(output)) ;
00479         // std::cout << b->bbGetOutput("Out").unsafe_get<std::string>() 
00480         //   << std::endl;
00481         // b->bbSetInput(input,&v);
00482       }
00483   }

Here is the call graph for this function:

Here is the caller graph for this function:

ComplexBlackBoxDescriptor::Pointer bbtk::Executer::GetCurrentDescriptor (  )  [inline]

Gets the current working black box.

Definition at line 219 of file bbtkExecuter.h.

References mOpenDefinition.

Referenced by Author(), Category(), Clear(), Connect(), Create(), DefineInput(), DefineOutput(), Description(), Destroy(), EndDefine(), Execute(), Get(), Kind(), Print(), PrintHelpBlackBox(), PrintHelpListBoxes(), Set(), and ShowGraphInstances().

00220     { return mOpenDefinition.back().box; }

Here is the caller graph for this function:

Factory::Pointer bbtk::Executer::GetFactory (  )  [inline, virtual]

Gets the factory used by the executer.

Reimplemented from bbtk::VirtualExec.

Definition at line 66 of file bbtkExecuter.h.

References mFactory.

Referenced by BeginPackage(), Define(), EndDefine(), Get(), LoadPackage(), Reset(), Set(), ShowGraph(), and UnLoadPackage().

00066 { return mFactory; }

Here is the caller graph for this function:

Interpreter::Pointer bbtk::VirtualExec::GetInterpreter (  )  [inherited]

Gets the interpreter who uses it.

Definition at line 46 of file bbtkVirtualExec.cxx.

References bbtk::VirtualExec::mInterpreter.

00047   { 
00048     return mInterpreter.lock(); 
00049   }

bool bbtk::Executer::GetNoErrorMode (  )  const [inline, virtual]

Implements bbtk::VirtualExec.

Definition at line 85 of file bbtkExecuter.h.

References mNoErrorMode.

00085 { return mNoErrorMode; }

bool bbtk::Executer::GetNoExecMode (  )  const [inline, virtual]

Implements bbtk::VirtualExec.

Definition at line 78 of file bbtkExecuter.h.

References mNoExecMode.

Referenced by Print().

00078 { return mNoExecMode; }

Here is the caller graph for this function:

std::string bbtk::Executer::GetObjectInfo (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 779 of file bbtkExecuter.cxx.

References bbtk::i.

00780   {
00781     std::stringstream i;
00782     return i.str();
00783   }

size_t bbtk::Executer::GetObjectInternalSize (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 794 of file bbtkExecuter.cxx.

Referenced by GetObjectRecursiveSize(), and GetObjectSize().

00795 {
00796   size_t s = sizeof(Executer);
00797   return s;
00798   }

Here is the caller graph for this function:

std::string bbtk::Executer::GetObjectName (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 772 of file bbtkExecuter.cxx.

00773   {
00774     return std::string("Executer");
00775   }

size_t bbtk::Executer::GetObjectRecursiveSize (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 801 of file bbtkExecuter.cxx.

References GetObjectInternalSize(), bbtk::Object::GetObjectRecursiveSize(), and mFactory.

00802   {
00803     size_t s = Superclass::GetObjectRecursiveSize();
00804     s += Executer::GetObjectInternalSize();
00805     s += mFactory->GetObjectRecursiveSize();
00806     return s;
00807   }

Here is the call graph for this function:

static long bbtk::Object::GetObjectsCount (  )  [inline, static, inherited]

Definition at line 75 of file bbtkObject.h.

Referenced by bbtk::StaticInitTime::~StaticInitTime().

00075 { return mgObjectList.size(); }

Here is the caller graph for this function:

size_t bbtk::Executer::GetObjectSize (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 786 of file bbtkExecuter.cxx.

References GetObjectInternalSize(), and bbtk::Object::GetObjectSize().

00787 {
00788   size_t s = Superclass::GetObjectSize();
00789   s += Executer::GetObjectInternalSize();
00790   return s;
00791   }

Here is the call graph for this function:

template<class U >
boost::shared_ptr<U> bbtk::Object::GetThisPointer (  )  const [inline, protected, inherited]

Definition at line 92 of file bbtkObject.h.

00093     {
00094       return boost::dynamic_pointer_cast<U>(mThisPointer.lock());
00095     }

long bbtk::Object::GetUseCount (  )  [inline, inherited]

Definition at line 63 of file bbtkObject.h.

00063 { return mThisPointer.use_count(); }

Package::Pointer bbtk::Executer::GetUserPackage (  )  [inline]

Definition at line 215 of file bbtkExecuter.h.

References mRootPackage.

Referenced by SetWorkspaceName(), and ShowGraph().

00216     { return mRootPackage.lock(); }

Here is the caller graph for this function:

ComplexBlackBoxDescriptor::Pointer bbtk::Executer::GetWorkspace (  )  [inline, virtual]

Reimplemented from bbtk::VirtualExec.

Definition at line 213 of file bbtkExecuter.h.

References mRootCBB.

Referenced by Author(), Category(), DefineInput(), Description(), Execute(), Print(), and SetWorkspaceName().

00214     { return mRootCBB.lock(); }

Here is the caller graph for this function:

void bbtk::Executer::HelpMessages (  )  [virtual]

Prints help on the messages.

Implements bbtk::VirtualExec.

Definition at line 694 of file bbtkExecuter.cxx.

References bbtk::MessageManager::PrintInfo().

00695   {
00696     bbtk::MessageManager::PrintInfo();
00697   }

Here is the call graph for this function:

void bbtk::Object::InsertInObjectList ( Pointer  p  )  [static, inherited]

Definition at line 59 of file bbtkObject.cxx.

References bbtkDebugMessage, and bbtk::Object::mgObjectList.

Referenced by bbtk::Object::MakePointer().

00060   { 
00061     bbtkDebugMessage("object",9,"##> Object::InsertInObjectList(\""
00062                      <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl);
00063     boost::weak_ptr<Object> w(p);
00064     mgObjectList.insert(w); 
00065   }

Here is the caller graph for this function:

void bbtk::Object::InsertInPackageList ( Pointer  p  )  [static, inherited]

Definition at line 69 of file bbtkObject.cxx.

References bbtkDebugMessage, and bbtk::Object::mgPackageList.

00070   { 
00071     bbtkDebugMessage("object",9,"##> Object::InsertInPackageList(\""
00072                      <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl);
00073     boost::weak_ptr<Object> w(p);
00074     mgPackageList.insert(w); 
00075   }

void bbtk::Executer::Kind ( const std::string &  kind  )  [virtual]

Sets the kind of the currently defined ComplexBlackBox.

Implements bbtk::VirtualExec.

Definition at line 269 of file bbtkExecuter.cxx.

References bbtk::BlackBoxDescriptor::ADAPTOR, bbtkError, bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR, bbtk::BlackBoxDescriptor::DEFAULT_GUI, GetCurrentDescriptor(), and bbtk::BlackBoxDescriptor::GUI.

00270   {
00271     if (kind=="ADAPTOR")
00272       {
00273         GetCurrentDescriptor()->AddToCategory("adaptor");
00274         GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::ADAPTOR);
00275       }
00276     else if (kind=="DEFAULT_ADAPTOR")
00277       {
00278         GetCurrentDescriptor()->AddToCategory("adaptor");
00279         GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR);
00280       }
00281     if (kind=="GUI")
00282       {
00283         GetCurrentDescriptor()->AddToCategory("gui");
00284         GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::GUI);
00285       }
00286     else if (kind=="DEFAULT_GUI")
00287       {
00288         GetCurrentDescriptor()->AddToCategory("gui");
00289         GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_GUI);
00290       }
00291     else
00292       {
00293         bbtkError("Unknown box kind : '"<<kind<<"'. "
00294                   <<"Valid kinds are 'ADAPTOR','DEFAULT_ADAPTOR',"
00295                   <<"'GUI','DEFAULT_GUI'");
00296       }
00297   }

Here is the call graph for this function:

void bbtk::Executer::LoadPackage ( const std::string &  name  )  [virtual]

Loads a package.

Implements bbtk::VirtualExec.

Definition at line 98 of file bbtkExecuter.cxx.

References GetFactory().

00099    {
00100      GetFactory()->LoadPackage(name);
00101    }

Here is the call graph for this function:

void bbtk::Object::LockThis (  )  [inline, protected, inherited]

Definition at line 88 of file bbtkObject.h.

00088 { mThisPointerLocked = mThisPointer.lock(); }   

template<class U , class D >
static boost::shared_ptr<U> bbtk::Object::MakePointer ( U *  s,
const D &  del,
bool  lock = false 
) [inline, static, protected, inherited]

Definition at line 115 of file bbtkObject.h.

References bbtk::Object::InsertInObjectList().

00118     {                                                                   
00119       if (s->mThisPointer.lock())                                       
00120         {                                                               
00121           boost::shared_ptr<U> p = s->GetThisPointer<U>();
00122           if (!lock) s->mThisPointerLocked.reset();
00123           return p;
00124         }                                                               
00125       boost::shared_ptr<U> p = boost::shared_ptr<U>(s,del);
00126       static_cast<D*>                                   
00127         (p._internal_get_deleter(typeid(D)))            
00128         ->mPointer = p;                                                 
00129       s->mThisPointer = p;                                              
00130       Object::InsertInObjectList(p);                                    
00131       if (lock) s->LockThis();                                          
00132       return p;                                                 
00133     }                                                                   

Here is the call graph for this function:

template<class U >
static boost::shared_ptr<U> bbtk::Object::MakePointer ( U *  s,
bool  lock = false 
) [inline, static, protected, inherited]

Definition at line 97 of file bbtkObject.h.

References bbtk::Object::InsertInObjectList().

Referenced by bbtk::ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(), Executer(), bbtk::Interpreter::Init(), bbtk::Transcriptor::New(), bbtk::Package::New(), bbtk::InterpreterVirtual::New(), bbtk::Interpreter::New(), bbtk::Factory::New(), New(), and bbtk::ComplexBlackBoxDescriptor::New().

00098     {                                                                   
00099       if (s->mThisPointer.lock())                                       
00100         {                                                               
00101           boost::shared_ptr<U> p = s->GetThisPointer<U>();
00102           if (!lock) s->mThisPointerLocked.reset();
00103           return p;
00104         }                                                               
00105       boost::shared_ptr<U> p = boost::shared_ptr<U>(s,Object::Deleter());
00106       static_cast<Object::Deleter*>                                     
00107         (p._internal_get_deleter(typeid(Object::Deleter)))              
00108         ->mPointer = p;                                                 
00109       s->mThisPointer = p;                                              
00110       Object::InsertInObjectList(p);                                    
00111       if (lock) s->LockThis();                                          
00112       return p;                                                 
00113     }                                                                   

Here is the call graph for this function:

Here is the caller graph for this function:

Executer::Pointer bbtk::Executer::New (  )  [static]

Definition at line 54 of file bbtkExecuter.cxx.

References bbtkDebugMessage, Executer(), and bbtk::Object::MakePointer().

Referenced by BeginPackage(), Define(), EndDefine(), Executer(), and Reset().

00055   {
00056     bbtkDebugMessage("object",9,"Executer::New()"<<std::endl);
00057     return MakePointer(new Executer());
00058   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::Executer::Print ( const std::string &  message  )  [virtual]

Prints the string ... MORE : TO EXPLAIN.

Implements bbtk::VirtualExec.

Definition at line 702 of file bbtkExecuter.cxx.

References bbtkDebugMessage, bbtkMessage, Get(), GetCurrentDescriptor(), GetNoExecMode(), GetWorkspace(), bbtk::i, bbtk::Utilities::SplitAroundFirstDot(), and bbtk::Utilities::SubsBackslashN().

00703   {  
00704     if (GetNoExecMode() &&  (GetCurrentDescriptor()==GetWorkspace()) ) return;
00705     if (GetCurrentDescriptor()!=GetWorkspace()) return;
00706 
00707     bbtkDebugMessage("kernel",9,"Executer::Print(\""<<str<<"\")"<<std::endl);
00708 
00709  // TO DO :
00710  // InterpretLine ("load std")
00711  // InterpretLine("new ConcatStrings _C_ ") -> trouver un nom unique : # commande 
00712  // InterpretLine("new Print _P_") 
00713  // InterpretLine("connect _C_.Out _P_.In")
00714  // int num = 1
00715  
00716 
00717     std::vector<std::string> chains;
00718     std::string delimiters("$");
00719 
00720     // Skip delimiters at beginning.
00721     std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
00722     bool is_text = true;
00723     if (lastPos>0) is_text = false;
00724 
00725     // Find first delimiter.
00726     std::string::size_type pos     = str.find_first_of(delimiters, lastPos);
00727 
00728     while (std::string::npos != pos || std::string::npos != lastPos)
00729     {
00730        if (is_text) 
00731        {
00732           // Found a text token, add it to the vector.
00733           chains.push_back(str.substr(lastPos, pos - lastPos));
00734  // std::string token = str.substr(lastPos, pos - lastPos)
00735  // InterpretLine("set _C_.In%num% %token%")
00736  
00737        }
00738        else 
00739        {
00740 
00741        // is an output (between $$) : decode 
00742          std::string tok,box,output;
00743          tok = str.substr(lastPos, pos - lastPos);
00744          Utilities::SplitAroundFirstDot(tok,box,output);
00745          chains.push_back( Get(box,output) );
00746 
00747 // InterpretLine("connect %tok% _C_.In%num%") 
00748 
00749        }
00750         // Skip delimiters.  Note the "not_of"
00751        lastPos = str.find_first_not_of(delimiters, pos);
00752         // Find next delimiter
00753        pos = str.find_first_of(delimiters, lastPos);
00754     //
00755        is_text = !is_text;
00756 // num ++;
00757      }
00758 // InterpretLine("exec _P_")
00759 // if (IS_IN_WORKSPACE) InterpretLine("delete _C_; delete _P_");
00760 
00761     std::vector<std::string>::iterator i;
00762     for (i= chains.begin(); i!=chains.end(); ++i) 
00763       {
00764         Utilities::SubsBackslashN(*i);
00765         bbtkMessage("output",1,*i);
00766       }
00767     bbtkMessage("output",1,std::endl);
00768   }

Here is the call graph for this function:

void bbtk::Executer::PrintHelpBlackBox ( const std::string &  nameblackbox,
const std::string &  detailStr,
const std::string &  levelStr 
) [virtual]

Prints help on a black box.

Implements bbtk::VirtualExec.

Definition at line 652 of file bbtkExecuter.cxx.

References bbtkError, and GetCurrentDescriptor().

00655   {
00656     bool found=false;
00657     
00658     int detail = atoi(detailStr.c_str());
00659     int level  = atoi(levelStr.c_str());
00660     BlackBox::Pointer blackbox;
00661     if (nameblackbox.compare(".")==0)
00662       {
00663         blackbox=GetCurrentDescriptor()->GetPrototype();
00664       } 
00665     else 
00666       {
00667         blackbox = GetCurrentDescriptor()->GetPrototype()->bbFindBlackBox(nameblackbox);
00668       }
00669     
00670     if (blackbox)
00671       {
00672         found=true;
00673         blackbox->bbPrintHelp(blackbox,detail,level); //,mFactory);
00674       }
00675     
00676     if (!found) 
00677       {
00678         bbtkError("box with name '"  <<nameblackbox<<"' unknown");
00679       }
00680   }

Here is the call graph for this function:

void bbtk::Executer::PrintHelpListBoxes (  )  [virtual]

prints the list off the boxes of the current box

prints the list of the boxes of the current descriptor

Implements bbtk::VirtualExec.

Definition at line 511 of file bbtkExecuter.cxx.

References bbtkMessage, and GetCurrentDescriptor().

00512   {
00513     bbtkMessage("help",1,"The black box descriptor \""
00514                 <<GetCurrentDescriptor()->GetTypeName()<<"\" contains : "<<std::endl);
00515     GetCurrentDescriptor()->PrintBlackBoxes();
00516  }

Here is the call graph for this function:

void bbtk::Object::PrintObjectInfo ( const Pointer o  )  [static, inherited]

Definition at line 180 of file bbtkObject.cxx.

Referenced by bbtk::Object::PrintObjectListInfo().

00181   {
00182     std::cout << "* [" << p << "] \t" 
00183               << p.use_count()-1 << " r \t"
00184               << p->GetObjectRecursiveSize() << " ("
00185               << p->GetObjectSize() << ") b \t"
00186               << p->GetObjectName() 
00187               << std::endl;
00188     std::cout << p->GetObjectInfo();
00189   }

Here is the caller graph for this function:

void bbtk::Object::PrintObjectListInfo ( const std::string &  name  )  [static, inherited]

Definition at line 105 of file bbtkObject.cxx.

References bbtk::i, bbtk::Object::mgObjectList, and bbtk::Object::PrintObjectInfo().

Referenced by bbtk::Interpreter::commandDebug().

00106   {
00107     
00108     std::cout 
00109       << "=============== Living bbtk::Object pointers ========="<<std::endl;
00110 
00111     long n = 0;
00112     long u = 0;
00113     size_t m = 0;
00114     ObjectListType::iterator i;
00115     for (i = mgObjectList.begin();
00116          i!=mgObjectList.end();
00117          ++i)
00118       {
00119         if (i->use_count() == 0) 
00120           {
00121             u++;
00122           }
00123         else 
00124           { 
00125             Object::Pointer p(i->lock());
00126             if (p->GetObjectName().find(name) != std::string::npos ) 
00127               {
00128                 std::cout << n << "/" << mgObjectList.size() << " ";
00129                 PrintObjectInfo(p);
00130                 m += p->GetObjectSize();
00131                 n++;
00132               }
00133           }
00134       }
00135     std::cout 
00136       << "------------------------------------------------------"<<std::endl; 
00137 
00138     std::cout << " Total : "<<n<<" objects - "<<m<<" b"<<std::endl;
00139     if (u==1)
00140       {
00141         std::cout<<"* Note : "<<u
00142                  <<" object in list has 0 ref count, "
00143                  <<"i.e. are no more accessible by bbtk but did not properly destroyed because another ref counting system is holding them !"<<std::endl;
00144       }
00145     else if (u>1)
00146       {
00147         std::cout<<"* Note : "<<u
00148                  <<" objects in list have 0 ref count, "
00149                  <<"i.e. are no more accessible by bbtk but did not properly destroyed because another ref counting system is holding them !"<<std::endl;
00150       }
00151     std::cout
00152       << "============ EO Living bbtk::Object pointers ========="<<std::endl;
00153         
00154   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::Object::ReleasePackages (  )  [static, inherited]

Definition at line 222 of file bbtkObject.cxx.

References bbtkDebugMessage, bbtk::i, bbtk::Object::mgPackageList, and bbtk::Package::Release().

Referenced by bbtk::StaticInitTime::~StaticInitTime().

00223   {
00224     bbtkDebugMessage("object",1,"##> Object::ReleasePackages()"<<std::endl);
00225     // Release package pointers
00226     ObjectListType::iterator i;
00227     for (i = mgPackageList.begin();
00228          i!= mgPackageList.end();
00229          ++i)
00230       {
00231         if (i->use_count() != 0) 
00232           { 
00233             bbtkDebugMessage("object",1,"##> Releasing package '"<<
00234                              i->lock()->GetThisPointer<Package>()->GetName()
00235                              <<"'"<<std::endl);
00236             //      Object::Pointer p(i->lock());
00237             Package::WeakPointer w(i->lock()->GetThisPointer<Package>());
00238             Package::Release(w);
00239             /*
00240             if (p->GetObjectName().find(name) != std::string::npos ) 
00241               {
00242                 std::cout << n << "/" << mgObjectList.size() << " ";
00243                 PrintObjectInfo(p);
00244                 m += p->GetObjectSize();
00245                 n++;
00246               }
00247             */
00248           }
00249       }  
00250 
00251   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::Object::RemoveFromObjectList ( WeakPointer  p  )  [static, inherited]

Definition at line 80 of file bbtkObject.cxx.

References bbtkDebugMessage, and bbtk::Object::mgObjectList.

Referenced by bbtk::Object::Deleter::operator()().

00081   { 
00082     bbtkDebugMessage("object",9,"##> Object::RemoveFromObjectList()"
00083                      <<std::endl);
00084     mgObjectList.erase(p);
00085 
00086   }

Here is the caller graph for this function:

void bbtk::Executer::Reset (  )  [virtual]

Resets the workspace : destroys all boxes / unloads all packages.

Implements bbtk::VirtualExec.

Definition at line 113 of file bbtkExecuter.cxx.

References bbtkDebugMessage, GetFactory(), mOpenDefinition, mOpenPackage, mRootCBB, mRootPackage, New(), and bbtk::Wx::ProcessPendingEvents().

Referenced by Executer().

00114   {
00115     bbtkDebugMessage("kernel",9,"==> Executer::Reset()" <<std::endl);
00116 
00117     //    GetFactory()->Check();
00118  
00119     mOpenDefinition.clear();
00120     mOpenPackage.clear();
00121 
00122     //  Wx::DestroyTopWindow();
00123 
00124     GetFactory()->Reset();
00125 #if(USE_WXWIDGETS)
00126     Wx::ProcessPendingEvents();
00127 #endif
00128  
00129     // Create user package
00130     Package::Pointer p =
00131       Package::New("user","internal","User defined black boxes","");
00132     // Insert the user package in the factory
00133     GetFactory()->InsertPackage(p);
00134     // And in the list of open packages
00135     mOpenPackage.push_back(p);
00136     mRootPackage = p;
00137 
00138     // Create user workspace
00139     ComplexBlackBoxDescriptor::Pointer r = 
00140       ComplexBlackBoxDescriptor::New("workspace"); 
00141     //    mRootCBB->Reference();
00142     r->SetFactory(GetFactory());
00143     r->AddToAuthor("bbtk");
00144     r->AddToDescription("User's workspace");
00145     mOpenDefinition.push_back(CBBDefinition(r,"user"));
00146     // Register it into the user package
00147     p->Register(r);
00148     mRootCBB = r;
00149 
00150     //    Object::PrintObjectListInfo();
00151     //  GetFactory()->CheckPackages();
00152     bbtkDebugMessage("kernel",9,"<== Executer::Reset()" <<std::endl);
00153   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::Executer::Set ( const std::string &  box,
const std::string &  input,
const std::string &  value 
) [virtual]

sets the input of the box with the value

Implements bbtk::VirtualExec.

Definition at line 408 of file bbtkExecuter.cxx.

References bbtkError, GetCurrentDescriptor(), GetFactory(), and bbtk::TypeName().

Referenced by DefineInput().

00411   {
00412     BlackBox::Pointer b = GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(box);
00413     // Looks for the adaptor
00414 
00415     if ( ( b->bbGetInputType(input) != typeid(bbtk::any<bbtk::thing>) )&&
00416          ( b->bbGetInputType(input) != typeid(std::string) ) )
00417       {
00418         BlackBox::Pointer a =
00419            GetFactory()->NewAdaptor(typeid(std::string),
00420                                     b->bbGetInputType(input),
00421                                     "tmp");
00422          if (!a) 
00423            {
00424              bbtkError("No <"<<
00425                        TypeName(b->bbGetInputType(input))
00426                        <<"> to <std::string> found");
00427            }
00428          std::string v(value);
00429          a->bbSetInput("In",v);
00430          a->bbExecute();
00431          b->bbSetInput(input,a->bbGetOutput("Out"));
00432          //         a->Delete();
00433       }
00434     else 
00435       {
00436       std::string v(value);
00437       b->bbSetInput(input,v);
00438       }
00439   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::Executer::SetCurrentFileName ( const std::string &  name  )  [virtual]

Sets the file name to use for the current definition (Used to set it after the Define command)

Sets the file name to use for the current definition (Used to set it after the Define command)

Implements bbtk::VirtualExec.

Definition at line 218 of file bbtkExecuter.cxx.

References mOpenDefinition.

00219   {
00220     mOpenDefinition.back().box->SetScriptFileName(name);
00221   }

void bbtk::Executer::SetDialogMode ( DialogModeType  t  )  [inline, virtual]

Sets the mode of dialog of the executer for Root inputs.

Implements bbtk::VirtualExec.

Definition at line 81 of file bbtkExecuter.h.

References mDialogMode.

00081 { mDialogMode = t; }

void bbtk::Executer::SetInputs ( const std::map< std::string, std::string > &  m  )  [inline, virtual]

Gets the factory used by the executer (const).

Sets the inputs of the workspace :

Implements bbtk::VirtualExec.

Definition at line 72 of file bbtkExecuter.h.

References mInputs.

00072 { mInputs = m; }

void bbtk::VirtualExec::SetInterpreter ( InterpreterPointer  i  )  [inline, inherited]

Sets the interpreter who uses it.

Definition at line 67 of file bbtkVirtualExec.h.

00067 { mInterpreter = i; }

void bbtk::Executer::SetMessageLevel ( const std::string &  kind,
int  level 
) [virtual]

Sets the level of message for kind.

sets the level of message

Implements bbtk::VirtualExec.

Definition at line 685 of file bbtkExecuter.cxx.

00687   {
00688     bbtk::MessageManager::SetMessageLevel(kind,level);
00689   }

void bbtk::Executer::SetNoErrorMode ( bool  b  )  [inline, virtual]

Puts the executer in "no error" mode, Errors do not stop execution (but warnings are produced)

Implements bbtk::VirtualExec.

Definition at line 83 of file bbtkExecuter.h.

References mNoErrorMode.

00083 { mNoErrorMode = b; }

void bbtk::Executer::SetNoExecMode ( bool  b  )  [inline, virtual]

Puts the executer in "no exec" mode, which creates but does not execute pipelines

Implements bbtk::VirtualExec.

Definition at line 76 of file bbtkExecuter.h.

References mNoExecMode.

00076 { mNoExecMode = b; }

void bbtk::Executer::SetWorkspaceName ( const std::string &  n  )  [virtual]

changes the workspace name

Implements bbtk::VirtualExec.

Definition at line 159 of file bbtkExecuter.cxx.

References GetUserPackage(), and GetWorkspace().

00160   {
00161     GetUserPackage()->ChangeDescriptorName( GetWorkspace()->GetTypeName(), n );
00162   }

Here is the call graph for this function:

std::string bbtk::Executer::ShowGraph ( const std::string &  nameblackbox,
const std::string &  detailStr,
const std::string &  levelStr,
const std::string &  output_file,
const std::string &  custom_header,
const std::string &  custom_title,
bool  system_display = true 
) [virtual]

Generate a HTML with a gif file with the current pipeline (Graphviz-dot needed). Returns the file path.

Implements bbtk::VirtualExec.

Definition at line 520 of file bbtkExecuter.cxx.

References bbtk::Utilities::FileExists(), bbtk::ConfigurationFile::Get_doc_path(), bbtk::ConfigurationFile::Get_file_separator(), GetFactory(), bbtk::ConfigurationFile::GetInstance(), and GetUserPackage().

00527   {
00528     int detail  =       atoi(detailStr.c_str());
00529     int level   =       atoi(levelStr.c_str());
00530           bool relative_link = true;
00531 
00532     Package::Pointer p;
00533     try
00534     {
00535        p = GetFactory()->GetPackage(nameblackbox);
00536     }
00537     catch (Exception e)
00538     {
00539       p = GetUserPackage();
00540     }
00541           
00542       std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
00543       doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
00544       doc_path += "bbdoc";
00545       doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
00546           
00547           std::string pack_name(p->GetName());
00548           std::string pack_path = doc_path + pack_name;
00549           // Creating directory
00550           if ( ! bbtk::Utilities::FileExists(pack_path) )
00551           {
00552                   std::string command("mkdir \"" +pack_path+ "\"");
00553                   system( command.c_str() );
00554           }
00555           std::string pack_index(pack_path);
00556           pack_index += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
00557           pack_index += "index.html"; 
00558           
00559           
00560     // Generating documentation-help of workspace
00561         p->SetDocURL(pack_index);
00562     p->SetDocRelativeURL("index.html");
00563         p->CreateHtmlPage(pack_index,"bbtk","user package",custom_header,custom_title,detail,level,relative_link);
00564           
00565     /*
00566     try 
00567     {
00568        ShowGraphTypes(nameblackbox);
00569     }
00570     catch (bbtk::Exception a)
00571     {
00572        std::cout <<"EXC"<<std::endl;
00573        page = ShowGraphInstances(nameblackbox,detail,level,system_display);
00574     }
00575     */
00576     return pack_index;
00577   }

Here is the call graph for this function:

std::string bbtk::Executer::ShowGraphInstances ( const std::string &  nameblackbox,
int  detail,
int  level,
bool  system_display = true 
) [virtual]

Generate a HTML with a gif file with the current pipeline (Graphviz-dot needed). Returns the file path.

Generate a png file with the actual pipeline (Graphviz-dot needed).

Implements bbtk::VirtualExec.

Definition at line 582 of file bbtkExecuter.cxx.

References bbtkMessage, bbtk::ConfigurationFile::Get_default_temp_dir(), GetCurrentDescriptor(), and bbtk::ConfigurationFile::GetInstance().

00584   {
00585 
00586     BlackBox::Pointer blackbox;
00587     if (nameblackbox==".")
00588     {
00589        blackbox = GetCurrentDescriptor()->GetPrototype();
00590     }
00591     else
00592     {
00593        blackbox = GetCurrentDescriptor()->GetPrototype()->bbFindBlackBox(nameblackbox);
00594     }
00595     
00596     std::string page;
00597 
00598     if (blackbox)
00599       {      
00600         // Don't pollute the file store with  "temp_dir" directories ...
00601         std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
00602         char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1];
00603 
00604         std::string directory = default_doc_dir; 
00605         if (c != '/' && c !='\\') directory = directory + "/";
00606 
00607         directory = directory +  "temp_dir";
00608         //std::string directory("temp_dir");
00609         std::string filename(directory + "/" + "bbtk_graph_pipeline");
00610         std::string filename_html(filename+".html");
00611         std::string command0("mkdir \""+directory + "\"");
00612 
00613 #if defined(_WIN32)
00614         std::string command2("start ");
00615 #else 
00616         std::string command2("gnome-open ");
00617 #endif
00618 
00619         command2=command2+filename_html;
00620         page = filename_html;
00621         // 1. Generate Html Diagram
00622         std::ofstream s;
00623         s.open(filename_html.c_str());
00624         if (s.good()) 
00625           {
00626             s << "<html><head><title>BBtk graph diagram</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>\n";
00627             s << "<body bgcolor=\"#FFFFFF\" text=\"#000000\"> \n\n";
00628             if ( blackbox->bbGetName()=="workspacePrototype" )
00629               {
00630                 s << "<center>Current workspace</center>";
00631               } else {
00632               s << "<center>" << blackbox->bbGetName()<< "</center>";
00633             } 
00634             blackbox->bbInsertHTMLGraph( s, detail, level, true, directory, false );
00635             s << "</body></html>\n";
00636           }
00637         s.close();
00638         
00639         // 2. Starting Browser
00640         if (system_display) system( command2.c_str() );      
00641       } 
00642     else 
00643       {
00644         bbtkMessage("help",1,"No black box: \""
00645                     <<nameblackbox<<"\" " <<std::endl);
00646       }
00647     return page;
00648   }

Here is the call graph for this function:

void bbtk::Executer::UnLoadPackage ( const std::string &  name  )  [virtual]

Unloads a package.

Implements bbtk::VirtualExec.

Definition at line 106 of file bbtkExecuter.cxx.

References GetFactory().

00107     {
00108       GetFactory()->UnLoadPackage(name);
00109     }

Here is the call graph for this function:

void bbtk::Object::UnLockThis (  )  [inline, protected, inherited]

Definition at line 89 of file bbtkObject.h.

00089 { mThisPointerLocked = Pointer(); }


Friends And Related Function Documentation

friend struct Object::Deleter [friend]

Reimplemented from bbtk::VirtualExec.

Definition at line 59 of file bbtkExecuter.h.


Member Data Documentation

Dialog mode.

Definition at line 276 of file bbtkExecuter.h.

Referenced by DefineInput(), and SetDialogMode().

Returns true when we are inside a define/endefine block.

The factory used

Definition at line 235 of file bbtkExecuter.h.

Referenced by Executer(), GetFactory(), GetObjectRecursiveSize(), and ~Executer().

std::map<std::string,std::string> bbtk::Executer::mInputs [private]

The input values of the Root ComplexBlackBox.

Definition at line 269 of file bbtkExecuter.h.

Referenced by DefineInput(), and SetInputs().

no error mode flag

Definition at line 279 of file bbtkExecuter.h.

Referenced by GetNoErrorMode(), and SetNoErrorMode().

no exec mode flag

Definition at line 272 of file bbtkExecuter.h.

Referenced by Execute(), GetNoExecMode(), and SetNoExecMode().

The stack of current working ComplexBlackBox (is a stack for nested definitions) only contains the root cbb when outside a define/endefine block

Definition at line 262 of file bbtkExecuter.h.

Referenced by Define(), EndDefine(), GetCurrentDescriptor(), Reset(), SetCurrentFileName(), and ~Executer().

The stack of current working package (is a stack for nested definitions)

Definition at line 266 of file bbtkExecuter.h.

Referenced by BeginPackage(), EndDefine(), EndPackage(), Reset(), and ~Executer().

The root ComplexBlackBox in which operations are done when outside a define/endefine block Its name in bbi is 'workspace'

Definition at line 247 of file bbtkExecuter.h.

Referenced by GetWorkspace(), and Reset().

The Root Package Contains the root ComplexBlabkBox In which ComplexBlackBoxes are put by default Its name in bbi is 'user'

Definition at line 242 of file bbtkExecuter.h.

Referenced by GetUserPackage(), and Reset().


The documentation for this class was generated from the following files:

Generated on Thu May 31 14:14:30 2012 for BBTK by  doxygen 1.5.7.1