]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkInterpreter.h
Some fixes
[bbtk.git] / kernel / src / bbtkInterpreter.h
index 8440873b352781f93eb0a1a6dcd7346a9ab1f705..bdf3da926af354a865cba6be74955ae784853a0d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.h,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/25 08:05:23 $
-  Version:   $Revision: 1.29 $
+  Date:      $Date: 2008/10/08 13:39:33 $
+  Version:   $Revision: 1.34 $
 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -45,7 +45,7 @@ namespace bbtk
   {
   public: 
     InterpreterUser() {}
-    ~InterpreterUser() {}
+    virtual ~InterpreterUser() {}
 
     virtual bool InterpreterUserHasOwnHtmlPageViewer() { return false; }
     virtual void InterpreterUserViewHtmlPage(const std::string&) {}
@@ -86,10 +86,11 @@ namespace bbtk
   //=======================================================================
   class BBTK_EXPORT Interpreter : public Object
   {
-    BBTK_OBJECT_INTERFACE(Interpreter);
+    BBTK_OBJECT_INTERFACE_NO_CONDES(Interpreter);
     typedef Object Superclass;
   public:
     static Pointer New(const std::string& cpp_file = "");
+    static Pointer New(VirtualExec::Pointer);
 
     typedef enum 
       {
@@ -100,7 +101,7 @@ namespace bbtk
       ExitStatus;
 
     /// Runs the interpretation of a file
-    ExitStatus InterpretFile( const std::string& filename);
+    ExitStatus InterpretFile( const std::string& filename, bool source = false);
 
     /// Runs the interpretation of a buffer and deletes it !
     ExitStatus InterpretBuffer( std::stringstream* buffer );
@@ -121,14 +122,16 @@ namespace bbtk
 
     /// Puts the executer in "no exec" mode,
     /// which creates but does not execute pipelines.
-    void SetNoExecMode(bool b) { mVirtualExecuter->SetNoExecMode(b); }
+    void SetNoExecMode(bool m) { mVirtualExecuter->SetNoExecMode(m); }
 
+    /// Puts the executer in "no error" mode, 
+    /// Errors do not stop execution (but warnings are produced)
+    void SetNoErrorMode(bool m) { mVirtualExecuter->SetNoErrorMode(m);}
     ///
     //typedef Executer::DialogModeType DialogModeType;
     typedef VirtualExec::DialogModeType DialogModeType;
 
-    void SetDialogMode(DialogModeType t) 
-    { mVirtualExecuter->SetDialogMode(t); }
+    void SetDialogMode(DialogModeType t) { mVirtualExecuter->SetDialogMode(t);}
 
     /// Sets the bool that indicates wether we are in command line context
     void SetCommandLine(bool v = true) { mCommandLine = v; }
@@ -214,7 +217,7 @@ namespace bbtk
                            CommandInfoType& info );
 
     /// Switch to the interpretation of a file
-    void SwitchToFile( const std::string& filename );
+    void SwitchToFile( const std::string& filename, bool source = false );
 
    /// Switch to the interpretation of a stringstream
     void SwitchToStream( std::stringstream* stream );
@@ -267,6 +270,10 @@ namespace bbtk
     /// Constructor
     Interpreter(const std::string& cpp_file = "");
 
+    Interpreter(VirtualExec::Pointer);
+
+    void Init(VirtualExec::Pointer, const std::string& cpp_file);
+
     /// Opens the file fullPathScriptName 
     /// includeScriptName is the name as given to the include command 
     void LoadScript( std::string fullPathScriptName,
@@ -319,6 +326,9 @@ namespace bbtk
     
     bool mThrow;
 
+       protected:
+       ~Interpreter();
+
   };
   // EO class Interpreter