]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkFactory.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkFactory.cxx
index 6b4079344912f2c976bba2e3e209c044990f6d7e..036231f9e94cc77f90ecf8683e795c94cb7672d2 100644 (file)
@@ -4,8 +4,8 @@ Program:   bbtk
 Module:    $RCSfile: bbtkFactory.cxx,v $
 Language:  C++
 
-Date:      $Date: 2008/03/11 12:27:21 $
-Version:   $Revision: 1.30 $
+Date:      $Date: 2008/04/08 06:59:30 $
+Version:   $Revision: 1.31 $
                                                                                 
 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
@@ -80,14 +80,6 @@ namespace bbtk
   //===================================================================
   void Factory::Reset()
   {
-    /*
-printf("EED kkkkkkkkkkkkkkkkkkkkkkkk  Factory::Reset() \n");
-printf("EED kkkkkkkkkkkkkkkkkkkkkkkk  Factory::Reset() \n");
-printf("EED kkkkkkkkkkkkkkkkkkkkkkkk  Factory::Reset() \n");
-printf("EED kkkkkkkkkkkkkkkkkkkkkkkk  Factory::Reset() \n");
-printf("EED kkkkkkkkkkkkkkkkkkkkkkkk  Factory::Reset() \n");
-printf("EED kkkkkkkkkkkkkkkkkkkkkkkk  Factory::Reset() \n");
-    */
     bbtkDebugMessageInc("Kernel",7,"Factory::Reset()"<<std::endl);
     CloseAllPackages();
     bbtkDebugDecTab("Kernel",7);
@@ -689,13 +681,13 @@ printf("EED kkkkkkkkkkkkkkkkkkkkkkkk  Factory::Reset() \n");
 
   //===================================================================
   /// Creates an instance of a black box of type <type> with name <name>
-  BlackBox* Factory::NewAdaptor(TypeInfo typein,
-                     TypeInfo typeout,
-                     const std::string& name) const
+  BlackBox* Factory::NewAdaptor(const DataInfo& typein,
+                               const DataInfo& typeout,
+                               const std::string& name) const
   {
-    bbtkDebugMessageInc("Kernel",8,"Factory::NewAdaptor(<"
-                        <<TypeName(typein)<<">,<"
-                        <<TypeName(typeout)<<">,\""
+    bbtkDebugMessageInc("Kernel",8,"Factory::NewAdaptor("
+                        <<typein<<","
+                        <<typeout<<",\""
                         <<name<<"\")"<<bbtkendl);
 
 
@@ -708,12 +700,107 @@ printf("EED kkkkkkkkkkkkkkkkkkkkkkkk  Factory::Reset() \n");
       }
     if (!b) 
       {
-      bbtkError("no <"
-          <<TypeName(typein)<<"> to <"
-          <<TypeName(typeout)
-          <<"> adaptor available");
+       bbtkError("no "<<typein<<" to "<<typeout
+                 <<" adaptor available");
+      } 
+    
+    bbtkDebugDecTab("Kernel",7);
+    return b; 
+  }
+  //===================================================================
+
+
+  //===================================================================
+  /// Creates an instance of a black box of type <type> with name <name>
+  BlackBox* Factory::NewWidgetAdaptor(const DataInfo& typein,
+                                     const DataInfo& typeout,
+                                     const std::string& name) const
+  {
+    bbtkDebugMessageInc("Kernel",8,"Factory::NewWidgetAdaptor(<"
+                        <<typein<<">,<"
+                        <<typeout<<">,\""
+                        <<name<<"\")"<<bbtkendl);
+
+
+    BlackBox* b = 0; 
+    PackageMapType::const_iterator i;
+    for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+      {
+       b = i->second.mPackage->NewWidgetAdaptor(typein,
+                                                typeout,
+                                                name);
+      if (b) break; 
+      }
+    if (!b) 
+      {
+       bbtkError("no "<<typein<<" to "<<typeout
+                 <<"> widget adaptor available");
+      } 
+    
+    bbtkDebugDecTab("Kernel",7);
+    return b; 
+  }
+  //===================================================================
+
+  //===================================================================
+  /// Creates an instance of a black box of type <type> with name <name>
+  bool Factory::FindAdaptor(const DataInfo& typein,
+                                 const DataInfo& typeout,
+                                 std::string& adaptor) const
+  {
+    bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
+                        <<typein<<">,<"
+                        <<typeout<<">)"<<bbtkendl);
+    
+    bool b = false;
+    PackageMapType::const_iterator i;
+    for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+      {
+       b = i->second.mPackage->FindAdaptor(typein,
+                                           typeout,
+                                           adaptor);
+       if (b) break; 
+      }
+    /*
+    if (!b) 
+      {
+       bbtkError("no "<<typein<<" to "<<typeout
+                 <<"> widget adaptor available");
       } 
+    */
+
+    bbtkDebugDecTab("Kernel",7);
+    return b; 
+  }
+  //===================================================================
+
+  //===================================================================
+  /// Creates an instance of a black box of type <type> with name <name>
+  bool Factory::FindWidgetAdaptor(const DataInfo& typein,
+                                 const DataInfo& typeout,
+                                 std::string& adaptor) const
+  {
+    bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
+                        <<typein<<">,<"
+                        <<typeout<<">)"<<bbtkendl);
     
+    bool b = false;
+    PackageMapType::const_iterator i;
+    for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+      {
+       b = i->second.mPackage->FindWidgetAdaptor(typein,
+                                                 typeout,
+                                                 adaptor);
+       if (b) break; 
+      }
+    /*
+    if (!b) 
+      {
+       bbtkError("no "<<typein<<" to "<<typeout
+                 <<"> widget adaptor available");
+      } 
+    */
+
     bbtkDebugDecTab("Kernel",7);
     return b; 
   }