X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkInterpreter.h;h=bdf3da926af354a865cba6be74955ae784853a0d;hb=31e21c4bf4e9051ae07b5ca010d2e9b74c4dc06d;hp=483068bf8935c230eb008e9b08a5c6ef09941029;hpb=41dd99d33d99d0e17448d401a1d46ef390b5d525;p=bbtk.git diff --git a/kernel/src/bbtkInterpreter.h b/kernel/src/bbtkInterpreter.h index 483068b..bdf3da9 100644 --- a/kernel/src/bbtkInterpreter.h +++ b/kernel/src/bbtkInterpreter.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.h,v $ $ Language: C++ - Date: $Date: 2008/04/22 09:40:11 $ - Version: $Revision: 1.28 $ + 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; } @@ -182,7 +185,7 @@ namespace bbtk cKind, // LG cNewGUI, // LG cWorkspace, // LG - cObject + cDebug // LG } CommandCodeType; /// The structure storing the informations on a command @@ -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 ); @@ -260,13 +263,17 @@ namespace bbtk void NewGUI(const std::string& box, const std::string& instanceName); - void ObjectInfo(const std::string& name); + void Debug(const std::string& arg); private: /// 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