Program:   bbtk
 Module:    $RCSfile: bbtkBlackBox.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/22 06:59:31 $
-Version:   $Revision: 1.12 $
+Date:      $Date: 2008/04/22 08:29:09 $
+Version:   $Revision: 1.13 $
                                                                                 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
 l'Image). All rights reserved. See doc/license.txt or
   //=========================================================================
   void BlackBox::Check(bool recursive)
   {
-    bbtkMessage("Debug",1,"*** Checking Black Box "<<(void*)this<<" ["<<bbGetFullName()
+    bbtkMessage("debug",1,"*** Checking Black Box "<<(void*)this<<" ["<<bbGetFullName()
                <<"] ... OK"<<std::endl);
   }
   //=========================================================================
 
 Program:   bbtk
 Module:    $RCSfile: bbtkComplexBlackBox.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/22 06:59:31 $
-Version:   $Revision: 1.13 $
+Date:      $Date: 2008/04/22 08:29:09 $
+Version:   $Revision: 1.14 $
                                                                                 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
 l'Image). All rights reserved. See Doc/License.txt or
   //=======================================================================
   void ComplexBlackBox::Check(bool recursive)
   {
-     bbtkMessage("Debug",1,"**** Checking Complex Black Box "<<(void*)this
+     bbtkMessage("debug",1,"**** Checking Complex Black Box "<<(void*)this
                 <<" ["<<bbGetFullName()<<"]"<<std::endl);
      
      BlackBoxMapType::const_iterator i;
      for ( j = mConnectionList.begin(); 
           j != mConnectionList.end(); ++j ) 
        {
-        //(*j)->Check();
+        (*j)->Check();
        }
-     bbtkMessage("Debug",1,"**** Checking Complex Black Box "<<(void*)this
+     bbtkMessage("debug",1,"**** Checking Complex Black Box "<<(void*)this
                 <<" ["<<bbGetFullName()<<"] ... OK"<<std::endl);
   
   }
 
   Program:   bbtk
   Module:    $RCSfile: bbtkConnection.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/22 06:59:31 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2008/04/22 08:29:09 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
   //==================================================================
   void Connection::Check() const
   {
-    bbtkMessage("Debug",1,"** Checking Connection "<<(void*)this<<" ["<<GetFullName()<<"]"
+    bbtkMessage("debug",1,"** Checking Connection "<<(void*)this<<" ["<<GetFullName()<<"]"
                <<std::endl);
     if (mFrom==0) 
       {
-       bbtkMessage("Debug",2," - From = 0"<<std::endl);
+       bbtkMessage("debug",2," - From = 0"<<std::endl);
       }
     else
       {
-       bbtkMessage("Debug",2," - From : "<<mFrom->bbGetFullName()<<std::endl);
+       bbtkMessage("debug",2," - From : "<<mFrom->bbGetFullName()<<std::endl);
        if (!mFrom->bbHasOutput(mOutput))
          {
            bbtkError("** Checking Connection "<<(void*)this
                      << mFrom->bbGetFullName()<<" does not have output '"
                      <<mOutput<<"'");
          }     
-       bbtkMessage("Debug",2," - From : Output '"<<mOutput<<"' exists"<<std::endl);
+       bbtkMessage("debug",2," - From : Output '"<<mOutput<<"' exists"<<std::endl);
        BlackBox::OutputConnectorMapType::const_iterator i 
          = mFrom->bbGetOutputConnectorMap().find(mOutput);
        if (i== mFrom->bbGetOutputConnectorMap().end())
                       <<mFrom->bbGetFullName()<<" output '"
                       <<mOutput<<"' is not in OutputConnectorMap");
          }
-       bbtkMessage("Debug",2," - From : Output '"<<mOutput
+       bbtkMessage("debug",2," - From : Output '"<<mOutput
                    <<"' is in OutputConnectorMap"<<std::endl);
 
         std::vector< Connection::WeakPointer >::const_iterator j;
                      <<" does not point to this connection");
            
          }
-       bbtkMessage("Debug",2," - From : This connection is in OutputConnector connection vector"<<std::endl);
-       bbtkMessage("Debug",1," * Box from : Check successfull"<<std::endl);
+       bbtkMessage("debug",2," - From : This connection is in OutputConnector connection vector"<<std::endl);
+       bbtkMessage("debug",1," * Box from : Check successfull"<<std::endl);
 
       }
 
     if (mTo==0) 
       {
-       bbtkMessage("Debug",2," - To   = 0"<<std::endl);
+       bbtkMessage("debug",2," - To   = 0"<<std::endl);
       }
     else
       {
-       bbtkMessage("Debug",2," - To   : "<<mTo->bbGetName()<<std::endl);
+       bbtkMessage("debug",2," - To   : "<<mTo->bbGetName()<<std::endl);
        //      std::cout << mTo << std::endl;
        //      std::cout << mTo->bbGetDescriptor() << std::endl;
        //      std::cout << mTo->bbGetDescriptor()->GetTypeName() << std::endl;
        //      mTo->bbGetFullName();
-       bbtkMessage("Debug",2," - To   : "<<mTo->bbGetFullName()<<std::endl);
+       bbtkMessage("debug",2," - To   : "<<mTo->bbGetFullName()<<std::endl);
        if (!mTo->bbHasInput(mInput))
          {
            bbtkError("** Checking Connection "<<(void*)this
                      <<mTo->bbGetFullName()<<" does not have input '"
                      <<mInput<<"'");
          }     
-       bbtkMessage("Debug",2," - To   : Input '"<<mInput<<"' exists"<<std::endl);
+       bbtkMessage("debug",2," - To   : Input '"<<mInput<<"' exists"<<std::endl);
        BlackBox::InputConnectorMapType::const_iterator i 
          = mTo->bbGetInputConnectorMap().find(mInput);
        if (i== mTo->bbGetInputConnectorMap().end())
                       <<mTo->bbGetFullName()<<" input '"
                       <<mInput<<"' is not in InputConnectorMap");
          }
-       bbtkMessage("Debug",2," - To   : Input '"<<mInput
+       bbtkMessage("debug",2," - To   : Input '"<<mInput
                    <<"' is in InputConnectorMap"<<std::endl);
 
        if (i->second->GetConnection()==0)
                      <<" does not point to this connection");
     
          }
-       bbtkMessage("Debug",2," - To   : This connection is in InputConnector connection vector"<<std::endl);
-       bbtkMessage("Debug",1," * Box to   : Check successfull"<<std::endl);
+       bbtkMessage("debug",2," - To   : This connection is in InputConnector connection vector"<<std::endl);
+       bbtkMessage("debug",1," * Box to   : Check successfull"<<std::endl);
 
       }
   }
 
 Module:    $RCSfile: bbtkFactory.cxx,v $
 Language:  C++
 
-Date:      $Date: 2008/04/22 06:59:31 $
-Version:   $Revision: 1.35 $
+Date:      $Date: 2008/04/22 08:29:09 $
+Version:   $Revision: 1.36 $
                                                                                 
 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   // 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
     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;
 
         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) )
         ok = DoLoadPackage( libname, pkgname, path);
         if (ok)
         {
-           bbtkMessage("Debug",2,"   OK"<<std::endl);
+           bbtkMessage("debug",2,"   OK"<<std::endl);
            break; // a package was found; we stop iterating
         }
     } //------------------ // end for ( package_paths.begin();i!=package_paths.end() )
   //===================================================================
   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);
   }
   //===================================================================
 
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/22 06:59:31 $
-  Version:   $Revision: 1.61 $
+  Date:      $Date: 2008/04/22 08:29:09 $
+  Version:   $Revision: 1.62 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
         break;
 
       case cReset :  
-        this->mExecuter->Reset();
-       mFileNameHistory.clear();
+       Reset();
         break;
 
       case cInclude :
   //=======================================================================
 
 
- 
+  //=======================================================================
+  void Interpreter::Reset()
+  {
+    // Cannot close all files if the reset command is read from a file !
+    //    CloseAllFiles();
+    mFileNameHistory.clear();
+    this->mExecuter->Reset();
+  }
+  //=======================================================================
 
   //=======================================================================
   /**
    *
    */
 
-// ===================================================================================
-
+  // =========================================================================
   void Interpreter::SwitchToFile( const std::string& name )
   {
   // Note : in the following :
        c=0;
        read ( STDIN_FILENO, &c, 4) ;
 
-       bbtkDebugMessage("Debug",9,"[0x"<<std::hex<<c<<"]\n");
+       bbtkDebugMessage("debug",9,"[0x"<<std::hex<<c<<"]\n");
 
        // Printable character
        if ( (ind<MAX_LINE_SIZE-1) &&
  //==========================================================================
   void Interpreter::ObjectInfo(const std::string& name)
   {
-    Object:: PrintObjectInfo(name);
+    if ((name.length()==2)&&(name[0]=='-'))
+      {
+       if (name[1]=='S')
+         {
+           bbtk::StaticInitTime::PrintObjectListInfo = true;
+         }
+       if (name[1]=='C')
+         {
+           //      int o = MessageManager::GetMessageLevel("debug");
+           //      if (o<2) MessageManager::SetMessageLevel("debug",2);
+           mExecuter->GetFactory()->CheckPackages();
+           //      MessageManager::SetMessageLevel("debug",o);
+         }
+      }
+    else 
+      {
+       Object:: PrintObjectListInfo(name);
+      }
   }
  //==========================================================================
  //==========================================================================
 
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.h,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/18 12:59:15 $
-  Version:   $Revision: 1.26 $
+  Date:      $Date: 2008/04/22 08:29:09 $
+  Version:   $Revision: 1.27 $
 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
     /// Closes all open files
     void CloseAllFiles();
 
+    /// Resets all
+    void Reset();
+
     /// Displays help (entry point of any help)
     void Help(const std::vector<std::string>& words);
 
 
   Program:   bbtk
   Module:    $RCSfile: bbtkMessageManager.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/22 06:59:31 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/04/22 08:29:09 $
+  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
     mMessageLevel[key] = 1;
     mMessageHelp[key] = "Output messages";
     if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
-    key = "Debug";
+    key = "debug";
     mMessageLevel[key] = 0;
     mMessageHelp[key] = "Debug messages";
     if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
 
   //=======================================================================
   
   //=======================================================================
-  void Object::PrintObjectListInfo()
+  void Object::PrintObjectListInfo(const std::string& name)
   {
     
     std::cout 
        else 
          { 
            Object::Pointer p(i->lock());
-           PrintObjectInfo(p);
-           n++;
-           m += p->GetObjectSize();
+           if (p->GetObjectName().find(name) != std::string::npos ) 
+             {
+               std::cout << n << "/" << mgObjectList.size() << " ";
+               PrintObjectInfo(p);
+               m += p->GetObjectSize();
+               n++;
+             }
          }
       }
     std::cout 
   }
   //=======================================================================
 
+  /*
   //=======================================================================
   void Object::PrintObjectInfo(const std::string& name)
   {
       }
   }
   //=======================================================================
-
+  */
   //=======================================================================
   void Object::PrintObjectInfo(const Object::Pointer& p)
   {
        std::cout << std::endl
                  << "***************** main ended *******************"
                  << std::endl << std::endl;
-       Object::PrintObjectListInfo();
+       Object::PrintObjectListInfo("");
       }
   }
   //=======================================================================
 
   Program:   bbtk
   Module:    $RCSfile: bbtkObject.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/18 12:59:15 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/04/22 08:29:09 $
+  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
     static void InsertInObjectList(Pointer);
     static void RemoveFromObjectList(WeakPointer);
 
-    static void PrintObjectListInfo();
-    static void PrintObjectInfo(const std::string& name);
+    static void PrintObjectListInfo(const std::string& name);
+    //    static void PrintObjectInfo(const std::string& name);
     static void PrintObjectInfo(const Pointer& o); 
     /// Default objects deleter : removes object from list on deletion
     struct Deleter 
 
   Program:   bbtk
   Module:    $RCSfile: bbtkPackage.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/22 06:59:31 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2008/04/22 08:29:09 $
+  Version:   $Revision: 1.15 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
   //===================================================================
   void Package::CheckBoxes() const
   {
-    bbtkMessage("Debug",1,"****** Checking Package "<<(void*)this
+    bbtkMessage("debug",1,"****** Checking Package "<<(void*)this
                <<" ["<<GetName()<<"]"<<std::endl);
     BlackBoxMapType::const_iterator i;
     for (i=mBlackBoxMap.begin();
       {
        i->second->Check(true);
       }
-    bbtkMessage("Debug",1,"****** Checking Package "<<(void*)this
+    bbtkMessage("debug",1,"****** Checking Package "<<(void*)this
                <<" ["<<GetName()<<"] ... OK"<<std::endl);
   }
   //===================================================================