1 /*=========================================================================
3 Module: $RCSfile: bbtkAtomicBlackBox.cxx,v $
5 Date: $Date: 2008/12/11 09:50:34 $
6 Version: $Revision: 1.12 $
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 * ------------------------------------------------------------------------ */
34 * \brief class bbtk::AtomicBlackBox : abstract user defined black boxes
36 #include "bbtkAtomicBlackBox.h"
41 //=========================================================================
42 AtomicBlackBox::AtomicBlackBox(const std::string &name, bool alloc)
45 bbtkDebugMessage("object",3,
46 "==> AtomicBlackBox::AtomicBlackBox(\""
47 <<name<<"\")"<<std::endl);
48 bbtkDebugMessage("object",3,
49 "<== AtomicBlackBox::AtomicBlackBox(\""
50 <<name<<"\")"<<std::endl);
52 //=========================================================================
54 //=========================================================================
55 /// Constructor from an existing box (copy) with a new name
56 AtomicBlackBox::AtomicBlackBox(AtomicBlackBox& from,
57 const std::string &name,
61 bbtkDebugMessage("object",3,
62 "==>AtomicBlackBox::AtomicBlackBox("
63 <<from.bbGetFullName()<<",\""
64 <<name<<"\")"<<std::endl);
65 bbtkDebugMessage("object",3,
66 "<==AtomicBlackBox::AtomicBlackBox("
67 <<from.bbGetFullName()<<",\""
68 <<name<<"\")"<<std::endl);
71 //=========================================================================
74 //=========================================================================
76 AtomicBlackBox::~AtomicBlackBox()
78 bbtkDebugMessage("object",3,"==> AtomicBlackBox::~AtomicBlackBox()"
80 bbtkDebugMessage("object",3,"<== AtomicBlackBox::~AtomicBlackBox()"
83 //=========================================================================
88 //=========================================================================
89 Data AtomicBlackBox::bbGetOutput( const std::string &name )
91 bbtkDebugMessageInc("Data",7,
92 "AtomicBlackBox::bbGetOutput(\""<<name<<"\") ["
93 <<bbGetFullName()<<"]"
96 Data p = ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()
97 ->GetOutputDescriptor(name))->GetGetFunctor()->Get(this);
99 bbtkDebugDecTab("Data",7);
102 //=========================================================================
105 //=========================================================================
106 /// Gets the input Data of a given name
107 Data AtomicBlackBox::bbGetInput( const std::string &name )
109 bbtkDebugMessageInc("Data",7,
110 "AtomicBlackBox::bbGetInput(\""<<name<<"\") ["
111 <<bbGetFullName()<<"]"
114 Data p = ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()
115 ->GetInputDescriptor(name))->GetGetFunctor()->Get(this);
117 bbtkDebugDecTab("Data",7);
120 //=========================================================================
123 //=========================================================================
124 /// Sets the data of the output called <name>
125 void AtomicBlackBox::bbSetOutput( const std::string &name, Data data)
127 bbtkDebugMessageInc("Data",7,
128 "AtomicBlackBox::bbSetOutput(\""<<name<<"\",data) ["
129 <<bbGetFullName()<<"]"
132 ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()
133 ->GetOutputDescriptor(name))->GetSetFunctor()->Set(this,data);
135 bbtkDebugDecTab("Data",7);
137 //=========================================================================
140 //=========================================================================
141 /// Sets the data of the input called <name>
142 void AtomicBlackBox::bbSetInput(const std::string &name,
146 bbtkDebugMessageInc("data",7,
147 "AtomicBlackBox::bbSetInput(\""<<name<<"\",data) ["
148 <<bbGetFullName()<<"]"
150 ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()->GetInputDescriptor(name))->GetSetFunctor()->Set(this,data);
154 bbSetStatusAndPropagate(bbGetInputConnectorMap().find(name)->second,
158 bbtkDebugDecTab("data",7);
160 //=========================================================================
162 //=========================================================================
163 /// Sets the data of the input called <name>
164 void AtomicBlackBox::bbBruteForceSetInputPointer(const std::string &name,
169 bbtkDebugMessageInc("data",7,
170 "AtomicBlackBox::bbBruteForceSetInputPointer(\""
172 <<bbGetFullName()<<"]"
174 ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()
175 ->GetInputDescriptor(name))->GetSetFunctor()
176 ->BruteForceSetPointer(this,data);
180 bbSetStatusAndPropagate(bbGetInputConnectorMap().find(name)->second,
184 bbtkDebugDecTab("data",7);
186 //=========================================================================
190 //==========================================================================
191 std::string AtomicBlackBox::GetObjectInfo() const
196 //==========================================================================
198 //==========================================================================
199 size_t AtomicBlackBox::GetObjectSize() const
201 return sizeof(*this);
203 //==========================================================================
205 //==========================================================================
206 size_t AtomicBlackBox::GetObjectRecursiveSize() const
208 size_t s = GetObjectSize();
211 //==========================================================================