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 # ------------------------------------------------------------------------ */
29 /*=========================================================================
31 Module: $RCSfile: bbtkAtomicBlackBox.cxx,v $
33 Date: $Date: 2012/11/16 08:49:01 $
34 Version: $Revision: 1.14 $
35 =========================================================================*/
41 * \brief class bbtk::AtomicBlackBox : abstract user defined black boxes
43 #include "bbtkAtomicBlackBox.h"
48 //=========================================================================
49 AtomicBlackBox::AtomicBlackBox(const std::string &name, bool alloc)
52 bbtkBlackBoxDebugMessage("object",3,
53 "==> AtomicBlackBox(\""
54 <<name<<"\")"<<std::endl);
56 //=========================================================================
58 //=========================================================================
59 /// Constructor from an existing box (copy) with a new name
60 AtomicBlackBox::AtomicBlackBox(AtomicBlackBox& from,
61 const std::string &name,
65 bbtkBlackBoxDebugMessage("object",3,
67 <<from.bbGetFullName()<<",\""
68 <<name<<"\")"<<std::endl);
70 //=========================================================================
73 //=========================================================================
75 AtomicBlackBox::~AtomicBlackBox()
77 bbtkBlackBoxDebugMessage("object",3,"==> ~AtomicBlackBox()"
79 bbtkBlackBoxDebugMessage("object",3,"<== ~AtomicBlackBox()"
82 //=========================================================================
87 //=========================================================================
88 Data AtomicBlackBox::bbGetOutput( const std::string &name )
90 bbtkBlackBoxDebugMessage("data",7,
91 "AtomicBlackBox::bbGetOutput(\""<<name<<"\")"
94 Data p = ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()
95 ->GetOutputDescriptor(name))->GetGetFunctor()->Get(this);
99 //=========================================================================
102 //=========================================================================
103 /// Gets the input Data of a given name
104 Data AtomicBlackBox::bbGetInput( const std::string &name )
106 bbtkBlackBoxDebugMessage("data",7,
107 "AtomicBlackBox::bbGetInput(\""<<name<<"\")"
110 Data p = ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()
111 ->GetInputDescriptor(name))->GetGetFunctor()->Get(this);
115 //=========================================================================
118 //=========================================================================
119 /// Sets the data of the output called <name>
120 void AtomicBlackBox::bbSetOutput( const std::string &name, Data data)
122 bbtkBlackBoxDebugMessage("data",7,
123 "AtomicBlackBox::bbSetOutput(\""<<name<<"\",data)"
126 ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()
127 ->GetOutputDescriptor(name))->GetSetFunctor()->Set(this,data);
129 bbtkDebugDecTab("Data",7);
131 //=========================================================================
134 //=========================================================================
135 /// Sets the data of the input called <name>
136 void AtomicBlackBox::bbSetInput(const std::string &name,
140 bbtkBlackBoxDebugMessage("data",7,
141 "AtomicBlackBox::bbSetInput(\""<<name<<"\",data)"
143 ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()->GetInputDescriptor(name))->GetSetFunctor()->Set(this,data);
147 bbSetStatusAndPropagate(bbGetInputConnectorMap().find(name)->second,
152 //=========================================================================
154 //=========================================================================
155 /// Sets the data of the input called <name>
156 void AtomicBlackBox::bbBruteForceSetInputPointer(const std::string &name,
161 bbtkBlackBoxDebugMessage("data",7,
162 "AtomicBlackBox::bbBruteForceSetInputPointer(\""
165 ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()
166 ->GetInputDescriptor(name))->GetSetFunctor()
167 ->BruteForceSetPointer(this,data);
171 bbSetStatusAndPropagate(bbGetInputConnectorMap().find(name)->second,
176 //=========================================================================
180 //==========================================================================
181 std::string AtomicBlackBox::GetObjectInfo() const
186 //==========================================================================
188 //==========================================================================
189 size_t AtomicBlackBox::GetObjectSize() const
191 return sizeof(*this);
193 //==========================================================================
195 //==========================================================================
196 size_t AtomicBlackBox::GetObjectRecursiveSize() const
198 size_t s = GetObjectSize();
201 //==========================================================================