]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkFactory.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkFactory.cxx
index c024617d59d01416250563110db678ffe8f2855b..3ca2be2cb787adcefe5539dbf404d3bd83feb7d0 100644 (file)
@@ -4,8 +4,8 @@ Program:   bbtk
 Module:    $RCSfile: bbtkFactory.cxx,v $
 Language:  C++
 
-Date:      $Date: 2008/04/18 12:59:15 $
-Version:   $Revision: 1.33 $
+Date:      $Date: 2008/09/10 09:25:19 $
+Version:   $Revision: 1.38 $
                                                                                 
 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
@@ -137,7 +137,7 @@ namespace bbtk
   // lastname : string before the last / (if any), or user supplied name
 
     bbtkDebugMessageInc("Kernel",7,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl);
-    bbtkMessage("Debug",1,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl);
+    bbtkMessage("debug",1,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl);
 
     std::vector<std::string> package_paths;
     std::string libname;  // full path library name
@@ -146,8 +146,8 @@ namespace bbtk
     std::string upath;
     pkgname = Utilities::ExtractPackageName(name,upath);
 
-    bbtkMessage("Debug",1,"Package name ["<<pkgname<<"]"<<std::endl);
-    bbtkMessage("Debug",1,"Package path ["<<upath<<"]"<<std::endl);
+    bbtkMessage("debug",1,"Package name ["<<pkgname<<"]"<<std::endl);
+    bbtkMessage("debug",1,"Package path ["<<upath<<"]"<<std::endl);
 
     // no loading package if already loaded
     PackageMapType::iterator iUnload;
@@ -231,7 +231,7 @@ namespace bbtk
 
         libname = Utilities::MakeLibnameFromPath(path, pkgname);
 
-        bbtkMessage("Debug",2,"-> Trying to load [" << libname << "]" <<std::endl);
+        bbtkMessage("debug",2,"-> Trying to load [" << libname << "]" <<std::endl);
 
       // Check if library exists           
         if ( !Utilities::FileExists(libname) )
@@ -250,9 +250,9 @@ namespace bbtk
         ok = DoLoadPackage( libname, pkgname, path);
         if (ok)
         {
-           bbtkMessage("Debug",2,"   OK"<<std::endl);
-           break; // a package was found; we stop iterating
+           bbtkMessage("debug",2,"   OK"<<std::endl);
         }
+       break; // we stop iterating even if error : have to signal it to user
     } //------------------ // end for ( package_paths.begin();i!=package_paths.end() )
 
 }
@@ -267,10 +267,12 @@ namespace bbtk
       {
 #if defined(__GNUC__)
         bbtkError("Could not load package ["<< pkgname
-                  <<"] :" << std::endl << "   " << dlerror());
+                  <<"] :" << std::endl 
+                 << "  Opening "<<libname<<" failed"
+                 << "  Reason: "<< dlerror());
 #elif defined(_WIN32)
         bbtkError("Could not load package ["<<pkgname
-                 <<"] : " << std::endl << "   " <<libname<<" not found");
+                 <<"] :"<< std::endl << "   Error loading " <<libname);
 
     // look how to get the error message on win
     //<<dlerror());
@@ -456,13 +458,9 @@ namespace bbtk
     bbtkDebugMessageInc("Kernel",9,"Factory::InsertPackage(\""<<
                         p->GetName()<<"\")"<<std::endl);
 
-    std::cout << p.use_count() <<std::endl;
-
     p->AddFactory(GetThisPointer<Factory>());
     mPackageMap[p->GetName()] = p;
 
-    std::cout << p.use_count() <<std::endl;
-
     bbtkDebugDecTab("Kernel",9);
   }
   //===================================================================
@@ -674,7 +672,7 @@ namespace bbtk
                 ++j)
              {
                if ( ( j->first.mKind ==  
-                      BlackBoxDescriptor::DEFAULT_WIDGET_ADAPTOR) &&
+                      BlackBoxDescriptor::DEFAULT_GUI) &&
                     //(j->first.mTypeIn == typein) &&
                     (j->first.mTypeOut.GetNature() == typeout.GetNature() ) 
                     )
@@ -754,14 +752,14 @@ namespace bbtk
   //===================================================================
   void Factory::CheckPackages() const
   {
-    bbtkMessage("Debug",1,"****** Checking Factory "<<(void*)this
+    bbtkMessage("debug",1,"****** Checking Factory "<<(void*)this
                 <<std::endl);
     PackageMapType::const_iterator i;
     for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
       {
        i->second->CheckBoxes();
       }
-    bbtkMessage("Debug",1,"****** Checking Factory "<<(void*)this
+    bbtkMessage("debug",1,"****** Checking Factory "<<(void*)this
                <<" ... OK"<<std::endl);
   }
   //===================================================================
@@ -1020,7 +1018,7 @@ namespace bbtk
     ptm = gmtime ( &rawtime );
 
     s << "<p><hr>\n";
-    s << "Automatically generated by <b>bbi</b> on "
+    s << "Automatically generated by <b>bbtk</b> on "
       << ptm->tm_mday << "/" << ptm->tm_mon << "/" << ptm->tm_year+1900 
       << " - " << ptm->tm_hour << ":" << ptm->tm_min << " GMT\n";
     s << "</body></html>\n";