1 /*=========================================================================
3 Module: $RCSfile: bbtkAtomicBlackBox.h,v $
5 Date: $Date: 2010/01/14 13:17:27 $
6 Version: $Revision: 1.11 $
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 * ------------------------------------------------------------------------ */
33 * \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).
37 * \class bbtk::AtomicBlackBox
38 * \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).
41 #ifndef __bbtkAtomicBlackBox_h__
42 #define __bbtkAtomicBlackBox_h__
44 #include "bbtkBlackBox.h"
45 #include "bbtkAtomicBlackBoxDescriptor.h"
51 //==================================================================
52 class BBTK_EXPORT AtomicBlackBox : public bbtk::BlackBox
54 //==================================================================
56 //==================================================================
57 bbtk::BlackBoxDescriptor::Pointer bbGetDescriptor() const
59 return bbmDescriptorPointer;
61 //==================================================================
63 //==================================================================
64 /// Gets the output Data of a given label
65 Data bbGetOutput( const std::string &label );
66 /// Gets the input Data of a given label
67 Data bbGetInput( const std::string &label );
68 /// Sets the data of the output called <name>
69 void bbSetOutput( const std::string &name, Data data);
70 /// Sets the data of the input called <name>
71 void bbSetInput( const std::string &name, Data data,
72 bool setModified = true);
73 /// Sets the data of the input called <name>
74 void bbBruteForceSetInputPointer( const std::string &name,
76 bool setModified = true);
77 //==================================================================
79 //==================================================================
80 std::string GetObjectInfo() const;
81 size_t GetObjectSize() const;
82 size_t GetObjectRecursiveSize() const;
83 //==================================================================
85 //==================================================================
87 //==================================================================
88 /// Constructor with the AtomicBlackBox's instance name
89 AtomicBlackBox(const std::string &name, bool alloc = true);
90 /// Constructor from an existing box (copy) with a new instance name
91 AtomicBlackBox(AtomicBlackBox& from, const std::string &name,
94 virtual ~AtomicBlackBox();
96 virtual void bbLockDescriptor() = 0;
97 //==================================================================
99 //==================================================================
100 /// Calls the user defined processing method.
101 /// Overloaded in WxBlackBox to handle widget creation and show
102 virtual void bbProcess() { this->bbUserProcess(); }
103 //==================================================================
105 //==================================================================
106 /// User callback which computes the outputs as a function of the inputs.
107 /// It is assumed to be deterministic and thus is only called
108 /// if the inputs have changed
109 virtual void bbUserProcess()
111 bbtkWarning("AtomicBlackBox::bbUserProcess() not overloaded for box '"
113 <<"' : the box does nothing. Is it a bug or a feature ?"
116 //==================================================================
118 //==================================================================
119 /// *** TO BE REMOVED WHEN EVERYTHING IS OK ***
120 /// CHANGED RETURN TYPE OF bbUserConstructor FROM void TO int
121 /// TO PRODUCE COMPILATION ERROR IF AN USER DECLARES THE OLD
122 /// METHOD bbUserConstructor IN ITS BOX
123 virtual int bbUserConstructor() { return 0; }
124 /// *** TO BE REMOVED WHEN EVERYTHING IS OK ***
125 /// THE SAME AS bbUserConstructor
126 virtual int bbUserCopyConstructor(bbtk::BlackBox::Pointer) { return 0; }
127 /// *** TO BE REMOVED WHEN EVERYTHING IS OK ***
128 /// THE SAME AS bbUserConstructor
129 virtual int bbUserDestructor() { return 0; }
130 //==================================================================
133 //==================================================================
135 //==================================================================
136 /// Default constructor is private :
137 /// derived classes must use the constructor with the AtomicBlackBox's name
138 AtomicBlackBox() : BlackBox("") {}
139 //==================================================================
142 //==================================================================
143 // The pointer on the descriptor
144 bbtk::BlackBoxDescriptor::Pointer bbmDescriptorPointer;
145 //==================================================================
148 // Class AtomicBlackBox
149 //====================================================================
156 #include "bbtkAtomicBlackBoxMacros.h"