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: 2008/10/17 08:18:13 $
00006   Version:   $Revision: 1.8 $
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 int IOStatus;
00062   const int MODIFIED = 0;
00064   const int UPTODATE = 1;
00066   const int UPDATING = 2;
00067 
00068 
00069   class BBTK_EXPORT Connection : public Object
00070   {
00071      BBTK_OBJECT_INTERFACE(Connection);
00072     typedef Object Superclass;
00073   public:
00074 
00075     static Pointer New(BlackBoxPointer from, const std::string& output,
00076                        BlackBoxPointer to, const std::string& input,
00077                        const FactoryPointer f);
00078     static Pointer New(BlackBoxPointer from, const std::string& output,
00079                        BlackBoxPointer to, const std::string& input);
00081     //    ~Connection();
00082 
00083     // void Delete();
00084     
00088     virtual IOStatus BackwardUpdate();
00089 
00093     //    virtual void ForwardUpdate();
00094 
00095     virtual void SetModifiedStatus();
00096     std::string GetFullName() const; 
00097 
00099     BlackBoxPointer GetOriginalBlackBoxFrom() const { return mOriginalFrom.lock(); }
00101     BlackBoxPointer GetOriginalBlackBoxTo() const { return mOriginalTo.lock(); }
00103     const std::string& GetOriginalBlackBoxFromOutput() const { return mOriginalOutput; }
00105     const std::string& GetOriginalBlackBoxToInput() const { return mOriginalInput; }
00106     
00108     BlackBoxPointer GetBlackBoxFrom() const { return mFrom; }
00110     BlackBoxPointer GetBlackBoxTo() const { return mTo; }
00112     const std::string& GetBlackBoxFromOutput() const { return mOutput; }
00114     const std::string& GetBlackBoxToInput() const { return mInput; }
00115 
00117     void SetBlackBoxFrom(BlackBoxPointer b) { mFrom = b; }
00119     void SetBlackBoxTo(BlackBoxPointer b) { mTo = b; }
00121     void SetBlackBoxFromOutput(const std::string& o) { mOutput = o; }
00123     void SetBlackBoxToInput(const std::string& o) { mInput = o; }
00124 
00126     void Check() const;
00127     
00128   protected:
00130     BlackBoxPointer mFrom;
00131     BlackBoxWeakPointer mOriginalFrom;
00133     std::string mOutput;
00134     std::string mOriginalOutput;
00136     //  BlackBoxOutputConnector* mOutputConnector;
00138     BlackBoxPointer mTo;
00139     BlackBoxWeakPointer mOriginalTo;
00141     std::string mInput;
00142     std::string mOriginalInput;
00144     //  BlackBoxInputConnector* mInputConnector;
00146     BlackBoxPointer mAdaptor;
00147 
00149     const FactoryWeakPointer mFactory;
00150 
00152     bool mFromAny;
00153 
00155     bool mToAny;
00156 
00157 
00159     bool mDoDynamicCast;
00160 
00164     //  Connection(BlackBox* from, const std::string& output,
00165     //         BlackBox* to, const std::string& input, int   );
00166     
00167     void TransferData(); 
00168 
00169   private:
00171     Connection(BlackBoxPointer from, const std::string& output,
00172                BlackBoxPointer to, const std::string& input,
00173                const FactoryPointer f);
00175     Connection(BlackBoxPointer from, const std::string& output,
00176                BlackBoxPointer to, const std::string& input);
00177 
00178   };
00179 
00180 }// namespace bbtk
00181 
00182 #endif
00183 

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6