00001 /*========================================================================= 00002 Program: bbtk 00003 Module: $RCSfile: bbtkAtomicBlackBox.h,v $ 00004 Language: C++ 00005 Date: $Date: 2010/01/14 13:17:27 $ 00006 Version: $Revision: 1.11 $ 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 00041 #ifndef __bbtkAtomicBlackBox_h__ 00042 #define __bbtkAtomicBlackBox_h__ 00043 00044 #include "bbtkBlackBox.h" 00045 #include "bbtkAtomicBlackBoxDescriptor.h" 00046 00047 namespace bbtk 00048 { 00049 00050 00051 //================================================================== 00052 class BBTK_EXPORT AtomicBlackBox : public bbtk::BlackBox 00053 { 00054 //================================================================== 00055 public: 00056 //================================================================== 00057 bbtk::BlackBoxDescriptor::Pointer bbGetDescriptor() const 00058 { 00059 return bbmDescriptorPointer; 00060 } 00061 //================================================================== 00062 00063 //================================================================== 00065 Data bbGetOutput( const std::string &label ); 00067 Data bbGetInput( const std::string &label ); 00069 void bbSetOutput( const std::string &name, Data data); 00071 void bbSetInput( const std::string &name, Data data, 00072 bool setModified = true); 00074 void bbBruteForceSetInputPointer( const std::string &name, 00075 void* data, 00076 bool setModified = true); 00077 //================================================================== 00078 00079 //================================================================== 00080 std::string GetObjectInfo() const; 00081 size_t GetObjectSize() const; 00082 size_t GetObjectRecursiveSize() const; 00083 //================================================================== 00084 00085 //================================================================== 00086 protected: 00087 //================================================================== 00089 AtomicBlackBox(const std::string &name, bool alloc = true); 00091 AtomicBlackBox(AtomicBlackBox& from, const std::string &name, 00092 bool alloc = true); 00094 virtual ~AtomicBlackBox(); 00096 virtual void bbLockDescriptor() = 0; 00097 //================================================================== 00098 00099 //================================================================== 00102 virtual void bbProcess() { this->bbUserProcess(); } 00103 //================================================================== 00104 00105 //================================================================== 00109 virtual void bbUserProcess() 00110 { 00111 bbtkWarning("AtomicBlackBox::bbUserProcess() not overloaded for box '" 00112 <<bbGetFullName() 00113 <<"' : the box does nothing. Is it a bug or a feature ?" 00114 <<std::endl); 00115 } 00116 //================================================================== 00117 00118 //================================================================== 00123 virtual int bbUserConstructor() { return 0; } 00126 virtual int bbUserCopyConstructor(bbtk::BlackBox::Pointer) { return 0; } 00129 virtual int bbUserDestructor() { return 0; } 00130 //================================================================== 00131 00132 00133 //================================================================== 00134 private: 00135 //================================================================== 00138 AtomicBlackBox() : BlackBox("") {} 00139 //================================================================== 00140 00141 protected: 00142 //================================================================== 00143 // The pointer on the descriptor 00144 bbtk::BlackBoxDescriptor::Pointer bbmDescriptorPointer; 00145 //================================================================== 00146 00147 }; 00148 // Class AtomicBlackBox 00149 //==================================================================== 00150 00151 00152 } 00153 // namespace bbtk 00154 00155 00156 #include "bbtkAtomicBlackBoxMacros.h" 00157 00158 #endif 00159