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"
56 //==================================================================
57 class BBTK_EXPORT AtomicBlackBox : public bbtk::BlackBox
59 //==================================================================
61 //==================================================================
62 bbtk::BlackBoxDescriptor::Pointer bbGetDescriptor() const
64 return bbmDescriptorPointer;
66 //==================================================================
68 //==================================================================
69 /// Gets the output Data of a given label
70 Data bbGetOutput( const std::string &label );
71 /// Gets the input Data of a given label
72 Data bbGetInput( const std::string &label );
73 /// Sets the data of the output called <name>
74 void bbSetOutput( const std::string &name, Data data);
75 /// Sets the data of the input called <name>
76 void bbSetInput( const std::string &name, Data data,
77 bool setModified = true);
78 /// Sets the data of the input called <name>
79 void bbBruteForceSetInputPointer( const std::string &name,
81 bool setModified = true);
82 //==================================================================
84 //==================================================================
85 std::string GetObjectInfo() const;
86 size_t GetObjectSize() const;
87 size_t GetObjectRecursiveSize() const;
88 //==================================================================
90 //==================================================================
92 //==================================================================
93 /// Constructor with the AtomicBlackBox's instance name
94 AtomicBlackBox(const std::string &name, bool alloc = true);
95 /// Constructor from an existing box (copy) with a new instance name
96 AtomicBlackBox(AtomicBlackBox& from, const std::string &name,
99 virtual ~AtomicBlackBox();
101 virtual void bbLockDescriptor() = 0;
102 //==================================================================
104 //==================================================================
105 /// Calls the user defined processing method.
106 /// Overloaded in WxBlackBox to handle widget creation and show
107 virtual void bbProcess() { this->bbUserProcess(); }
108 //==================================================================
110 //==================================================================
111 /// User callback which computes the outputs as a function of the inputs.
112 /// It is assumed to be deterministic and thus is only called
113 /// if the inputs have changed
114 virtual void bbUserProcess()
116 bbtkWarning("AtomicBlackBox::bbUserProcess() not overloaded for box '"
118 <<"' : the box does nothing. Is it a bug or a feature ?"
121 //==================================================================
123 //==================================================================
124 /// *** TO BE REMOVED WHEN EVERYTHING IS OK ***
125 /// CHANGED RETURN TYPE OF bbUserConstructor FROM void TO int
126 /// TO PRODUCE COMPILATION ERROR IF AN USER DECLARES THE OLD
127 /// METHOD bbUserConstructor IN ITS BOX
128 virtual int bbUserConstructor() { return 0; }
129 /// *** TO BE REMOVED WHEN EVERYTHING IS OK ***
130 /// THE SAME AS bbUserConstructor
131 virtual int bbUserCopyConstructor(bbtk::BlackBox::Pointer) { return 0; }
132 /// *** TO BE REMOVED WHEN EVERYTHING IS OK ***
133 /// THE SAME AS bbUserConstructor
134 virtual int bbUserDestructor() { return 0; }
135 //==================================================================
138 //==================================================================
140 //==================================================================
141 /// Default constructor is private :
142 /// derived classes must use the constructor with the AtomicBlackBox's name
143 AtomicBlackBox() : BlackBox("") {}
144 //==================================================================
147 //==================================================================
148 // The pointer on the descriptor
149 bbtk::BlackBoxDescriptor::Pointer bbmDescriptorPointer;
150 //==================================================================
153 // Class AtomicBlackBox
154 //====================================================================
161 #include "bbtkAtomicBlackBoxMacros.h"