bbtkAtomicBlackBox.cxx

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkAtomicBlackBox.cxx,v $
00004   Language:  C++
00005   Date:      $Date: 2009/05/28 08:12:05 $
00006   Version:   $Revision: 1.13 $
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 
00036 #include "bbtkAtomicBlackBox.h"
00037 
00038 namespace bbtk
00039 {
00040   
00041   //=========================================================================
00042   AtomicBlackBox::AtomicBlackBox(const std::string &name, bool alloc)
00043     : BlackBox(name)
00044   {
00045     bbtkBlackBoxDebugMessage("object",3,
00046                      "==> AtomicBlackBox(\""
00047                      <<name<<"\")"<<std::endl);
00048   }
00049   //========================================================================= 
00050   
00051   //=========================================================================
00053   AtomicBlackBox::AtomicBlackBox(AtomicBlackBox& from, 
00054                 const std::string &name, 
00055                 bool alloc)
00056     : BlackBox(from,name)
00057   {
00058     bbtkBlackBoxDebugMessage("object",3,
00059                              "==> AtomicBlackBox("
00060                              <<from.bbGetFullName()<<",\""
00061                              <<name<<"\")"<<std::endl);
00062   }
00063   //=========================================================================
00064   
00065   
00066   //=========================================================================
00068   AtomicBlackBox::~AtomicBlackBox()
00069   {
00070     bbtkBlackBoxDebugMessage("object",3,"==> ~AtomicBlackBox()"
00071                      <<std::endl);
00072     bbtkBlackBoxDebugMessage("object",3,"<== ~AtomicBlackBox()"
00073                      <<std::endl);
00074   } 
00075   //=========================================================================
00076   
00077 
00078 
00079   
00080   //=========================================================================
00081   Data AtomicBlackBox::bbGetOutput( const std::string &name )
00082   {
00083     bbtkBlackBoxDebugMessage("data",7,
00084                              "AtomicBlackBox::bbGetOutput(\""<<name<<"\")"
00085                              <<std::endl);
00086     
00087     Data p = ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()
00088               ->GetOutputDescriptor(name))->GetGetFunctor()->Get(this);
00089     
00090     return p;
00091   }
00092   //=========================================================================
00093   
00094   
00095   //=========================================================================
00097   Data AtomicBlackBox::bbGetInput( const std::string &name ) 
00098   {
00099     bbtkBlackBoxDebugMessage("data",7,
00100                              "AtomicBlackBox::bbGetInput(\""<<name<<"\")"
00101                              <<std::endl);  
00102     
00103     Data p = ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()
00104               ->GetInputDescriptor(name))->GetGetFunctor()->Get(this);
00105     
00106     return p;
00107   }
00108   //=========================================================================
00109   
00110   
00111   //=========================================================================
00113   void AtomicBlackBox::bbSetOutput( const std::string &name, Data data)
00114   {
00115     bbtkBlackBoxDebugMessage("data",7,
00116             "AtomicBlackBox::bbSetOutput(\""<<name<<"\",data)"
00117             <<std::endl); 
00118     
00119     ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()
00120         ->GetOutputDescriptor(name))->GetSetFunctor()->Set(this,data);
00121     
00122     bbtkDebugDecTab("Data",7);
00123   }  
00124   //=========================================================================
00125   
00126   
00127   //=========================================================================
00129   void AtomicBlackBox::bbSetInput(const std::string &name,
00130                                   Data data, 
00131                                   bool setModified )
00132   {
00133     bbtkBlackBoxDebugMessage("data",7,
00134             "AtomicBlackBox::bbSetInput(\""<<name<<"\",data)"
00135             <<std::endl);  
00136     ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()->GetInputDescriptor(name))->GetSetFunctor()->Set(this,data);
00137     
00138     if (setModified) 
00139       {
00140         bbSetStatusAndPropagate(bbGetInputConnectorMap().find(name)->second,
00141                                 MODIFIED);
00142       }
00143     
00144   }
00145   //=========================================================================
00146   
00147   //=========================================================================
00149   void AtomicBlackBox::bbBruteForceSetInputPointer(const std::string &name, 
00150                                                    void* data, 
00151                                                    bool setModified
00152                                                    )
00153   {
00154     bbtkBlackBoxDebugMessage("data",7,
00155             "AtomicBlackBox::bbBruteForceSetInputPointer(\""
00156             <<name<<"\",data)"
00157             <<std::endl);  
00158     ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()
00159         ->GetInputDescriptor(name))->GetSetFunctor()
00160             ->BruteForceSetPointer(this,data);
00161     
00162     if (setModified) 
00163       {
00164         bbSetStatusAndPropagate(bbGetInputConnectorMap().find(name)->second,
00165                                 MODIFIED);
00166       }
00167     
00168   }
00169   //=========================================================================
00170  
00171 
00172 
00173   //==========================================================================
00174   std::string AtomicBlackBox::GetObjectInfo() const 
00175   {
00176     std::stringstream i;
00177     return i.str();
00178   }
00179   //==========================================================================
00180 
00181   //==========================================================================
00182   size_t AtomicBlackBox::GetObjectSize() const 
00183   {
00184     return sizeof(*this);
00185   }
00186   //==========================================================================
00187   
00188   //==========================================================================
00189   size_t AtomicBlackBox::GetObjectRecursiveSize() const 
00190   {
00191     size_t s = GetObjectSize();
00192     return s;
00193   }
00194   //==========================================================================
00195 
00196  
00197 }
00198 // EO namespace bbtk

Generated on Thu May 31 14:12:02 2012 for BBTK by  doxygen 1.5.7.1