]> Creatis software - bbtk.git/blob - kernel/src/bbtkInterpreterPy.cxx
95900b42ff40bb6b807b8fa08e004e5bae337061
[bbtk.git] / kernel / src / bbtkInterpreterPy.cxx
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 #                        pour la Santé)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 #
8 #  This software is governed by the CeCILL-B license under French law and
9 #  abiding by the rules of distribution of free software. You can  use,
10 #  modify and/ or redistribute the software under the terms of the CeCILL-B
11 #  license as circulated by CEA, CNRS and INRIA at the following URL
12 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
13 #  or in the file LICENSE.txt.
14 #
15 #  As a counterpart to the access to the source code and  rights to copy,
16 #  modify and redistribute granted by the license, users are provided only
17 #  with a limited warranty  and the software's author,  the holder of the
18 #  economic rights,  and the successive licensors  have only  limited
19 #  liability.
20 #
21 #  The fact that you are presently reading this means that you have had
22 #  knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------
24  */
25
26 /*=========================================================================
27 Program:   bbtk
28 Module:    $RCSfile$
29 Language:  C++
30 Date:      $Date$
31 Version:   $Revision$
32 =========================================================================*/
33
34
35 /**
36  *  \file
37  *  \brief Class bbtk::BBPInterpreter
38  */
39
40
41 #include "bbtkInterpreterPy.h"
42
43 #include "bbtkExecuter.h"
44 #include "bbtkMessageManager.h"
45 #include "bbtkFactory.h"
46 #include "bbtkUtilities.h"
47
48 namespace bbtk
49 {
50
51   //=========================================================================
52     InterpreterPy::Pointer InterpreterPy::New()
53     {
54         return MakePointer( new InterpreterPy() );
55     }
56   //=========================================================================
57
58
59
60   //=========================================================================
61     InterpreterPy::InterpreterPy()
62     {
63         bbtk::InterpreterVirtual::Init();
64     }
65   //=========================================================================
66
67   //=========================================================================
68     InterpreterPy::~InterpreterPy()
69     {
70     }
71   //=========================================================================
72
73
74   //=========================================================================
75   /// Creates a new black box in current complex box
76   void InterpreterPy::commandNew( const std::string& boxType, const std::string& boxName) // virtual
77   {
78       int pos = boxType.find( std::string(":") );
79       std::string boxTypeTmp=boxType;
80       boxTypeTmp.replace(pos,1,"_");
81       // ex:   mCB.New( bbtkBlackBox.std_ConcatString("Box10") )
82       std::string  code("New( "+boxTypeTmp+"('"+boxName+"') )");
83       this->pythonBBTK.push_back(code);
84   }
85   //=========================================================================
86
87
88   //=========================================================================
89   /// Connects the output boxOutput to the input boxInput
90   void InterpreterPy::commandConnection (const std::string &boxfrom,
91       const std::string &output,
92       const std::string &boxto,
93       const std::string &input)                 // virtual
94   {
95       //ex: mCB.Connection( "Box10" , "Out", "Box11", "In")
96       std::string  code("Connection('"+boxfrom+"','"+output+"','"+boxto+"','"+input+"')");
97       this->pythonBBTK.push_back(code);
98   }
99   //=========================================================================
100
101   //=========================================================================
102   void InterpreterPy::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string  &help)
103   {
104   }
105   //=========================================================================
106
107   //=========================================================================
108   void InterpreterPy::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string  &help)
109   {
110   }
111   //=========================================================================
112
113
114   //=========================================================================
115   /// sets the input of the box with the value
116   void InterpreterPy::commandSet(const std::string &box,const std::string &input,const std::string &value) // virtual
117   {
118       //ex:     mCB.Set("Box10","In2","/hola.mhd")
119       std::string  code("Set('"+box+"','"+input+"','"+value+"')");
120       this->pythonBBTK.push_back(code);
121   }
122   //=========================================================================
123
124
125   //=========================================================================
126   void InterpreterPy::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual
127   {
128   }
129   //=========================================================================
130
131
132   //=========================================================================
133   void InterpreterPy::commandEndDefine() // virtual
134   {
135   }
136   //=========================================================================
137
138
139   //=========================================================================
140   void InterpreterPy::commandExec(const std::string &word) // virtual
141   {
142       //Ex:     mCB.AddToExecutableLst("Box13")
143       std::string  code("AddToExecutableLst('"+word+"')");
144       this->pythonBBTK.push_back(code);
145   }
146   //=========================================================================
147
148
149   //=========================================================================
150   void InterpreterPy::commandAuthor(const std::string &author)  // virtual
151   {
152   }
153   //=========================================================================
154
155   //=========================================================================
156   void InterpreterPy::commandCategory(const std::string &categorytype)  // virtual
157   {
158   }
159   //=========================================================================
160
161   //=========================================================================
162   void InterpreterPy::commandDescription(const std::string &description)  // virtual
163   {
164   }
165   //=========================================================================
166
167 }  // EO namespace bbtk
168
169 // EOF
170