1 /*=========================================================================
3 Module: $RCSfile: bbtkAtomicBlackBox.cxx,v $
5 Date: $Date: 2009/05/28 08:12:05 $
6 Version: $Revision: 1.13 $
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 bbtkBlackBoxDebugMessage("object",3,
46 "==> AtomicBlackBox(\""
47 <<name<<"\")"<<std::endl);
49 //=========================================================================
51 //=========================================================================
52 /// Constructor from an existing box (copy) with a new name
53 AtomicBlackBox::AtomicBlackBox(AtomicBlackBox& from,
54 const std::string &name,
58 bbtkBlackBoxDebugMessage("object",3,
60 <<from.bbGetFullName()<<",\""
61 <<name<<"\")"<<std::endl);
63 //=========================================================================
66 //=========================================================================
68 AtomicBlackBox::~AtomicBlackBox()
70 bbtkBlackBoxDebugMessage("object",3,"==> ~AtomicBlackBox()"
72 bbtkBlackBoxDebugMessage("object",3,"<== ~AtomicBlackBox()"
75 //=========================================================================
80 //=========================================================================
81 Data AtomicBlackBox::bbGetOutput( const std::string &name )
83 bbtkBlackBoxDebugMessage("data",7,
84 "AtomicBlackBox::bbGetOutput(\""<<name<<"\")"
87 Data p = ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()
88 ->GetOutputDescriptor(name))->GetGetFunctor()->Get(this);
92 //=========================================================================
95 //=========================================================================
96 /// Gets the input Data of a given name
97 Data AtomicBlackBox::bbGetInput( const std::string &name )
99 bbtkBlackBoxDebugMessage("data",7,
100 "AtomicBlackBox::bbGetInput(\""<<name<<"\")"
103 Data p = ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()
104 ->GetInputDescriptor(name))->GetGetFunctor()->Get(this);
108 //=========================================================================
111 //=========================================================================
112 /// Sets the data of the output called <name>
113 void AtomicBlackBox::bbSetOutput( const std::string &name, Data data)
115 bbtkBlackBoxDebugMessage("data",7,
116 "AtomicBlackBox::bbSetOutput(\""<<name<<"\",data)"
119 ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()
120 ->GetOutputDescriptor(name))->GetSetFunctor()->Set(this,data);
122 bbtkDebugDecTab("Data",7);
124 //=========================================================================
127 //=========================================================================
128 /// Sets the data of the input called <name>
129 void AtomicBlackBox::bbSetInput(const std::string &name,
133 bbtkBlackBoxDebugMessage("data",7,
134 "AtomicBlackBox::bbSetInput(\""<<name<<"\",data)"
136 ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()->GetInputDescriptor(name))->GetSetFunctor()->Set(this,data);
140 bbSetStatusAndPropagate(bbGetInputConnectorMap().find(name)->second,
145 //=========================================================================
147 //=========================================================================
148 /// Sets the data of the input called <name>
149 void AtomicBlackBox::bbBruteForceSetInputPointer(const std::string &name,
154 bbtkBlackBoxDebugMessage("data",7,
155 "AtomicBlackBox::bbBruteForceSetInputPointer(\""
158 ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()
159 ->GetInputDescriptor(name))->GetSetFunctor()
160 ->BruteForceSetPointer(this,data);
164 bbSetStatusAndPropagate(bbGetInputConnectorMap().find(name)->second,
169 //=========================================================================
173 //==========================================================================
174 std::string AtomicBlackBox::GetObjectInfo() const
179 //==========================================================================
181 //==========================================================================
182 size_t AtomicBlackBox::GetObjectSize() const
184 return sizeof(*this);
186 //==========================================================================
188 //==========================================================================
189 size_t AtomicBlackBox::GetObjectRecursiveSize() const
191 size_t s = GetObjectSize();
194 //==========================================================================