2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
28 /*=========================================================================
30 Module: $RCSfile: bbtkAtomicBlackBox.h,v $
32 Date: $Date: 2012/11/16 08:49:01 $
33 Version: $Revision: 1.12 $
34 =========================================================================*/
39 * \brief class bbtk::AtomicBlackBox : ancestor of all user defined (concrete) black boxes which are atomic (vs. ComplexBlackBox objects which are made up of other (atomic or complex) boxes).
43 * \class bbtk::AtomicBlackBox
44 * \brief Ancestor of all user defined (concrete) black boxes which are atomic (vs. complex boxes which are made up of other (atomic or complex) boxes).
47 #ifndef __bbtkAtomicBlackBox_h__
48 #define __bbtkAtomicBlackBox_h__
50 #include "bbtkBlackBox.h"
51 #include "bbtkAtomicBlackBoxDescriptor.h"
57 //==================================================================
58 class BBTK_EXPORT AtomicBlackBox : public bbtk::BlackBox
60 //==================================================================
62 //==================================================================
63 bbtk::BlackBoxDescriptor::Pointer bbGetDescriptor() const
65 return bbmDescriptorPointer;
67 //==================================================================
69 //==================================================================
70 /// Gets the output Data of a given label
71 Data bbGetOutput( const std::string &label );
72 /// Gets the input Data of a given label
73 Data bbGetInput( const std::string &label );
74 /// Sets the data of the output called <name>
75 void bbSetOutput( const std::string &name, Data data);
76 /// Sets the data of the input called <name>
77 void bbSetInput( const std::string &name, Data data,
78 bool setModified = true);
79 /// Sets the data of the input called <name>
80 void bbBruteForceSetInputPointer( const std::string &name,
82 bool setModified = true);
83 //==================================================================
85 //==================================================================
86 std::string GetObjectInfo() const;
87 size_t GetObjectSize() const;
88 size_t GetObjectRecursiveSize() const;
89 //==================================================================
91 //==================================================================
93 //==================================================================
94 /// Constructor with the AtomicBlackBox's instance name
95 AtomicBlackBox(const std::string &name, bool alloc = true);
96 /// Constructor from an existing box (copy) with a new instance name
97 AtomicBlackBox(AtomicBlackBox& from, const std::string &name,
100 virtual ~AtomicBlackBox();
102 virtual void bbLockDescriptor() = 0;
103 //==================================================================
105 //==================================================================
106 /// Calls the user defined processing method.
107 /// Overloaded in WxBlackBox to handle widget creation and show
108 virtual void bbProcess() { this->bbUserProcess(); }
109 //==================================================================
111 //==================================================================
112 /// User callback which computes the outputs as a function of the inputs.
113 /// It is assumed to be deterministic and thus is only called
114 /// if the inputs have changed
115 virtual void bbUserProcess()
117 bbtkWarning("AtomicBlackBox::bbUserProcess() not overloaded for box '"
119 <<"' : the box does nothing. Is it a bug or a feature ?"
122 //==================================================================
124 //==================================================================
125 /// *** TO BE REMOVED WHEN EVERYTHING IS OK ***
126 /// CHANGED RETURN TYPE OF bbUserConstructor FROM void TO int
127 /// TO PRODUCE COMPILATION ERROR IF AN USER DECLARES THE OLD
128 /// METHOD bbUserConstructor IN ITS BOX
129 virtual int bbUserConstructor() { return 0; }
130 /// *** TO BE REMOVED WHEN EVERYTHING IS OK ***
131 /// THE SAME AS bbUserConstructor
132 virtual int bbUserCopyConstructor(bbtk::BlackBox::Pointer) { return 0; }
133 /// *** TO BE REMOVED WHEN EVERYTHING IS OK ***
134 /// THE SAME AS bbUserConstructor
135 virtual int bbUserDestructor() { return 0; }
136 //==================================================================
139 //==================================================================
141 //==================================================================
142 /// Default constructor is private :
143 /// derived classes must use the constructor with the AtomicBlackBox's name
144 AtomicBlackBox() : BlackBox("") {}
145 //==================================================================
148 //==================================================================
149 // The pointer on the descriptor
150 bbtk::BlackBoxDescriptor::Pointer bbmDescriptorPointer;
151 //==================================================================
154 // Class AtomicBlackBox
155 //====================================================================
162 #include "bbtkAtomicBlackBoxMacros.h"