]> Creatis software - bbtk.git/blob - kernel/src/bbtkExecuter.cxx
MagicBox : support of data synchronization + various related fixes
[bbtk.git] / kernel / src / bbtkExecuter.cxx
1 /*=========================================================================                                                                               
2   Program:   bbtk
3   Module:    $RCSfile: bbtkExecuter.cxx,v $
4   Language:  C++
5   Date:      $Date: 2009/03/30 14:42:16 $
6   Version:   $Revision: 1.28 $
7 =========================================================================*/
8
9 /* ---------------------------------------------------------------------
10
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
13 *
14 *  This software is governed by the CeCILL-B license under French law and 
15 *  abiding by the rules of distribution of free software. You can  use, 
16 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
17 *  license as circulated by CEA, CNRS and INRIA at the following URL 
18 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
19 *  or in the file LICENSE.txt.
20 *
21 *  As a counterpart to the access to the source code and  rights to copy,
22 *  modify and redistribute granted by the license, users are provided only
23 *  with a limited warranty  and the software's author,  the holder of the
24 *  economic rights,  and the successive licensors  have only  limited
25 *  liability. 
26 *
27 *  The fact that you are presently reading this means that you have had
28 *  knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */                                                                         
30
31 /**
32  *  \file 
33  *  \brief class Executer: level 0 of script execution (code)
34  */
35
36 #include "bbtkExecuter.h"
37 #include "bbtkMessageManager.h"
38 #include "bbtkFactory.h"
39 #include "bbtkUtilities.h"
40 #include <fstream>
41
42 #ifdef USE_WXWIDGETS
43 #include <wx/textdlg.h>
44 #endif
45
46 #include "bbtkWxBlackBox.h"
47
48 #include "bbtkConfigurationFile.h"
49
50 namespace bbtk
51 {
52   //=======================================================================
53   Executer::Pointer Executer::New()
54   {
55     bbtkDebugMessage("Kernel",9,"Executer::New()"<<std::endl);
56     return MakePointer(new Executer());
57   }
58   //=======================================================================
59
60   //=======================================================================
61   Executer::Executer()
62     : 
63     mFactory(),
64     mRootPackage(),
65     mRootCBB(),
66     mNoExecMode(false),
67     mDialogMode(NoDialog),
68     mNoErrorMode(false)
69   {
70     bbtkDebugMessageInc("Kernel",9,"Executer::Executer()" <<std::endl);
71     mFactory = Factory::New();
72     // The smart pointer on this is not made yet (is made by New) 
73     // -> create it to pass it to the factory
74     // We have to "lock" the smart pointer because the factory
75     // only keeps a weak pointer on the executer
76     // -> this would auto-destroy !!
77     mFactory->SetExecuter(MakePointer(this,true));
78     Reset();
79     bbtkDebugDecTab("Kernel",9);
80   }
81   //=======================================================================
82
83   //=======================================================================
84   Executer::~Executer()
85   {
86      bbtkDebugMessageInc("Kernel",9,"==> Executer::~Executer()" <<std::endl);
87      mOpenDefinition.clear();
88      mOpenPackage.clear();
89      mFactory->Reset();
90      mFactory.reset();
91      bbtkDebugDecTab("Kernel",9);
92   }
93   //=======================================================================
94
95   //=======================================================================
96    /// Loads a package
97     void Executer::LoadPackage(const std::string &name )
98    {
99      GetFactory()->LoadPackage(name);
100    }
101   //=======================================================================
102
103   //=======================================================================
104     /// Unloads a package
105     void Executer::UnLoadPackage(const std::string &name )
106     {
107       GetFactory()->UnLoadPackage(name);
108     }
109   //=======================================================================
110
111   //=======================================================================
112   void Executer::Reset()
113   {
114     bbtkDebugMessageInc("Kernel",9,"Executer::Reset()" <<std::endl);
115
116     GetFactory()->CheckPackages();
117  
118     mOpenDefinition.clear();
119     mOpenPackage.clear();
120     GetFactory()->Reset();
121
122     // Create user package
123     Package::Pointer p =
124       Package::New("user","internal","User defined black boxes","");
125     // Insert the user package in the factory
126     GetFactory()->InsertPackage(p);
127     // And in the list of open packages
128     mOpenPackage.push_back(p);
129     mRootPackage = p;
130
131     // Create user workspace
132     ComplexBlackBoxDescriptor::Pointer r = 
133       ComplexBlackBoxDescriptor::New("workspace"); 
134     //    mRootCBB->Reference();
135     r->SetFactory(GetFactory());
136     r->AddToAuthor("bbtk");
137     r->AddToDescription("User's workspace");
138     mOpenDefinition.push_back(CBBDefinition(r,"user"));
139     // Register it into the user package
140     p->RegisterBlackBox(r);
141     mRootCBB = r;
142
143     //    Object::PrintObjectListInfo();
144     //  GetFactory()->CheckPackages();
145
146     bbtkDebugDecTab("Kernel",9);
147   }
148   //=======================================================================
149
150
151   //=======================================================================
152   /// changes the workspace name
153   void Executer::SetWorkspaceName( const std::string& n )
154   {
155     GetUserPackage()->ChangeBlackBoxName( GetWorkspace()->GetTypeName(), n );
156   }
157   //=======================================================================
158
159   //=======================================================================
160   void Executer::BeginPackage (const std::string &name)
161   {
162      bbtkDebugMessageInc("Kernel",9,"Executer::BeginPackage(\""<<name<<"\")"
163                         <<std::endl);
164      Package::Pointer p;
165      try 
166       {
167          p = GetFactory()->GetPackage(name);
168       }
169     catch (Exception e)
170       {
171         p = Package::New(name,"","","");
172         GetFactory()->InsertPackage(p);
173       }
174      mOpenPackage.push_back(p);
175   }
176   //=======================================================================
177
178   //=======================================================================
179   void Executer::EndPackage()
180   {
181     if (mOpenPackage.size()>1) mOpenPackage.pop_back();
182   }
183   //=======================================================================
184
185   //=======================================================================
186   void Executer::Define (const std::string &name,
187                          const std::string &pack,
188                          const std::string &scriptfilename)
189   {
190     bbtkDebugMessageInc("Kernel",9,"Executer::Define(\""<<name<<
191                         ","<<pack<<"\")"
192                         <<std::endl);
193
194     ComplexBlackBoxDescriptor::Pointer b 
195       = ComplexBlackBoxDescriptor::New(name);
196     b->SetFactory(GetFactory());
197     b->SetScriptFileName(scriptfilename);
198     mOpenDefinition.push_back( CBBDefinition( b, pack ) );
199     
200     bbtkDebugDecTab("Kernel",9);
201   }
202   //=======================================================================
203
204   //=======================================================================
205   /// Sets the file name to use for the current definition
206   /// (Used to set it after the Define command)
207   void Executer::SetCurrentFileName (const std::string &name )
208   {
209     mOpenDefinition.back().box->SetScriptFileName(name);
210   }
211   //=======================================================================
212
213   //=======================================================================
214   void Executer::Clear()
215   {
216     bbtkDebugMessageInc("Kernel",9,"Executer::Clear()" <<std::endl);
217     GetCurrentDescriptor()->GetPrototype()->Clear();
218
219   }
220   //=======================================================================
221
222   //=======================================================================
223   void Executer::EndDefine ()
224   {
225     bbtkDebugMessageInc("Kernel",9,"Executer::EndDefine(\""
226                         <<GetCurrentDescriptor()->GetTypeName()<<"\")" 
227                         <<std::endl);
228     // Does current package exist ?
229     Package::Pointer p;
230     std::string pname(mOpenDefinition.back().package);
231     if (pname.size()>0)
232       {
233         try
234           {
235             p = GetFactory()->GetPackage(pname);
236           }
237         catch (Exception e)
238           {
239             p = Package::New(pname,"","","");
240             GetFactory()->InsertPackage(p);
241           }
242       }
243     else
244       {
245         p = mOpenPackage.back().lock();
246       }
247     p->RegisterBlackBox(GetCurrentDescriptor());
248     
249     mOpenDefinition.pop_back();
250   }
251   //======================================================================= 
252
253   //=======================================================================  
254   void Executer::Kind(const std::string& kind)
255   {
256     if (kind=="ADAPTOR")
257       {
258         GetCurrentDescriptor()->AddToCategory("adaptor");
259         GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::ADAPTOR);
260       }
261     else if (kind=="DEFAULT_ADAPTOR")
262       {
263         GetCurrentDescriptor()->AddToCategory("adaptor");
264         GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR);
265       }
266     if (kind=="GUI")
267       {
268         GetCurrentDescriptor()->AddToCategory("gui");
269         GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::GUI);
270       }
271     else if (kind=="DEFAULT_GUI")
272       {
273         GetCurrentDescriptor()->AddToCategory("gui");
274         GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_GUI);
275       }
276     else
277       {
278         bbtkError("Unknown box kind : '"<<kind<<"'. "
279                   <<"Valid kinds are 'ADAPTOR','DEFAULT_ADAPTOR',"
280                   <<"'GUI','DEFAULT_GUI'");
281       }
282   }
283   //=======================================================================
284
285   //=======================================================================
286   void Executer::Create ( const std::string& nodeType, 
287                           const std::string& nodeName)
288   {
289      GetCurrentDescriptor()->Add(nodeType,nodeName);
290   }
291   //=======================================================================
292
293   //=======================================================================
294   void Executer::Destroy(const std::string &boxName)
295   {
296     GetCurrentDescriptor()->Remove(boxName,true);
297   }
298   //=======================================================================
299
300   //=======================================================================
301   void Executer::Connect (const std::string &nodeFrom,
302                           const std::string &outputLabel,
303                           const std::string &nodeTo, 
304                           const std::string &inputLabel)
305   {
306     GetCurrentDescriptor()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel);
307   }
308   //=======================================================================
309
310   //=======================================================================
311   void Executer::Execute (const std::string &nodeName) 
312   {
313     // if in root
314     if (GetCurrentDescriptor()==GetWorkspace()) 
315      {
316         if (!mNoExecMode) 
317         {
318            GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(nodeName)->bbExecute(true);
319         }
320      }
321      else 
322      {
323         GetCurrentDescriptor()->AddToExecutionList(nodeName) ;
324      }
325   }
326   //=======================================================================
327
328   //=======================================================================
329   void Executer::DefineInput ( const std::string &name,
330                                const std::string &box,
331                                const std::string &input,
332                                const std::string& help)
333   {
334     // If the input is defined in the Root box
335     if (GetCurrentDescriptor()==GetWorkspace()) 
336       {
337       // If the dialog mode is set to NoDialog
338       // and the user passed the name in the Inputs map 
339       // then the associated value is set to the box.input
340       // This is the way command line parameters are passed to the Root box
341          if (mDialogMode == NoDialog) 
342          {
343          // find if name is in mInputs
344             std::map<std::string,std::string>::iterator i;
345             i = mInputs.find(name);
346             if (i!=mInputs.end()) {
347                Set(box,input,(*i).second);
348             }
349          }
350         // If the dialog mode is set to TextDialog
351         // The user is prompted for the value
352         else if (mDialogMode == TextDialog) 
353         {
354            std::cout << name << "=";
355            std::string ans;
356            std::cin >> ans;
357            Set(box,input,ans);
358         }
359 #ifdef USE_WXWIDGETS
360        // If the dialog mode is set to GraphicalDialog
361        // A dialog box is pop up
362        else if (mDialogMode == GraphicalDialog) 
363        {
364           std::string mess("Enter the value of '");
365           mess += name;
366           mess += "' (";
367           mess += help;
368           mess += ")";
369           std::string title(name);
370           title += " ?";
371           std::string ans = wx2std ( wxGetTextFromUser( std2wx (mess), std2wx(title)));
372           Set(box,input,ans); 
373        }
374 #endif
375     }
376
377     GetCurrentDescriptor()->DefineInput(name,box,input,help);
378
379   }
380   //=======================================================================
381
382   //=======================================================================
383    void Executer::DefineOutput ( const std::string &name,
384                                  const std::string &box,
385                                  const std::string &output,
386                                  const std::string& help)
387   {
388     GetCurrentDescriptor()->DefineOutput(name,box,output,help);
389   }
390   //=======================================================================
391
392   //=======================================================================
393   void Executer::Set (const std::string &box,
394                       const std::string &input,
395                       const std::string &value)
396   {
397     BlackBox::Pointer b = GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(box);
398     // Looks for the adaptor
399
400     if ( ( b->bbGetInputType(input) != typeid(bbtk::any<bbtk::thing>) )&&
401          ( b->bbGetInputType(input) != typeid(std::string) ) )
402       {
403         BlackBox::Pointer a =
404            GetFactory()->NewAdaptor(typeid(std::string),
405                                     b->bbGetInputType(input),
406                                     "tmp");
407          if (!a) 
408            {
409              bbtkError("No <"<<
410                        TypeName(b->bbGetInputType(input))
411                        <<"> to <std::string> found");
412            }
413          std::string v(value);
414          a->bbSetInput("In",v);
415          a->bbExecute();
416          b->bbSetInput(input,a->bbGetOutput("Out"));
417          //         a->Delete();
418       }
419     else 
420       {
421       std::string v(value);
422       b->bbSetInput(input,v);
423       }
424   }
425   //=======================================================================
426
427   //=======================================================================
428   std::string Executer::Get(const std::string &box,
429                             const std::string &output)
430   {
431     BlackBox::Pointer b = GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(box);
432     // Looks for the adaptor
433     if (b->bbGetOutputType(output) != typeid(std::string)) 
434       {
435         BlackBox::Pointer a =
436           GetFactory()->NewAdaptor(
437                                    b->bbGetOutputType(output),
438                                    typeid(std::string),
439                                    "tmp");
440         if (!a) 
441           {
442             bbtkError("No <"<<
443                       TypeName(b->bbGetOutputType(output))
444                       <<"> to <std::string> found");
445           }
446         b->bbExecute();
447         
448         a->bbSetInput("In",b->bbGetOutput(output));
449         a->bbExecute();
450         std::string r = a->bbGetOutput("Out").unsafe_get<std::string>();
451         //std::string v = *((std::string*)a->bbGetOutput("Out")) ;
452         //   std::cout << a->bbGetOutput("Out").unsafe_get<std::string>() 
453         //             << std::endl;
454         //std::string v(value);
455         //b->bbSetInput(input,a->bbGetOutput("Out"));
456         //        a->bbDelete();
457         return r;
458       }
459     else
460       {
461         b->bbExecute();
462         return b->bbGetOutput(output).unsafe_get<std::string>();
463         // std::string v = *((std::string*)b->bbGetOutput(output)) ;
464         // std::cout << b->bbGetOutput("Out").unsafe_get<std::string>() 
465         //   << std::endl;
466         // b->bbSetInput(input,&v);
467       }
468   }
469   //=======================================================================
470
471   //=======================================================================
472   void Executer::Author(const std::string &authorName)
473   {
474     GetCurrentDescriptor()->AddToAuthor(authorName,GetCurrentDescriptor()==GetWorkspace());
475   }
476   //=======================================================================
477
478   //=======================================================================
479   void Executer::Category(const std::string &category)
480   {
481     GetCurrentDescriptor()->AddToCategory(category,GetCurrentDescriptor()==GetWorkspace());
482   }
483   //=======================================================================
484
485   //=======================================================================
486   void Executer::Description(const std::string &d)
487   {
488     GetCurrentDescriptor()->AddToDescription(d,GetCurrentDescriptor()==GetWorkspace());
489   }
490   //=======================================================================
491
492   //=======================================================================
493   /// prints the list of the boxes of the current descriptor
494   void Executer::PrintBoxes()
495   {
496     bbtkMessageInc("Help",1,"The black box descriptor \""
497                    <<GetCurrentDescriptor()->GetTypeName()<<"\" contains : "<<std::endl);
498     GetCurrentDescriptor()->PrintBlackBoxes();
499     bbtkDecTab("Help",1);
500  }
501   //=======================================================================
502
503   //=======================================================================
504   std::string Executer::ShowGraph(const std::string &nameblackbox, 
505                                   const std::string &detailStr, 
506                                   const std::string &levelStr,
507                                   const std::string &output_html,
508                                   const std::string &custom_header,
509                                   const std::string &custom_title,
510                                   bool system_display )
511   {
512     int detail  =       atoi(detailStr.c_str());
513     int level   =       atoi(levelStr.c_str());
514
515     std::string filename_rootHtml (output_html) ;
516     std::string simplefilename_rootHtml ( Utilities::get_file_name(output_html));
517
518     bool relative_link = true;
519
520     // No output provided : automatic generation
521     if (output_html.length() == 0)
522       {
523                 // Don't pollute the file store with  "temp_dir" directories ...    
524                 std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
525         
526                 char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1];
527         
528                 std::string directory = default_doc_dir; 
529                 if (c != '/' && c !='\\') directory = directory + "/";
530                 directory = directory +  "temp_dir";    
531         
532                 filename_rootHtml = directory + "/" + "User.html";
533                 simplefilename_rootHtml = "User.html" ;
534
535                 // Creating directory
536                 std::string command0("mkdir \"" +directory + "\"");
537                 system( command0.c_str() );
538
539                 relative_link = false;
540       }
541
542     Package::Pointer p;
543     try
544     {
545        p = GetFactory()->GetPackage(nameblackbox);
546     }
547     catch (Exception e)
548     {
549       p = GetUserPackage();
550     }
551     // Generating documentation-help of workspace
552     p->SetDocURL(filename_rootHtml);
553     p->SetDocRelativeURL(simplefilename_rootHtml);
554
555     p->CreateHtmlPage(filename_rootHtml,"bbtk","user package",custom_header,custom_title,detail,level,relative_link);
556
557     std::string page = filename_rootHtml;
558     /*
559     try 
560     {
561        ShowGraphTypes(nameblackbox);
562     }
563     catch (bbtk::Exception a)
564     {
565        std::cout <<"EXC"<<std::endl;
566        page = ShowGraphInstances(nameblackbox,detail,level,system_display);
567     }
568     */
569     return page;
570   }
571   //=======================================================================
572
573   //=======================================================================
574   /// Generate a png file with the actual pipeline (Graphviz-dot needed)
575   std::string Executer::ShowGraphInstances(const std::string &nameblackbox, int detail, int level,
576                                            bool system_display)
577   {
578
579     BlackBox::Pointer blackbox;
580     if (nameblackbox==".")
581     {
582        blackbox = GetCurrentDescriptor()->GetPrototype();
583     }
584     else
585     {
586        blackbox = GetCurrentDescriptor()->GetPrototype()->bbFindBlackBox(nameblackbox);
587     }
588     
589     std::string page;
590
591     if (blackbox)
592       {      
593         // Don't pollute the file store with  "temp_dir" directories ...
594         std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
595         char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1];
596
597         std::string directory = default_doc_dir; 
598         if (c != '/' && c !='\\') directory = directory + "/";
599
600         directory = directory +  "temp_dir";
601         //std::string directory("temp_dir");
602         std::string filename(directory + "/" + "bbtk_graph_pipeline");
603         std::string filename_html(filename+".html");
604         std::string command0("mkdir \""+directory + "\"");
605
606 #if defined(_WIN32)
607         std::string command2("start ");
608 #else 
609         std::string command2("gnome-open ");
610 #endif
611
612         command2=command2+filename_html;
613         page = filename_html;
614         // 1. Generate Html Diagram
615         std::ofstream s;
616         s.open(filename_html.c_str());
617         if (s.good()) 
618           {
619             s << "<html><head><title>BBtk graph diagram</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>\n";
620             s << "<body bgcolor=\"#FFFFFF\" text=\"#000000\"> \n\n";
621             if ( blackbox->bbGetName()=="workspacePrototype" )
622               {
623                 s << "<center>Current workspace</center>";
624               } else {
625               s << "<center>" << blackbox->bbGetName()<< "</center>";
626             } 
627
628             blackbox->bbInsertHTMLGraph( s, detail, level, true, directory, false );
629             s << "</body></html>\n";
630           }
631         s.close();
632         
633         // 2. Starting Browser
634         if (system_display) system( command2.c_str() );      
635       } 
636     else 
637       {
638         bbtkMessageInc("Help",1,"No black box: \""
639                        <<nameblackbox<<"\" " <<std::endl);
640       }
641     return page;
642   }
643   //=======================================================================
644
645   //=======================================================================
646   void Executer::ShowRelations(const std::string &nameblackbox, 
647                                const std::string &detailStr, 
648                                const std::string &levelStr)
649   {
650     bool found=false;
651     
652     int detail = atoi(detailStr.c_str());
653     int level  = atoi(levelStr.c_str());
654     BlackBox::Pointer blackbox;
655     if (nameblackbox.compare(".")==0)
656       {
657         blackbox=GetCurrentDescriptor()->GetPrototype();
658       } 
659     else 
660       {
661         blackbox = GetCurrentDescriptor()->GetPrototype()->bbFindBlackBox(nameblackbox);
662       }
663     
664     if (blackbox)
665       {
666         found=true;
667         blackbox->bbShowRelations(blackbox,detail,level); //,mFactory);
668       }
669     
670     if (!found) 
671       {
672         bbtkError("Blackbox Name not found.. <"  <<nameblackbox<<">");
673       }
674   }
675   //=======================================================================
676
677   //=======================================================================
678   /// sets the level of message
679   void Executer::SetMessageLevel(const std::string &kind,
680                                  int level)
681   {
682     bbtk::MessageManager::SetMessageLevel(kind,level);
683   }
684   //=======================================================================
685
686   //=======================================================================
687   /// Prints help on the messages
688   void  Executer::HelpMessages()
689   {
690     bbtk::MessageManager::PrintInfo();
691   }
692   //=======================================================================
693
694   //=======================================================================
695   ///
696   void Executer::Print(const std::string &str)
697   {  
698     if (GetNoExecMode() &&  (GetCurrentDescriptor()==GetWorkspace()) ) return;
699     if (GetCurrentDescriptor()!=GetWorkspace()) return;
700
701     bbtkDebugMessageInc("Interpreter",9,"Interpreter::Print(\""<<str<<"\")"<<std::endl);
702
703  // TO DO :
704  // InterpretLine ("load std")
705  // InterpretLine("new ConcatStrings _C_ ") -> trouver un nom unique : # commande 
706  // InterpretLine("new Print _P_") 
707  // InterpretLine("connect _C_.Out _P_.In")
708  // int num = 1
709  
710
711     std::vector<std::string> chains;
712     std::string delimiters("$");
713
714     // Skip delimiters at beginning.
715     std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
716     bool is_text = true;
717     if (lastPos>0) is_text = false;
718
719     // Find first delimiter.
720     std::string::size_type pos     = str.find_first_of(delimiters, lastPos);
721
722     while (std::string::npos != pos || std::string::npos != lastPos)
723     {
724        if (is_text) 
725        {
726           // Found a text token, add it to the vector.
727           chains.push_back(str.substr(lastPos, pos - lastPos));
728  // std::string token = str.substr(lastPos, pos - lastPos)
729  // InterpretLine("set _C_.In%num% %token%")
730  
731        }
732        else 
733        {
734
735        // is an output (between $$) : decode 
736          std::string tok,box,output;
737          tok = str.substr(lastPos, pos - lastPos);
738          Utilities::SplitAroundFirstDot(tok,box,output);
739          chains.push_back( Get(box,output) );
740
741 // InterpretLine("connect %tok% _C_.In%num%") 
742
743        }
744         // Skip delimiters.  Note the "not_of"
745        lastPos = str.find_first_not_of(delimiters, pos);
746         // Find next delimiter
747        pos = str.find_first_of(delimiters, lastPos);
748     //
749        is_text = !is_text;
750 // num ++;
751      }
752 // InterpretLine("exec _P_")
753 // if (IS_IN_WORKSPACE) InterpretLine("delete _C_; delete _P_");
754
755     std::vector<std::string>::iterator i;
756     for (i= chains.begin(); i!=chains.end(); ++i) 
757       {
758         Utilities::SubsBackslashN(*i);
759         bbtkMessage("Output",1,*i);
760       }
761     bbtkMessage("Output",1,std::endl);
762   }
763   //==========================================================================
764
765   //==========================================================================
766   std::string Executer::GetObjectName() const
767   {
768     return std::string("Executer");
769   }
770   //==========================================================================
771   
772   //==========================================================================
773   std::string  Executer::GetObjectInfo() const 
774   {
775     std::stringstream i;
776     return i.str();
777   }
778   //==========================================================================
779   //==========================================================================
780 size_t  Executer::GetObjectSize() const 
781 {
782   size_t s = Superclass::GetObjectSize();
783   s += Executer::GetObjectInternalSize();
784   return s;
785   }
786   //==========================================================================
787   //==========================================================================
788 size_t  Executer::GetObjectInternalSize() const 
789 {
790   size_t s = sizeof(Executer);
791   return s;
792   }
793   //==========================================================================
794   //==========================================================================
795   size_t  Executer::GetObjectRecursiveSize() const 
796   {
797     size_t s = Superclass::GetObjectRecursiveSize();
798     s += Executer::GetObjectInternalSize();
799     s += mFactory->GetObjectRecursiveSize();
800     return s;
801   }
802   //==========================================================================
803 }//namespace