bbtkConnection.h

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkConnection.h,v $
00004   Language:  C++
00005   Date:      $Date: 2009/04/21 14:36:51 $
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 
00041 #ifndef __bbtkConnection_h__
00042 #define __bbtkConnection_h__
00043 
00044 #include "bbtkSystem.h"
00045 #include "bbtkObject.h"
00046 
00047 #include <string>
00048 
00049 namespace bbtk
00050 {
00051 
00052   class Factory;
00053   BBTK_FORWARD_DECLARE_POINTER(Factory);
00054   class BlackBox;
00055   BBTK_FORWARD_DECLARE_POINTER(BlackBox);
00056   class BlackBoxInputConnector;
00057   class BlackBoxOutputConnector;
00058 
00060   typedef unsigned char IOStatus;
00062   const IOStatus UPTODATE  = 0;
00064   const IOStatus MODIFIED  = 1;
00066   const IOStatus OUTOFDATE = 2;
00067 
00068   BBTK_EXPORT const std::string& GetIOStatusString( IOStatus );
00069 
00070 
00071   class BBTK_EXPORT Connection : public Object
00072   {
00073      BBTK_OBJECT_INTERFACE(Connection);
00074     typedef Object Superclass;
00075   public:
00076 
00077     static Pointer New(BlackBoxPointer from, const std::string& output,
00078                        BlackBoxPointer to, const std::string& input,
00079                        const FactoryPointer f);
00080     static Pointer New(BlackBoxPointer from, const std::string& output,
00081                        BlackBoxPointer to, const std::string& input);
00083     //    ~Connection();
00084 
00085     // void Delete();
00086     
00093     void RecursiveExecute();
00094     
00096     void OnOutputChange(BlackBoxPointer, const std::string&, 
00097                         IOStatus);
00098 
00099     std::string GetFullName() const; 
00100 
00102     BlackBoxPointer GetOriginalBlackBoxFrom() const { return mOriginalFrom.lock(); }
00104     BlackBoxPointer GetOriginalBlackBoxTo() const { return mOriginalTo.lock(); }
00106     const std::string& GetOriginalBlackBoxFromOutput() const { return mOriginalOutput; }
00108     const std::string& GetOriginalBlackBoxToInput() const { return mOriginalInput; }
00109     
00111     BlackBoxPointer GetBlackBoxFrom() const { return mFrom; }
00113     BlackBoxPointer GetBlackBoxTo() const { return mTo; }
00115     const std::string& GetBlackBoxFromOutput() const { return mOutput; }
00117     const std::string& GetBlackBoxToInput() const { return mInput; }
00118 
00120     void SetBlackBoxFrom(BlackBoxPointer b) { mFrom = b; }
00122     void SetBlackBoxTo(BlackBoxPointer b) { mTo = b; }
00124     void SetBlackBoxFromOutput(const std::string& o) { mOutput = o; }
00126     void SetBlackBoxToInput(const std::string& o) { mInput = o; }
00127 
00129     void Check() const;
00130     
00131   protected:
00133     BlackBoxPointer mFrom;
00134     BlackBoxWeakPointer mOriginalFrom;
00136     std::string mOutput;
00137     std::string mOriginalOutput;
00139     //  BlackBoxOutputConnector* mOutputConnector;
00141     BlackBoxPointer mTo;
00142     BlackBoxWeakPointer mOriginalTo;
00144     std::string mInput;
00145     std::string mOriginalInput;
00147     //  BlackBoxInputConnector* mInputConnector;
00149     BlackBoxPointer mAdaptor;
00150 
00152     const FactoryWeakPointer mFactory;
00153 
00155     bool mFromAny;
00156 
00158     bool mToAny;
00159 
00160 
00162     bool mDoDynamicCast;
00163 
00167     //  Connection(BlackBox* from, const std::string& output,
00168     //         BlackBox* to, const std::string& input, int   );
00169   public:   
00170     void TransferData(); 
00171 
00172   private:
00174     Connection(BlackBoxPointer from, const std::string& output,
00175                BlackBoxPointer to, const std::string& input,
00176                const FactoryPointer f);
00178     Connection(BlackBoxPointer from, const std::string& output,
00179                BlackBoxPointer to, const std::string& input);
00180 
00181   };
00182 
00183 }// namespace bbtk
00184 
00185 #endif
00186 

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