]> Creatis software - bbtk.git/commitdiff
Compiles de nuevo with no global factory
authorguigues <guigues>
Fri, 7 Mar 2008 10:21:30 +0000 (10:21 +0000)
committerguigues <guigues>
Fri, 7 Mar 2008 10:21:30 +0000 (10:21 +0000)
kernel/appli/bbi/bbi.cxx
kernel/src/bbtkComplexBlackBox.cxx
kernel/src/bbtkComplexBlackBoxDescriptor.cxx
kernel/src/bbtkComplexBlackBoxDescriptor.h
kernel/src/bbtkConnection.cxx
kernel/src/bbtkConnection.h
kernel/src/bbtkFactory.cxx
kernel/src/bbtkTranscriptor.cxx

index 3a7368b4a4c4500a3207d06754cd9fb900076954..56417d9f5458215456e7b6fcdfd8dae3e869fdbd 100644 (file)
@@ -144,8 +144,11 @@ bool wxBBIApp::OnInit( )
   for (i=input_file.begin(); i!=input_file.end(); ++i) I->InterpretFile(*i);
   I->SetNoExecMode(false);
 
-  if (help_on_script) bbtk::HelpBlackBox("workspace",false);
-
+  if (help_on_script) 
+    {
+      std::string package; 
+      I->GetInterpreter()->GetExecuter()->GetFactory()->HelpBlackBox("workspace",package,false);
+    }
   if (!(command || bbtk::Wx::IsSomeWindowShown() ))
     {
       I->Close();
index be9fec2b348034fd5492eb11817b8b3ca8cf4eec..8c54bc9d7f4715928ffe92ccd141045ccf278f26 100644 (file)
@@ -3,8 +3,8 @@
 Program:   bbtk
 Module:    $RCSfile: bbtkComplexBlackBox.cxx,v $
 Language:  C++
-Date:      $Date: 2008/02/19 18:40:10 $
-Version:   $Revision: 1.6 $
+Date:      $Date: 2008/03/07 10:21:30 $
+Version:   $Revision: 1.7 $
                                                                                 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
 l'Image). All rights reserved. See Doc/License.txt or
@@ -79,7 +79,7 @@ namespace bbtk
 
        BlackBox* bbfrom = bbGetBlackBox( (*j)->GetBlackBoxFrom()->bbGetName() );
        BlackBox* bbto = bbGetBlackBox( (*j)->GetBlackBoxTo()->bbGetName() );
-       Connection* c = /*mDescriptor->GetFactory()->Create*/ 
+       Connection* c = mDescriptor->GetFactory()-> 
          NewConnection( bbfrom, 
                         (*j)->GetBlackBoxFromOutput(), 
                         bbto, 
index b7b07989cff798069df4c6d27fcaaea821ef8a4d..d9e8da14fffa779c90cd7d9dafc10c47a755a636 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkComplexBlackBoxDescriptor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/19 18:40:10 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2008/03/07 10:21:30 $
+  Version:   $Revision: 1.12 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -33,7 +33,8 @@ namespace bbtk
   //=======================================================================
   /// Default ctor
   ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(const std::string& name)
-    : BlackBoxDescriptor()
+    : BlackBoxDescriptor(),
+      mFactory(0)
   {
     bbtkDebugMessageInc("Kernel",9,"ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
     SetTypeName(name);
@@ -87,6 +88,11 @@ namespace bbtk
                        <<type<<"\",\""<<name<<"\") ["
                        <<GetTypeName()<<"]"<<std::endl);
     
+    // 
+    if (mFactory == 0) 
+      { 
+       bbtkError("ComplexBlackBoxDescriptor::Add : no factory set");
+      }
     
     // Verify that a box with the same name does not exist already
     if ( mPrototype->bbUnsafeGetBlackBox( name ) ) 
@@ -94,7 +100,7 @@ namespace bbtk
        bbtkError("a black box \""<<name<<"\" already exists");
       }
     // ok : create new one
-    mPrototype->bbAddBlackBox ( /*mFactory->Create*/ NewBlackBox(type,name) );
+    mPrototype->bbAddBlackBox ( mFactory->NewBlackBox(type,name) );
 
     bbtkDebugDecTab("Kernel",5);
   }
@@ -135,6 +141,13 @@ namespace bbtk
                        <<to<<"\",\""<<input
                        <<"\") ["
                        <<GetTypeName()<<"]"<<std::endl);
+  // 
+    if (mFactory == 0) 
+      { 
+       bbtkError("ComplexBlackBoxDescriptor::Connect : no factory set");
+      }
+    
+
   // Verify that a box with the same name does not exist already
     BlackBox* bbfrom = mPrototype->bbGetBlackBox( from );
     if ( !bbfrom ) 
@@ -147,7 +160,7 @@ namespace bbtk
        bbtkError("the black box \""<<to<<"\" does not exist");
       }
     
-    Connection* c = /*mFactory->*/ NewConnection( bbfrom, output, bbto, input );
+    Connection* c = mFactory->NewConnection( bbfrom, output, bbto, input );
 
     mPrototype->bbAddConnection(c);
 
index cfa7945e1302592d93ae912f23ecd53f0b3ba118..27dcd4dd89ebb8c399fbfef8f4ef7de10a89b149 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkComplexBlackBoxDescriptor.h,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/03/07 10:21:30 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -45,18 +45,28 @@ namespace bbtk
   public:
 
     /// Default ctor with name 
-    ComplexBlackBoxDescriptor(const std::string& name); //, Factory* f); 
+    ComplexBlackBoxDescriptor(const std::string& name); 
     /// Default dtor
     ~ComplexBlackBoxDescriptor();
+
+    /// Sets the factory used 
+    void SetFactory(Factory* f) { mFactory = f; }
+    /// Gets the factory used
+    Factory* GetFactory() { return mFactory; }
+    /// Gets the factory used (const)
+    const Factory* GetFactory() const { return mFactory; }
+
     /// Creates an instance of name <name> of the ComplexBlackBox of which this is the descriptor 
     virtual BlackBox* CreateInstance(const std::string& name);
 
     /// Adds a black box to the complex box
+    /// Needs a factory set !
     void Add ( const std::string& type,
               const std::string& name
               ); 
     /// Connects two black boxes of the complex box
-    void Connect ( const std::string& from,
+    /// Needs a factory set !
+     void Connect ( const std::string& from,
                   const std::string& output,
                   const std::string& to,
                   const std::string& input
@@ -114,6 +124,8 @@ namespace bbtk
   private:
     /// Default ctor is private (must have name and factory)
     ComplexBlackBoxDescriptor() {}
+    /// The factory used
+    Factory* mFactory;
     /// The complex box in which boxes and connections are stored
     ComplexBlackBox* mPrototype;
     /// The name of the script file from which it was created
index 50496582f7b9f544d80485495029085aea06c4c3..8dbce184f9b5ae64f78a144306f6edb2893c7ce2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConnection.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/05 13:23:46 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2008/03/07 10:21:30 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -32,8 +32,10 @@ namespace bbtk
   /// Ctor with the black box from and to and their input and output.
 /// Check the input and output compatibility
   Connection::Connection(BlackBox* from, const std::string& output,
-                        BlackBox* to, const std::string& input   )
+                        BlackBox* to, const std::string& input ,
+                        const Factory* f  )
     : mAdaptor(0),
+      mFactory(f),
       mFromAny(false),
       mToAny(false)
   {
@@ -97,7 +99,7 @@ namespace bbtk
            std::string name;
            name = from->bbGetName() + "." + output + "-" 
              + to->bbGetName() + "." + input; 
-           mAdaptor = NewAdaptor(from->bbGetOutputType(output),
+           mAdaptor = mFactory->NewAdaptor(from->bbGetOutputType(output),
                                  to->bbGetInputType(input),
                                  name);
            if (!mAdaptor)  
@@ -229,7 +231,7 @@ namespace bbtk
            bbtk::BlackBox* adaptor = 0;
            try 
              {
-               adaptor = NewAdaptor(mFrom->bbGetOutput(mOutput).type(),
+               adaptor = mFactory->NewAdaptor(mFrom->bbGetOutput(mOutput).type(),
                                     mTo->bbGetInputType(mInput),
                                     "");
              }
index 4a7996844034dea487967bf1664fa49849fc9b6d..b75cb20db5b6d702b7842fce5fea430327714daf 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConnection.h,v $
   Language:  C++
-  Date:      $Date: 2008/02/20 16:05:38 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2008/03/07 10:21:30 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
 #define __bbtkConnection_h__
 
 #include "bbtkSystem.h"
+
 #include <string>
 
 namespace bbtk
 {
+
+  class Factory;
+
   /// 
   typedef int IOStatus;
   /// 
@@ -51,7 +55,8 @@ namespace bbtk
   public:
     /// Ctor 
     Connection(BlackBox* from, const std::string& output,
-              BlackBox* to, const std::string& input   );
+              BlackBox* to, const std::string& input,
+              const Factory* f );
     /// Dtor
     ~Connection();
 
@@ -93,6 +98,9 @@ namespace bbtk
     /// Adaptor black box if needed
     BlackBox* mAdaptor;
 
+    /// The factory used to create adaptors
+    const Factory* mFactory;
+
     /// Is the connection input type is any<thing> ?
     bool mFromAny;
 
index 5e9c395b9ff66c5119043a2c7c6105a4e4427c08..85e92b0376d140d1313b5254923562fd191dd5d2 100644 (file)
@@ -4,8 +4,8 @@ Program:   bbtk
 Module:    $RCSfile: bbtkFactory.cxx,v $
 Language:  C++
 
-Date:      $Date: 2008/03/07 08:40:14 $
-Version:   $Revision: 1.27 $
+Date:      $Date: 2008/03/07 10:21:30 $
+Version:   $Revision: 1.28 $
                                                                                 
 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
@@ -723,53 +723,7 @@ namespace bbtk
                       <<to->bbGetName()<<"\",\""<<input
                       <<"\")"<<std::endl);
     
-    return new Connection(from,output,to,input);
-    /*  
-       Connection* c;
-    // !!! WARNING : WE NEED TO TEST THE TYPE NAME EQUALITY 
-    // BECAUSE IN DIFFERENT DYN LIBS THE type_info EQUALITY CAN 
-    // BE FALSE (DIFFERENT INSTANCES !)
-  
-    std::string t1 ( from->bbGetOutputType(output).name() );
-    std::string t2 ( to->bbGetInputType(input).name() );
-
-
-    if ( t1 == t2 ) 
-       //from->bbGetOutputType(output) ==
-       // to->bbGetInputType(input) )
-      {
-         c = new Connection(from,output,to,input);
-      }
-    else 
-      {
-         //   std::cout << "Adaptive connection "<<std::endl;
-         std::string name;
-         name = from->bbGetName() + "." + output + "-" 
-                                  + to->bbGetName() + "." + input; 
-
-         BlackBox* b = 0; 
-         PackageMapType::const_iterator i;
-         for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
-         {
-             b = i->second.mPackage->NewAdaptor(from->bbGetOutputType(output),
-                                                  to->bbGetInputType(input),
-                                                  name);
-             if (b) break; 
-         } 
-         if (!b)  
-         {  
-            bbtkError("did not find any <"
-                       <<TypeName(from->bbGetOutputType(output))
-                       <<"> to <"
-                       <<TypeName(to->bbGetInputType(input))
-                       <<"> adaptor");
-         } 
-         c = new AdaptiveConnection(from,output,to,input,b);
-      }
-      bbtkDebugDecTab("Kernel",7);
-    
-      return c;
-    */
+    return new Connection(from,output,to,input,this);
   }
   //===================================================================
 
index 0609b5fb065e01d34a41f00a964f0f177436a93b..dd432e7bd7cd676378186730024a7e5d895a94b0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkTranscriptor.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/02/18 10:41:02 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/03/07 10:21:30 $
+  Version:   $Revision: 1.7 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -73,7 +73,7 @@ std::cout << "====================================================== delete Tran
      }
      if (mPackage)
      {
-        GetGlobalFactory()->UnLoadPackage("user");
+        //GetGlobalFactory()->UnLoadPackage("user");
      }
 
      if(m_Fp)