1 /*=========================================================================
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
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.
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
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 * ------------------------------------------------------------------------ */
34 * Design and Developpement of BBTK GEditor
35 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
39 #include "GBlackBoxModel.h"
43 //=========================================================================
45 GBlackBoxModel::GBlackBoxModel()
47 _isExecutable = false;
50 //=========================================================================
52 GBlackBoxModel::~GBlackBoxModel()
56 //=========================================================================
58 std::string GBlackBoxModel::getBBTKPackage()
63 //=========================================================================
65 void GBlackBoxModel::setBBTKPackage(std::string obpackage)
67 _bbtkPackage = obpackage;
70 //=========================================================================
72 bool GBlackBoxModel::isExecutable()
77 //=========================================================================
79 void GBlackBoxModel::setExecutable(bool executable)
81 _isExecutable = executable;
84 //=========================================================================
86 std::string GBlackBoxModel::getStatusText()
88 std::string temp = "";
98 //=========================================================================
100 void GBlackBoxModel::setValueToInputPort(int pos,std::string value)
102 _inputs[pos]->setValue(value);
105 //=========================================================================
107 void GBlackBoxModel::save(std::string &content)
111 content+=_bbtkPackage;
131 sprintf (buffer, "%f", _xInic);
134 sprintf (buffer, "%f", _yInic);
137 sprintf (buffer, "%f", _zInic);
141 sprintf (buffer, "%f", _xFin);
144 sprintf (buffer, "%f", _yFin);
147 sprintf (buffer, "%f", _zFin);
152 for(int i = 0; i<(int)_inputs.size();i++)
154 if(_inputs[i]->isValueSet())
156 _inputs[i]->save(content);
159 content+="FIN_BOX\n";
163 //=========================================================================
165 void GBlackBoxModel::setValueToInput(std::string name,std::string value)
167 for(int i = 0; i<(int)_inputs.size();i++)
169 if(_inputs[i]->getBBTKName()==name)
171 _inputs[i]->setValue(value);
176 //=========================================================================
178 std::string GBlackBoxModel::getValueInputPort(int pos)
180 std::string text = _inputs[pos]->getValue();
184 //=========================================================================
186 std::string GBlackBoxModel::getValueInput(std::string name)
188 for(int i = 0; i<(int)_inputs.size();i++)
190 if(_inputs[i]->getBBTKName()==name)
192 return _inputs[i]->getValue();
198 //=========================================================================
200 std::vector<int> GBlackBoxModel::getConnectedInputs()
202 std::vector<int> connected;
203 for(int i = 0; i<(int)_inputs.size();i++)
205 if(_inputs[i]->isConnected())
207 connected.push_back(i);
213 //=========================================================================
215 std::vector<int> GBlackBoxModel::getConnectedOutputs()
217 std::vector<int> connected;
218 for(int i = 0; i<(int)_outputs.size();i++)
220 if(_outputs[i]->isConnected())
222 connected.push_back(i);
228 //=========================================================================
229 } // EO namespace bbtk