00001 /*========================================================================= 00002 Program: bbtk 00003 Module: $RCSfile: bbtkAtomicBlackBox.h,v $ 00004 Language: C++ 00005 Date: $Date: 2008/10/17 08:18:12 $ 00006 Version: $Revision: 1.5 $ 00007 =========================================================================*/ 00008 00009 /* --------------------------------------------------------------------- 00010 00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) 00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux 00013 * 00014 * This software is governed by the CeCILL-B license under French law and 00015 * abiding by the rules of distribution of free software. You can use, 00016 * modify and/ or redistribute the software under the terms of the CeCILL-B 00017 * license as circulated by CEA, CNRS and INRIA at the following URL 00018 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 00019 * or in the file LICENSE.txt. 00020 * 00021 * As a counterpart to the access to the source code and rights to copy, 00022 * modify and redistribute granted by the license, users are provided only 00023 * with a limited warranty and the software's author, the holder of the 00024 * economic rights, and the successive licensors have only limited 00025 * liability. 00026 * 00027 * The fact that you are presently reading this means that you have had 00028 * knowledge of the CeCILL-B license and that you accept its terms. 00029 * ------------------------------------------------------------------------ */ 00030 00031 00032 /* --------------------------------------------------------------------- 00033 00034 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) 00035 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux 00036 * 00037 * This software is governed by the CeCILL-B license under French law and 00038 * abiding by the rules of distribution of free software. You can use, 00039 * modify and/ or redistribute the software under the terms of the CeCILL-B 00040 * license as circulated by CEA, CNRS and INRIA at the following URL 00041 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 00042 * or in the file LICENSE.txt. 00043 * 00044 * As a counterpart to the access to the source code and rights to copy, 00045 * modify and redistribute granted by the license, users are provided only 00046 * with a limited warranty and the software's author, the holder of the 00047 * economic rights, and the successive licensors have only limited 00048 * liability. 00049 * 00050 * The fact that you are presently reading this means that you have had 00051 * knowledge of the CeCILL-B license and that you accept its terms. 00052 * ------------------------------------------------------------------------ */ 00053 00054 00055 00066 #ifndef __bbtkAtomicBlackBox_h__ 00067 #define __bbtkAtomicBlackBox_h__ 00068 00069 #include "bbtkBlackBox.h" 00070 #include "bbtkAtomicBlackBoxDescriptor.h" 00071 00072 namespace bbtk 00073 { 00074 00075 00076 //================================================================== 00077 class BBTK_EXPORT AtomicBlackBox : public bbtk::BlackBox 00078 { 00079 //================================================================== 00080 public: 00081 //================================================================== 00082 bbtk::BlackBoxDescriptor::Pointer bbGetDescriptor() const 00083 { 00084 return bbmDescriptorPointer; 00085 } 00086 //================================================================== 00088 Data bbGetOutput( const std::string &label ); 00090 Data bbGetInput( const std::string &label ); 00092 void bbSetOutput( const std::string &name, Data data); 00094 void bbSetInput( const std::string &name, Data data, 00095 bool setModified = true); 00097 void bbBruteForceSetInputPointer( const std::string &name, 00098 void* data, 00099 bool setModified = true); 00100 //================================================================== 00101 00102 //================================================================== 00103 std::string GetObjectInfo() const; 00104 size_t GetObjectSize() const; 00105 size_t GetObjectRecursiveSize() const; 00106 //================================================================== 00107 00108 //================================================================== 00109 protected: 00110 //================================================================== 00112 AtomicBlackBox(const std::string &name, bool alloc = true); 00114 AtomicBlackBox(AtomicBlackBox& from, const std::string &name, 00115 bool alloc = true); 00116 //================================================================== 00117 //================================================================== 00119 virtual ~AtomicBlackBox(); 00120 //================================================================== 00121 00122 //================================================================== 00123 protected: 00124 virtual void bbLockDescriptor() = 0; 00125 // private: 00126 // virtual void bbReleaseDescriptor(); 00127 //================================================================== 00128 00129 public: 00130 //================================================================== 00141 virtual IOStatus bbBackwardUpdate(Connection::Pointer caller); 00142 //================================================================== 00143 00144 //================================================================== 00145 protected: 00146 //================================================================== 00149 virtual void bbProcess() { this->bbUserProcess(); } 00150 //================================================================== 00151 00152 //================================================================== 00156 virtual void bbUserProcess() 00157 { 00158 bbtkWarning("AtomicBlackBox::bbUserProcess() not overloaded for box '" 00159 <<bbGetFullName() 00160 <<"' : the box does nothing. Is it a bug or a feature ?" 00161 <<std::endl); 00162 } 00163 //================================================================== 00164 00165 //================================================================== 00167 virtual void bbUserConstructor() {} 00169 virtual void bbUserCopyConstructor() {} 00171 virtual void bbUserDestructor() {} 00172 //================================================================== 00173 00174 //================================================================== 00175 private: 00176 //================================================================== 00179 AtomicBlackBox() : BlackBox("") {} 00180 //================================================================== 00181 00182 protected: 00183 //================================================================== 00184 // The pointer on the descriptor 00185 bbtk::BlackBoxDescriptor::Pointer bbmDescriptorPointer; 00186 //================================================================== 00187 00188 }; 00189 // Class AtomicBlackBox 00190 //=========================================================================== 00191 00192 00193 00194 } 00195 // namespace bbtk 00196 00197 00198 #include "bbtkAtomicBlackBoxMacros.h" 00199 00200 #endif 00201