00001 /*========================================================================= 00002 Program: bbtk 00003 Module: $RCSfile: GBoxModel.h,v $ 00004 Language: C++ 00005 Date: $Date: 2012/05/30 17:18:00 $ 00006 Version: $Revision: 1.4 $ 00007 =========================================================================*/ 00008 00009 /* --------------------------------------------------------------------- 00010 00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) 00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux 00013 * 00014 * This software is governed by the CeCILL-B license under French law and 00015 * abiding by the rules of distribution of free software. You can use, 00016 * modify and/ or redistribute the software under the terms of the CeCILL-B 00017 * license as circulated by CEA, CNRS and INRIA at the following URL 00018 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 00019 * or in the file LICENSE.txt. 00020 * 00021 * As a counterpart to the access to the source code and rights to copy, 00022 * modify and redistribute granted by the license, users are provided only 00023 * with a limited warranty and the software's author, the holder of the 00024 * economic rights, and the successive licensors have only limited 00025 * liability. 00026 * 00027 * The fact that you are presently reading this means that you have had 00028 * knowledge of the CeCILL-B license and that you accept its terms. 00029 * ------------------------------------------------------------------------ */ 00030 00031 /**** 00032 * Design and Developpement of BBTK GEditor 00033 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co> 00034 * RaC - 2010 00035 ****/ 00036 00037 #ifndef __GBoxModel_h__ 00038 #define __GBoxModel_h__ 00039 00040 //Includes same project 00041 #include "GlobalConstants.h" 00042 #include "GObjectModel.h" 00043 #include "GPortModel.h" 00044 00045 //Includes creaMaracasVisu 00046 00047 //Includes std 00048 #include <iostream> 00049 00050 00051 namespace bbtk 00052 { 00053 00054 // Mandatory when exists a bidirectional relation: GPortModel includes GBoxModel and viceversa 00055 class GPortModel; 00056 00057 class GBoxModel : public GObjectModel 00058 { 00059 00060 public: 00061 00062 //Constructors 00063 GBoxModel(); 00064 ~GBoxModel(); 00065 00066 //Public methods 00067 virtual void setInicPoint(double& x, double& y, double& z); 00068 00069 void addInputPort(GPortModel *inputport); 00070 void addOutputPort(GPortModel *outputport); 00071 00072 int getNumInputPorts(); 00073 int getNumOutputPorts(); 00074 00075 // Change the position of the box and its ports 00076 virtual void move(double xx,double yy,double zz); 00077 00078 // Text in the status bar 00079 virtual std::string getStatusText(); 00080 00081 // Method to write the information of the black box to be saved in the parameter string 00082 virtual void save(std::string &content); 00083 00084 // Returns a vector with inputs or outputs 00085 std::vector<GPortModel*> getInputPorts(); 00086 std::vector<GPortModel*> getOutputPorts(); 00087 00088 // Get input with the name given by parameter 00089 GPortModel* getInputPort(std::string name); 00090 GPortModel* getInputPort(int pos); 00091 00092 // Get output with the name given by parameter 00093 GPortModel* getOutputPort(std::string name); 00094 GPortModel* getOutputPort(int pos); 00095 00096 // Updates the position and finally the view of inputs and outputs 00097 void updatePorts(); 00098 00099 00100 void addColons(std::string &text); 00101 void removeColons(std::string &text); 00102 00103 private: 00104 00105 //Private Attributes 00106 00107 //Private Methods 00108 00109 protected: 00110 //Protected Attributes 00111 00112 std::vector<GPortModel*> _inputs; 00113 std::vector<GPortModel*> _outputs; 00114 00115 //Protected methods 00116 00117 }; 00118 00119 00120 } 00121 // namespace bbtk 00122 #endif 00123