]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Wed, 9 Apr 2008 11:16:56 +0000 (11:16 +0000)
committerguigues <guigues>
Wed, 9 Apr 2008 11:16:56 +0000 (11:16 +0000)
20 files changed:
kernel/src/bbtkAtomicBlackBoxMacros.h
kernel/src/bbtkBlackBox.cxx
kernel/src/bbtkBlackBox.h
kernel/src/bbtkBlackBoxDescriptor.cxx
kernel/src/bbtkBlackBoxDescriptor.h
kernel/src/bbtkBlackBoxOutputConnector.cxx
kernel/src/bbtkComplexBlackBox.cxx
kernel/src/bbtkComplexBlackBox.h
kernel/src/bbtkComplexBlackBoxDescriptor.cxx
kernel/src/bbtkComplexBlackBoxDescriptor.h
kernel/src/bbtkConnection.cxx
kernel/src/bbtkConnection.h
kernel/src/bbtkExecuter.cxx
kernel/src/bbtkFactory.cxx
kernel/src/bbtkFactory.h
kernel/src/bbtkInterpreter.cxx
kernel/src/bbtkInterpreter.h
kernel/src/bbtkPackage.cxx
kernel/src/bbtkPackage.h
kernel/src/bbtkWxGUIPackageBrowser2.cxx

index 605c10d0d7255ffc4b09f443c2967017db8f848e..ed05e79981dca978b3b07c2991ef93f8f92ebb3c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkAtomicBlackBoxMacros.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:29 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2008/04/09 11:16:56 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -41,7 +41,8 @@
     bbtkDebugMessageInc("Kernel",9,#CLASS<<"::bbNew(\""<<name<<"\")"<<std::endl); \
     bbCreateDescriptorIfNeeded();                                      \
     CLASS* c = new CLASS(name);                                                \
-    bbtkDebugDecTab("Kernel",9);                                               \
+    c->bbGetDescriptor()->Reference();                                 \
+    bbtkDebugDecTab("Kernel",9);                                       \
     return c;                                                          \
   }                                                                    \
   inline bbtk::BlackBox* bbClone(const std::string& name)              \
@@ -49,7 +50,8 @@
     bbtkDebugMessageInc("Kernel",9,#CLASS<<"::bbClone(\""<<name<<"\")"<<std::endl); \
     bbCreateDescriptorIfNeeded();                                      \
     CLASS* c = new CLASS(*this,name);                                  \
-    bbtkDebugDecTab("Kernel",9);                                               \
+    bbGetDescriptor()->Reference();                                    \
+    bbtkDebugDecTab("Kernel",9);                                       \
     return c;                                                          \
   }                                                                    \
   bbtk::BlackBoxDescriptor* bbGetDescriptor() const                    \
index cd26c11b23670535ec9f25d0df148c74bbc74efa..9a62efb37ca3b78c4c57837b31098169cc361366 100644 (file)
@@ -3,8 +3,8 @@
 Program:   bbtk
 Module:    $RCSfile: bbtkBlackBox.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/08 06:59:29 $
-Version:   $Revision: 1.8 $
+Date:      $Date: 2008/04/09 11:16:57 $
+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
@@ -86,8 +86,9 @@ namespace bbtk
   /// Destruction method of a black box
   void BlackBox::bbDelete()
   {
-    bbtkDebugMessage("Kernel",5,"BlackBox::bbDelete() ["
+    bbtkDebugMessage("Kernel",1,"BlackBox::bbDelete() ["
                     <<bbGetFullName()<<"]"<<std::endl);    
+    bbGetDescriptor()->UnReference();
     this->bbUserDelete();
   }
   //=========================================================================
@@ -1085,6 +1086,13 @@ namespace bbtk
 */
    //=========================================================================
 
+  //=========================================================================
+  void BlackBox::Check(bool recursive)
+  {
+    bbtkMessage("Debug",1,"*** Checking Black Box "<<(void*)this<<" ["<<bbGetFullName()
+               <<"] ... OK"<<std::endl);
+  }
+  //=========================================================================
 
 }  // EO namespace bbtk
 
index 4fb82fa629dd5e9221c87c65eae13c6031ebf6d3..f160dd574031f98133aa0cca4b583028f0b02b2b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:29 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -250,6 +250,8 @@ bool reaction = true);
     std::string bbGetInputAsString( const std::string &input); //,Factory *factory);
     virtual BlackBox *bbFindBlackBox(const std::string &blackboxname) { return NULL;}
 
+    virtual void Check(bool recursive = true);
+
   protected:
     //==================================================================
     // PROTECTED PART : ACCESSIBLE TO THE BlackBox DEVELOPER 
@@ -374,6 +376,7 @@ bool reaction = true);
     // PRIVATE PART 
     /// Default constructor is private : derived classes must use the constructor with the BlackBox's name
     BlackBox() {}
+    BlackBox(const BlackBox&) {}
     /// The status of the box
     IOStatus bbmStatus;
     /// The name of the black-box
index e9436f562a69b642141c6646217807413b8b4431..68ba2439d61b71fd5303191ec0b751cb1ed490a8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxDescriptor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/19 18:40:09 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  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
@@ -38,7 +38,8 @@ namespace bbtk
       mAuthor(""),
       mCategory(""),
       mKind(STANDARD),
-      mPackage(NULL)
+      mPackage(NULL),
+      mRefCount(0)
   {
     bbtkDebugMessage("Kernel",9,
                     "BlackBoxDescriptor::BlackBoxDescriptor()"<<std::endl);
@@ -63,12 +64,36 @@ namespace bbtk
   }
   //=========================================================================
 
+  //=========================================================================
+  /// Dtor
+  void BlackBoxDescriptor::UnReference()
+  {
+    bbtkDebugMessageInc("Kernel",1,
+                       "BlackBoxDescriptor::UnReference() ["
+                       <<mTypeName<<"] #"<<mRefCount-1<<std::endl);
+    mRefCount--;
+    if (mRefCount<=0) 
+      {
+       bbtkDebugMessage("Kernel",1,"--> Destructing BlackBoxDescriptor ["<<mTypeName<<"]"<<std::endl);
+       delete this;
+      }
+  }
+  //=========================================================================
+
+  //=========================================================================
+  /// Check
+  void BlackBoxDescriptor::Check(bool) const
+  {
+    
+  }
+  //=========================================================================
+
   //=========================================================================
   /// Adds the string to the BlackBox description
   void BlackBoxDescriptor::AddToDescription( const std::string& s, bool clear)
   {
     bbtkDebugMessage("Kernel",9,"BlackBoxDescriptor::AddToDescription(\""<<s<<
-                    "\") ["<<GetTypeName()<<"]"<<std::endl);
+                    "\") ["<<GetFullTypeName()<<"]"<<std::endl);
     if (clear) mDescription = s; 
     else mDescription += s;
    }
@@ -79,7 +104,7 @@ namespace bbtk
   void BlackBoxDescriptor::AddToAuthor( const std::string& s, bool clear)
   {
     bbtkDebugMessage("Kernel",9,"BlackBoxDescriptor::AddToAuthor(\""<<s<<"\") ["
-                    <<GetTypeName()<<"]"<<std::endl);
+                    <<GetFullTypeName()<<"]"<<std::endl);
     if (clear) mAuthor = s;
     else mAuthor += s;
   }
@@ -90,7 +115,7 @@ namespace bbtk
   void BlackBoxDescriptor::AddToCategory( const std::string& s, bool clear)
   {
     bbtkDebugMessage("Kernel",9,"BlackBoxDescriptor::AddToCategory(\""<<s<<"\") ["
-                    <<GetTypeName()<<"]"<<std::endl);  
+                    <<GetFullTypeName()<<"]"<<std::endl);  
     if (clear) mCategory = s;
     else mCategory += s;
     mCategory += ";";
@@ -102,7 +127,7 @@ namespace bbtk
   BlackBoxDescriptor::GetInputDescriptor(const std::string & name) const
   {
     bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::GetInputDescriptor('"
-                       <<name<<"') ["<<GetTypeName()<<"]"<<std::endl);
+                       <<name<<"') ["<<GetFullTypeName()<<"]"<<std::endl);
 
     InputDescriptorMapType::const_iterator i;
     i = mInput.find(name);
@@ -120,7 +145,7 @@ namespace bbtk
   BlackBoxDescriptor::GetOutputDescriptor(const std::string & name) const
   {
     bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::GetOutputDescriptor('"
-                       <<name<<"') ["<<GetTypeName()<<"]"<<std::endl);
+                       <<name<<"') ["<<GetFullTypeName()<<"]"<<std::endl);
 
     OutputDescriptorMapType::const_iterator i;
     i = mOutput.find(name);
@@ -136,16 +161,9 @@ namespace bbtk
   //=========================================================================
   void BlackBoxDescriptor::GetHelp(bool full) const
   {
-    bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::GetHelp() ["<<GetTypeName()<<"]"<<std::endl);
-    if (GetPackage()) 
-        {
-       bbtkMessage("Help",1,"Black Box <"<<
-                    GetPackage()->GetName()<<"::"<<GetTypeName()<<">"<<std::endl);
-    }
-    else 
-    {
-          bbtkMessage("Help",1,"Black Box <::"<<GetTypeName()<<">"<<std::endl);
-        }
+    bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::GetHelp() ["<<GetFullTypeName()<<"]"<<std::endl);
+
+    bbtkMessage("Help",1,"Black Box <"<<GetFullTypeName()<<">"<<std::endl);
     bbtkMessage("Help",1," "              <<GetDescription()<<std::endl);
     bbtkMessage("Help",1," By : "         <<GetAuthor()     <<std::endl);
     bbtkMessage("Help",1," Categories : " <<GetCategory()    <<std::endl);
@@ -156,12 +174,15 @@ namespace bbtk
     InputDescriptorMapType::const_iterator i;
     unsigned int namelmax = 0;
     unsigned int typelmax = 0;
+    unsigned int natlmax = 0;
     for ( i = mInput.begin();  i != mInput.end(); ++i ) 
     {
           if (i->second->GetName().size()>namelmax) 
             namelmax = i->second->GetName().size();
           if (i->second->GetHumanTypeName().size()>typelmax) 
             typelmax = i->second->GetHumanTypeName().size();
+          if (i->second->GetNature().size()>natlmax) 
+            natlmax = i->second->GetNature().size();
     }
     OutputDescriptorMapType::const_iterator o;
     for ( o = mOutput.begin();  o != mOutput.end(); ++o ) 
@@ -170,6 +191,8 @@ namespace bbtk
             namelmax = o->second->GetName().size();
           if (o->second->GetHumanTypeName().size()>typelmax) 
             typelmax = o->second->GetHumanTypeName().size();
+          if (o->second->GetNature().size()>natlmax) 
+            natlmax = o->second->GetNature().size();
     }
     //
     for ( i = mInput.begin();  i != mInput.end(); ++i ) 
@@ -180,10 +203,14 @@ namespace bbtk
           std::string type(i->second->GetHumanTypeName());
           type += ">";
           type.append(1+typelmax-type.size(),' ');
+          std::string nature(i->second->GetNature());
+          nature += "]";
+          nature.append(1+natlmax-nature.size(),' ');
           bbtkMessage("Help",1,
-                   "    '"<<name
-                   <<" <"<<type
-                   <<" : "<<i->second->GetDescription()<<std::endl);
+                      "    '"<<name
+                      <<" <"<<type
+                      <<" ["<<nature
+                      <<" : "<<i->second->GetDescription()<<std::endl);
     }
     if (mOutput.size()) 
       bbtkMessage("Help",1," * Outputs : "<<std::endl);
@@ -197,10 +224,14 @@ namespace bbtk
           std::string type(o->second->GetHumanTypeName());
           type += ">";
           type.append(1+typelmax-type.size(),' ');
+          std::string nature(o->second->GetNature());
+          nature += "]";
+          nature.append(1+natlmax-nature.size(),' ');
           bbtkMessage("Help",1,
                    "    '"<<name
-                   <<" <"<<type
-                   <<" : "<<o->second->GetDescription()<<std::endl);
+                      <<" <"<<type
+                      <<" ["<<nature
+                      <<" : "<<o->second->GetDescription()<<std::endl);
       }
    
      bbtkDebugDecTab("Kernel",9);
@@ -208,14 +239,23 @@ namespace bbtk
 
   }
   //=========================================================================
-
+   
+  //=========================================================================
+  /// Returns the full name of the **TYPE** of the black box (+package name)
+  std::string BlackBoxDescriptor::GetFullTypeName() const
+  {
+    if (mPackage!=0) return mPackage->GetName() + "::" + mTypeName;
+    return "::" + mTypeName;
+  }
+  //=========================================================================
   //=========================================================================
   void BlackBoxDescriptor::InsertHtmlHelp ( std::ofstream& s, 
                                            int detail, int level,
                                            const std::string& output_dir,
                                            bool relative_link )
   {
-    bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::InsertHtmlHelp() ["<<GetTypeName()<<"]"<<std::endl);
+    bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::InsertHtmlHelp() ["<<GetFullTypeName()<<"]"<<std::endl);
     
     //-------------
     // General info 
index 0b70d9461b272de5a39627b0954b6b73ddb9789d..a680b54f81124bbcd195085ee69ec4ddedef4168 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxDescriptor.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:29 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -64,8 +64,6 @@ namespace bbtk
 
     /// Default ctor
     BlackBoxDescriptor(); 
-    /// Default dtor
-    virtual ~BlackBoxDescriptor();
     /// Creates an instance with name boxname of the BlackBox
     /// of which this is the descriptor 
     virtual BlackBox* CreateInstance(const std::string& boxname) = 0;
@@ -73,6 +71,9 @@ namespace bbtk
     /// Returns the name of the **TYPE** of the black box
     const std::string& GetTypeName() const { return mTypeName; }
     
+    /// Returns the full name of the **TYPE** of the black box (+package name)
+    std::string GetFullTypeName() const;
+    
     /// Returns the description of the BlackBox 
     const std::string& GetDescription() const { return mDescription; }
     
@@ -140,7 +141,18 @@ namespace bbtk
                                  const std::string& output_dir = "",
                                  bool relative_link = false );
 
+    /// Increase ref count
+    void Reference() { mRefCount++; }
+    /// Decrease ref count and delete if no more used
+    void UnReference();
+
+    ///
+    virtual void Check(bool recursive=true) const;
+
   protected:
+    /// Default dtor is protected : use UnRegister to destroy (ref counting)
+    virtual ~BlackBoxDescriptor();
+
     /// Adds an input descriptor
     void AddInputDescriptor( BlackBoxInputDescriptor *d ) 
     { mInput[d->GetName()] = d; }
@@ -165,7 +177,12 @@ namespace bbtk
     InputDescriptorMapType mInput;
     /// The outputs 
     OutputDescriptorMapType mOutput;
+
+    /// Reference counting
+    int mRefCount;
     
+  private:
+    BlackBoxDescriptor(const BlackBoxDescriptor&) {}
   };
   // class BlackBoxDescriptor
   //==========================================================================
index 7535b352eae06e19751cb6fef8c47d4d096d6f24..d2ee80e74dec872efd777472318e9f46e7dcf3ae 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxOutputConnector.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/05 13:23:46 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  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
@@ -64,15 +64,12 @@ namespace bbtk
     bbtkDebugMessageInc("Kernel",9,"BlackBoxOutputConnector::UnsetConnection("
                     <<c<<")"<<std::endl);
 
-    std::vector<Connection*>::iterator i;
-    for (i=mConnection.begin();i!=mConnection.end();++i) 
-      {
-       if ( *i == c) break;
-      }
-    //= std::find(mConnection,c);
+    c->Check();
+    std::vector<Connection*>::iterator i
+      = find(mConnection.begin(),mConnection.end(),c);
     if (i==mConnection.end())
       {
-       bbtkError("no connexion "<<c);
+       bbtkInternalError("BlackBoxOutputConnector::UnsetConnection("<<c<<") : connection is absent from connections list");
       }
     mConnection.erase(i);
 
index 012a03f24c743a67d2bb440c32cd45d21d3cecc0..dbd76efd197b83a0a697152a58ce75743c09934e 100644 (file)
@@ -3,8 +3,8 @@
 Program:   bbtk
 Module:    $RCSfile: bbtkComplexBlackBox.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/08 06:59:29 $
-Version:   $Revision: 1.8 $
+Date:      $Date: 2008/04/09 11:16:57 $
+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
@@ -77,14 +77,15 @@ namespace bbtk
        bbtkDebugMessageInc("Kernel",9,"* Cloning \""<<
                            (*j)->GetFullName()<<"\""<<std::endl);
 
-       BlackBox* bbfrom = bbGetBlackBox( (*j)->GetBlackBoxFrom()->bbGetName() );
-       BlackBox* bbto = bbGetBlackBox( (*j)->GetBlackBoxTo()->bbGetName() );
+       BlackBox* bbfrom = bbGetBlackBox( (*j)->GetOriginalBlackBoxFrom()->bbGetName() );
+       BlackBox* bbto = bbGetBlackBox( (*j)->GetOriginalBlackBoxTo()->bbGetName() );
        Connection* c = mDescriptor->GetFactory()-> 
          NewConnection( bbfrom, 
-                        (*j)->GetBlackBoxFromOutput(), 
+                        (*j)->GetOriginalBlackBoxFromOutput(), 
                         bbto, 
-                        (*j)->GetBlackBoxToInput() );
+                        (*j)->GetOriginalBlackBoxToInput() );
        
+
        bbAddConnection(c);
 
        bbtkDebugDecTab("Kernel",9);
@@ -100,15 +101,15 @@ namespace bbtk
   ///  Destructor
   ComplexBlackBox::~ComplexBlackBox()
   {
-    bbtkDebugMessageInc("Kernel",9,
+    bbtkDebugMessageInc("Kernel",1,
                        "ComplexBlackBox::~ComplexBlackBox() ["
                        <<bbGetFullName()<<"]"<<std::endl);
     
-    bbtkDebugMessageInc("Kernel",9,"* Delete Connections"<<std::endl);
+    bbtkDebugMessageInc("Kernel",1,"* Delete Connections"<<std::endl);
     ConnectionListType::iterator j;
     for ( j = mConnectionList.begin(); j != mConnectionList.end(); ++j ) 
       {
-       bbtkDebugMessageInc("Kernel",9,"* Delete \""<<
+       bbtkDebugMessageInc("Kernel",1,"* Delete \""<<
                            (*j)->GetFullName()<<"\""<<std::endl);
        delete *j;
        bbtkDebugDecTab("Kernel",9);
@@ -116,21 +117,21 @@ namespace bbtk
     bbtkDebugDecTab("Kernel",9);
 
     
-    bbtkDebugMessageInc("Kernel",9,"* Delete Black Boxes"<<std::endl);
+    bbtkDebugMessageInc("Kernel",1,"* Delete Black Boxes"<<std::endl);
     BlackBoxMapType::iterator i;
     for ( i = mBlackBoxMap.begin(); i != mBlackBoxMap.end(); ++i ) 
       {
-       bbtkDebugMessageInc("Kernel",9,"* Delete \""<<i->first<<"\""<<std::endl);
+       bbtkDebugMessageInc("Kernel",1,"* Delete \""<<i->first<<"\""<<std::endl);
        i->second->bbDelete();
-       bbtkDebugDecTab("Kernel",9);
+       bbtkDebugDecTab("Kernel",1);
       }
-    bbtkDebugDecTab("Kernel",9);
-    //    bbtkDebugMessage("Kernel",9,"EO ComplexBlackBox::~ComplexBlackBox  ["
-    //              <<bbGetFullName()<<"]"<<std::endl);
-
+    bbtkDebugDecTab("Kernel",1);
+    
+    bbtkDebugMessage("Kernel",1,"EO ComplexBlackBox::~ComplexBlackBox  ["
+                    <<bbGetFullName()<<"]"<<std::endl);
     
     this->bbDesallocateConnectors();
-    bbtkDebugDecTab("Kernel",9);   
+    bbtkDebugDecTab("Kernel",1);   
   } 
   //=======================================================================
 
@@ -215,7 +216,8 @@ namespace bbtk
                        <<bbGetFullName()<<"]"<<std::endl);
     
     ComplexBlackBox* CBB = new ComplexBlackBox(*this,name);
-    
+    bbGetDescriptor()->Reference();           
+
     bbtkDebugDecTab("Kernel",9);   
 
     return CBB;
@@ -300,7 +302,8 @@ namespace bbtk
                        "ComplexBlackBox::bbBackwardUpdate("
                        <<(caller?caller->GetFullName():"0")<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
-
+    bbtkInternalError("ComplexBlackBox::bbBackwardUpdate should never be called !");
+    /*
     if (caller==0)
       {
        bbtkInternalError("ComplexBlackBox::bbBackwardUpdate called with caller=0");
@@ -336,10 +339,11 @@ namespace bbtk
        //      std::cout << "tmpout = "<<d->GetOutput()<<std::endl;
        //      caller->SetBlackBoxFromOutput(d->GetOutput());
        //
-       Connection newcaller(*caller);
-       newcaller.SetBlackBoxFromOutput(d->GetOutput());
-       IOStatus s1 = b->bbBackwardUpdate(&newcaller);
-       newcaller.Clear();
+       //Connection newcaller(*caller);
+       //newcaller.SetBlackBoxFromOutput(d->GetOutput());
+       //IOStatus s1 = b->bbBackwardUpdate(&newcaller);
+       IOStatus s1 = b->bbBackwardUpdate(caller);
+       //newcaller.Clear();
        // restore old output
        //      caller->SetBlackBoxFromOutput(oldout);
 
@@ -357,6 +361,8 @@ namespace bbtk
     bbSetExecuting(false);
 
     return s;
+    */
+    return UPTODATE;
   }
   //==================================================================
 
@@ -458,6 +464,57 @@ namespace bbtk
   }
   //==================================================================
 
+  //=========================================================================
+  /// Connects the input <name> to the connection c
+  void ComplexBlackBox::bbConnectInput( const std::string& name, Connection* c)
+  {
+    bbtkDebugMessageInc("Kernel",7,
+                       "ComplexBlackBox::bbConnectInput(\""
+                       <<name<<"\","<<c<<") ["
+                       <<bbGetFullName()<<"]"
+                       <<std::endl);       
+
+   ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*)
+      bbGetDescriptor()->GetInputDescriptor(name);
+
+   BlackBox* t = bbGetBlackBox(d->GetTarget());
+   c->SetBlackBoxTo(t);
+   c->SetBlackBoxToInput(d->GetInput());
+   t->bbConnectInput(d->GetInput(),c);
+
+   bbtkMessage("Debug",1,"ComplexBlackBox["<<bbGetFullName()<<"]::bbConnectInput : "
+              <<c->GetFullName()<<std::endl);
+
+    bbtkDebugDecTab("Kernel",7);
+  }
+  //=========================================================================
+
+
+  //=========================================================================  
+  /// Connects the output <name> to the connection c
+  void ComplexBlackBox::bbConnectOutput( const std::string& name, Connection* c)
+  {
+    bbtkDebugMessageInc("Kernel",7,
+                       "ComplexBlackBox::bbConnectOutput(\""
+                       <<name<<"\","<<c<<") ["
+                       <<bbGetFullName()<<"]"<<std::endl);       
+
+   ComplexBlackBoxOutputDescriptor* d = (ComplexBlackBoxOutputDescriptor*)
+      bbGetDescriptor()->GetOutputDescriptor(name);
+
+   BlackBox* t = bbGetBlackBox(d->GetTarget());
+   c->SetBlackBoxFrom(t);
+   c->SetBlackBoxFromOutput(d->GetOutput());
+   t->bbConnectOutput(d->GetOutput(),c);
+  
+   bbtkMessage("Debug",1,"ComplexBlackBox["<<bbGetFullName()<<"]::bbConnectOutput : "
+              <<c->GetFullName()<<std::endl);
+
+    bbtkDebugDecTab("Kernel",7);
+  }
+  //=========================================================================
+
+
   //==================================================================
   /// Adds the black box to the complex box
   void ComplexBlackBox::bbAddBlackBox( BlackBox* b)
@@ -977,4 +1034,28 @@ namespace bbtk
   }
   //=======================================================================
   */
+
+  //=======================================================================
+  void ComplexBlackBox::Check(bool recursive)
+  {
+     bbtkMessage("Debug",1,"**** Checking Complex Black Box "<<(void*)this
+                <<" ["<<bbGetFullName()<<"]"<<std::endl);
+     
+     BlackBoxMapType::const_iterator i;
+     for ( i = mBlackBoxMap.begin(); i != mBlackBoxMap.end(); ++i ) 
+       {
+        i->second->Check(recursive);
+       }
+     ConnectionListType::const_iterator j;
+     for ( j = mConnectionList.begin(); 
+          j != mConnectionList.end(); ++j ) 
+       {
+        (*j)->Check();
+       }
+     bbtkMessage("Debug",1,"**** Checking Complex Black Box "<<(void*)this
+                <<" ["<<bbGetFullName()<<"] ... OK"<<std::endl);
+  
+  }
+  //=======================================================================
+
 }
index ae8a82af7c09dd4fdc3c4fb5e07c4ef234fa39c8..6c041f4b117065eda8a9f2d9f105d3bdd145f517 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkComplexBlackBox.h,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  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
@@ -50,6 +50,8 @@ namespace bbtk
     // PUBLIC PART : ACCESSIBLE TO THE END-USER
     /// Returns the pointer on the box' descriptor
     BlackBoxDescriptor* bbGetDescriptor() const { return mDescriptor; }
+    /// Returns a pointer on a new instance with name <name>
+    //BlackBox* bbNew(const std::string& name);
     /// Returns a pointer on a clone of the box with name <name>
     BlackBox* bbClone(const std::string& name);
 
@@ -64,7 +66,10 @@ namespace bbtk
                                      void* data, 
                                      bool setModified = true);
 
-    ~ComplexBlackBox();
+     /// Connects the input <name> to the connection c
+    virtual void bbConnectInput( const std::string& name, Connection* c);
+    /// Connects the output <name> to the connection c
+    virtual void bbConnectOutput( const std::string& name, Connection* c);
 
     BlackBox* bbGetBlackBox( const std::string& name );
 
@@ -105,6 +110,7 @@ namespace bbtk
     virtual BlackBox *bbFindBlackBox(const std::string &blackboxname);
     
 
+    void Check(bool recursive=true);
 
   protected:
     //==================================================================
@@ -113,6 +119,8 @@ namespace bbtk
     ComplexBlackBox(const std::string &name, ComplexBlackBoxDescriptor* desc);
     /// Constructor from an existing box (copy) with a new name 
     ComplexBlackBox(ComplexBlackBox& from, const std::string &name);
+    // 
+   ~ComplexBlackBox();
 
     
   public:
index e421055a8e2c5c65f136566801765cacbe528f6c..679557533a763c58d095c50de67622675c931cf8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkComplexBlackBoxDescriptor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:30 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  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
@@ -40,6 +40,7 @@ namespace bbtk
     SetTypeName(name);
     AddToCategory("complex box");
     mPrototype = new ComplexBlackBox(name+std::string("Prototype"),this);
+    // this->Reference();
     bbtkDebugDecTab("Kernel",9);
   }
   //=======================================================================
@@ -50,14 +51,22 @@ namespace bbtk
   /// Default dtor
   ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor()
   {
-    bbtkDebugMessageInc("Kernel",9,"ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""<<GetTypeName()<<"\")"<<std::endl);
+    bbtkDebugMessageInc("Kernel",1,"ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""<<GetTypeName()<<"\")"<<std::endl);
 
     delete mPrototype;
 
-    bbtkDebugDecTab("Kernel",9);
+    bbtkDebugMessage("Kernel",1,"EO ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""<<GetTypeName()<<"\")"<<std::endl);
+   bbtkDebugDecTab("Kernel",1);
   }
   //=======================================================================
 
+  //=========================================================================
+  /// Check
+  void ComplexBlackBoxDescriptor::Check(bool recursive) const
+  {
+    mPrototype->Check(recursive);
+  }
+  //=========================================================================
 
   //=======================================================================
   /// Creates an instance of name <name> of the ComplexBlackBox of which this is the descriptor 
@@ -466,12 +475,15 @@ namespace bbtk
     InputDescriptorMapType::const_iterator i;
     unsigned int namelmax = 0;
     unsigned int typelmax = 0;
+    unsigned int natlmax = 0;
     for ( i = mInput.begin();  i != mInput.end(); ++i ) 
     {
           if (i->second->GetName().size()>namelmax) 
             namelmax = i->second->GetName().size();
           if (i->second->GetTypeName().size()>typelmax) 
             typelmax = i->second->GetTypeName().size();
+          if (i->second->GetNature().size()>natlmax) 
+            natlmax = i->second->GetNature().size();
     }
     OutputDescriptorMapType::const_iterator o;
     if (full) 
@@ -482,6 +494,8 @@ namespace bbtk
               namelmax = o->second->GetName().size();
            if (o->second->GetTypeName().size()>typelmax) 
               typelmax = o->second->GetTypeName().size();
+          if (o->second->GetNature().size()>natlmax) 
+            natlmax = o->second->GetNature().size();
           }
     }
     //
@@ -494,10 +508,14 @@ namespace bbtk
           std::string type(i->second->GetTypeName());
           type += ">";
           type.append(1+typelmax-type.size(),' ');
+          std::string nature(i->second->GetNature());
+          nature += "]";
+          nature.append(1+natlmax-nature.size(),' ');
           bbtkMessage("Help",1,
-                   "    '"<<name
-                   <<" <"<<type
-                   <<" : "<<i->second->GetDescription()<<std::endl);
+                      "    '"<<name
+                      <<" <"<<type
+                      <<" ["<<nature
+                      <<" : "<<i->second->GetDescription()<<std::endl);
     }
     if (full) 
     {
@@ -513,9 +531,13 @@ namespace bbtk
             std::string type(o->second->GetTypeName());
             type += ">";
             type.append(1+typelmax-type.size(),' ');
+            std::string nature(o->second->GetNature());
+            nature += "]";
+            nature.append(1+natlmax-nature.size(),' ');
             bbtkMessage("Help",1,
-                        "    '"<<name
+                      "    '"<<name
                         <<" <"<<type
+                        <<" ["<<nature
                         <<" : "<<o->second->GetDescription()<<std::endl);
           }
     }
index 4b76df5cef0d371f21b7806cc7f8433849246262..a3c2d70ea854736a40a633ec09fa6fce198a859c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkComplexBlackBoxDescriptor.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:30 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -46,9 +46,10 @@ namespace bbtk
     friend class ComplexBlackBox;
     /// Default ctor with name 
     ComplexBlackBoxDescriptor(const std::string& name); 
-    /// Default dtor
+  protected:
+   /// Default dtor
     ~ComplexBlackBoxDescriptor();
-
+  public:
     /// Sets the factory used 
     void SetFactory(Factory* f) { mFactory = f; }
     /// Gets the factory used
@@ -121,6 +122,8 @@ namespace bbtk
                          bool relative_link = false );
     
 
+   ///
+    virtual void Check(bool recursive=true) const;
 
   private:
     /// Default ctor is private (must have name and factory)
index 2c99b6e2518a8a274b59357c1bfa45eadc2f6c54..29bab6cc40a63308c6c3fca425e676403cd1ce3a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConnection.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:30 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -44,10 +44,10 @@ namespace bbtk
                        <<to->bbGetName()<<"\",\""<<input<<"\")"
                        <<std::endl);    
 
-    mFrom = from;
-    mTo = to;
-    mInput = input;
-    mOutput = output;
+    mFrom = mOriginalFrom = from;
+    mTo = mOriginalTo = to;
+    mInput = mOriginalInput = input;
+    mOutput = mOriginalOutput = output;
     
 
     if (! from->bbHasOutput(output) )
@@ -124,8 +124,8 @@ namespace bbtk
   
   void Connection::Clear()
   {
-    mFrom = 0;
-    mTo = 0;
+    mFrom = mOriginalFrom = 0;
+    mTo = mOriginalTo = 0;
     mAdaptor = 0;
   }
 
@@ -136,10 +136,11 @@ namespace bbtk
     bbtkDebugMessageInc("Kernel",7,
                        "Connection::~Connection() ["
                        <<GetFullName()<<"]"<<std::endl);
+    std::cout << "~Connection() " << GetFullName() << std::endl;
 
-    if (mFrom) mFrom->bbDisconnectOutput(mOutput,this);
-    if (mTo) mTo->bbDisconnectInput(mInput,this);
-    if (mAdaptor) mAdaptor->bbDelete();
+    if (mFrom!=0) mFrom->bbDisconnectOutput(mOutput,this);
+    if (mTo!=0) mTo->bbDisconnectInput(mInput,this);
+    if (mAdaptor!=0) mAdaptor->bbDelete();
 
     bbtkDebugDecTab("Kernel",7);
   }
@@ -320,14 +321,108 @@ namespace bbtk
   
   //==================================================================
   std::string Connection::GetFullName() const {
-    if (mFrom && mTo)
-      return  mFrom->bbGetName()+"."+mOutput+"--"
-       +mTo->bbGetName()+"."+mInput;
+    if (mFrom && mTo) 
+      {
+       std::string res = mFrom->bbGetName()+"."+mOutput+"--"
+         +mTo->bbGetName()+"."+mInput;
+       if ((mFrom!=mOriginalFrom)||(mTo!=mOriginalTo))
+         {
+           res += "("+mOriginalFrom->bbGetName()+"."+mOriginalOutput+"--"
+             + mOriginalTo->bbGetName()+"."+mOriginalInput+")";
+         }
+       return res;
+      }
     return "***Invalid Connection***";
   }
   //==================================================================
 
+  //==================================================================
+  void Connection::Check() const
+  {
+    bbtkMessage("Debug",1,"** Checking Connection "<<(void*)this<<" ["<<GetFullName()<<"]"
+               <<std::endl);
+    if (mFrom==0) 
+      {
+       bbtkMessage("Debug",2," - From = 0"<<std::endl);
+      }
+    else
+      {
+       bbtkMessage("Debug",2," - From : "<<mFrom->bbGetFullName()<<std::endl);
+       if (!mFrom->bbHasOutput(mOutput))
+         {
+           bbtkError(mFrom->bbGetFullName()<<" does not have output '"
+                     <<mOutput<<"'");
+         }     
+       bbtkMessage("Debug",2," - From : Output '"<<mOutput<<"' exists"<<std::endl);
+       BlackBox::OutputConnectorMapType::const_iterator i 
+         = mFrom->bbGetOutputConnectorMap().find(mOutput);
+       if (i== mFrom->bbGetOutputConnectorMap().end())
+         {
+            bbtkError(mFrom->bbGetFullName()<<" output '"
+                      <<mOutput<<"' is not in OutputConnectorMap");
+         }
+       bbtkMessage("Debug",2," - From : Output '"<<mOutput
+                   <<"' is in OutputConnectorMap"<<std::endl);
+
+        std::vector< Connection * >::const_iterator j;
+       j = find(i->second->GetConnectionVector().begin(),
+                i->second->GetConnectionVector().end(),
+                this);
+       if (j==i->second->GetConnectionVector().end())
+         {
+           bbtkError("Connection ["<<GetFullName()<<"] : "
+                     <<" OutputConnector '"
+                     <<mOutput<<"' of "<<mFrom->bbGetFullName()
+                     <<" 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);
 
+      }
+
+    if (mTo==0) 
+      {
+       bbtkMessage("Debug",2," - To   = 0"<<std::endl);
+      }
+    else
+      {
+       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);
+       if (!mTo->bbHasInput(mInput))
+         {
+           bbtkError(mTo->bbGetFullName()<<" does not have input '"
+                     <<mInput<<"'");
+         }     
+       bbtkMessage("Debug",2," - To   : Input '"<<mInput<<"' exists"<<std::endl);
+       BlackBox::InputConnectorMapType::const_iterator i 
+         = mTo->bbGetInputConnectorMap().find(mInput);
+       if (i== mTo->bbGetInputConnectorMap().end())
+         {
+            bbtkError(mTo->bbGetFullName()<<" input '"
+                      <<mInput<<"' is not in InputConnectorMap");
+         }
+       bbtkMessage("Debug",2," - To   : Input '"<<mInput
+                   <<"' is in InputConnectorMap"<<std::endl);
+
+       if (i->second->GetConnection()==0)
+         {
+           bbtkError("Connection "<<GetFullName()<<" : "
+                     <<" InputConnector '"
+                     <<mInput<<"' of "<<mTo->bbGetFullName()
+                     <<" 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);
+
+      }
+  }
+  //==================================================================
 
 }// namespace bbtk
 
index 47c8e92a0da593a0e1d9eab6ccb190f7ae642456..f69695f112cb749bb4725909af89a3b75e5fdd77 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConnection.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:30 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -75,6 +75,15 @@ namespace bbtk
     virtual void SetModifiedStatus();
     std::string GetFullName() const; 
 
+    /// Returns the original initial black box of the connection
+    BlackBox* GetOriginalBlackBoxFrom() const { return mOriginalFrom; }
+    /// Returns the origianl final black box of the connection
+    BlackBox* GetOriginalBlackBoxTo() const { return mOriginalTo; }
+    /// Returns the original output of the initial black box of the connection
+    const std::string& GetOriginalBlackBoxFromOutput() const { return mOriginalOutput; }
+    /// Returns the original input of the final black box of the connection
+    const std::string& GetOriginalBlackBoxToInput() const { return mOriginalInput; }
+
     /// Returns the initial black box of the connection
     BlackBox* GetBlackBoxFrom() const { return mFrom; }
     /// Returns the final black box of the connection
@@ -84,19 +93,33 @@ namespace bbtk
     /// Returns the input of the final black box of the connection
     const std::string& GetBlackBoxToInput() const { return mInput; }
 
+    /// Sets the initial black box of the connection
+    void SetBlackBoxFrom(BlackBox* b) { mFrom = b; }
+    /// Sets the final black box of the connection
+    void SetBlackBoxTo(BlackBox* b) { mTo = b; }
     /// Sets the output of the initial black box of the connection
     void SetBlackBoxFromOutput(const std::string& o) { mOutput = o; }
+    /// Sets the input of the final black box of the connection
+    void SetBlackBoxToInput(const std::string& o) { mInput = o; }
+
+    /// Checks that the connection is ok (throws error if not)
+    void Check() const;
+    
   protected:
     /// Black box origin of the connection
     BlackBox* mFrom;
+    BlackBox* mOriginalFrom;
     /// Output of mFrom which is connected
     std::string mOutput;
+    std::string mOriginalOutput;
     /// Output connector of mFrom which is connected
     //  BlackBoxOutputConnector* mOutputConnector;
     /// Black box destination of the connection
     BlackBox* mTo;
+    BlackBox* mOriginalTo;
     /// Input of mTo which is connected
     std::string mInput;
+    std::string mOriginalInput;
     /// Input connector of mTo which is connected
     //  BlackBoxInputConnector* mInputConnector;
     /// Adaptor black box if needed
index 3c7b04cf704b7f803921ee9dcfc8be9e693718b0..cbb82eb059299bc981eba938cc0553101d42fb3a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkExecuter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:30 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  Version:   $Revision: 1.17 $
 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -60,7 +60,7 @@ namespace bbtk
      if (mRootCBB) 
      {
         mRootPackage->UnRegisterBlackBox("workspace");
-        delete mRootCBB;
+        mRootCBB->UnReference();
      }
      if (mRootPackage)
      {
@@ -93,6 +93,8 @@ namespace bbtk
   {
     bbtkDebugMessageInc("Kernel",9,"Executer::Reset()" <<std::endl);
 
+    GetFactory()->CheckPackages();
+
     // The 'user' package must be closed before all other 
     // because box destructors must not be unloaded when bb are deleted!
     // Similarly, the 'workspace' CBB must be destroyed before 
@@ -101,8 +103,8 @@ namespace bbtk
     // access a user CBB descriptor which has been previously freed
     if (mRootCBB)
     {
-       mRootPackage->UnRegisterBlackBox(mRootCBB->GetTypeName());
-       delete mRootCBB;
+      mRootPackage->UnRegisterBlackBox(mRootCBB->GetTypeName());
+      mRootCBB->UnReference();
     }
     if (mRootPackage)
     {
@@ -117,6 +119,7 @@ namespace bbtk
                            BBTK_STRINGIFY_SYMBOL(BBTK_VERSION));
     // Create user workspace
     mRootCBB = new ComplexBlackBoxDescriptor("workspace"); //,f);
+    mRootCBB->Reference();
     mRootCBB->SetFactory(GetFactory());
     mRootCBB->AddToAuthor("bbi (internal)");
     mRootCBB->AddToDescription("User's workspace");
@@ -128,6 +131,9 @@ namespace bbtk
     // And in the list of open packages
     mOpenPackage.push_back(mRootPackage);
 
+
+    GetFactory()->CheckPackages();
+
     bbtkDebugDecTab("Kernel",9);
   }
   //=======================================================================
index 036231f9e94cc77f90ecf8683e795c94cb7672d2..82bf038f842dfe7ae2c1ed2eec16dd1cc9d94982 100644 (file)
@@ -4,8 +4,8 @@ Program:   bbtk
 Module:    $RCSfile: bbtkFactory.cxx,v $
 Language:  C++
 
-Date:      $Date: 2008/04/08 06:59:30 $
-Version:   $Revision: 1.31 $
+Date:      $Date: 2008/04/09 11:16:57 $
+Version:   $Revision: 1.32 $
                                                                                 
 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
@@ -748,7 +748,7 @@ namespace bbtk
                                  const DataInfo& typeout,
                                  std::string& adaptor) const
   {
-    bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
+    bbtkDebugMessageInc("Kernel",8,"Factory::FindAdaptor(<"
                         <<typein<<">,<"
                         <<typeout<<">)"<<bbtkendl);
     
@@ -793,14 +793,76 @@ namespace bbtk
                                                  adaptor);
        if (b) break; 
       }
-    /*
+    bbtkDebugDecTab("Kernel",7);
+    return b; 
+  }
+  //===================================================================
+
+  //===================================================================
+  /// Creates an instance of a black box of type <type> with name <name>
+  bool Factory::FindWidgetAdaptor2(const DataInfo& typein,
+                                 const DataInfo& typeout,
+                                 std::string& widget,
+                                 std::string& adaptor) const
+  {
+    bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
+                        <<typein<<">,<"
+                        <<typeout<<">)"<<bbtkendl);
+    
+    bool b = false;
+    adaptor = widget = "";
+    PackageMapType::const_iterator i;
+    for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+      {
+       b = i->second.mPackage->FindWidgetAdaptor(typein,
+                                                 typeout,
+                                                 widget);
+       if (b) break; 
+      }
     if (!b) 
       {
-       bbtkError("no "<<typein<<" to "<<typeout
-                 <<"> widget adaptor available");
-      } 
-    */
-
+       // Look for a widget adaptor with good nature out
+       bbtkMessage("Kernel",5,
+                   "*** Looking for a two pieces widget adaptor for : "
+                   << typein << "->"<<typeout<<std::endl);
+       for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+         {
+           Package::AdaptorMapType::const_iterator j;
+           for (j=i->second.mPackage->GetAdaptorMap().begin();
+                j!=i->second.mPackage->GetAdaptorMap().end();
+                ++j)
+             {
+               if ( ( j->first.mKind ==  
+                      BlackBoxDescriptor::DEFAULT_WIDGET_ADAPTOR) &&
+                    //(j->first.mTypeIn == typein) &&
+                    (j->first.mTypeOut.GetNature() == typeout.GetNature() ) 
+                    )
+                 {
+                   widget = j->second->GetTypeName();
+                   bbtkMessage("Kernel",5,
+                               "===> Found first part : "<<widget
+                               << " "<<j->first.mTypeIn<<"->"
+                               <<j->first.mTypeOut<<std::endl);
+                   DataInfo ti( j->first.mTypeOut.GetType(), "");
+                   DataInfo to( typeout.GetType(), "");
+                   b = FindAdaptor( ti, to, adaptor );
+                   if (b) 
+                     {
+                       bbtkMessage("Kernel",5,
+                                   "===> Found second part : "<<adaptor
+                                   <<std::endl);
+                       break;
+                     }
+                   else
+                     {
+                       bbtkMessage("Kernel",5,
+                                   "===> No second part found"<<std::endl);
+                     }
+                 }
+             }
+           if (b) break;
+         }
+      }
     bbtkDebugDecTab("Kernel",7);
     return b; 
   }
@@ -868,6 +930,21 @@ namespace bbtk
   }
   //===================================================================
 
+  //===================================================================
+  void Factory::CheckPackages() const
+  {
+    bbtkMessage("Debug",1,"****** Checking Factory "<<(void*)this
+                <<std::endl);
+    PackageMapType::const_iterator i;
+    for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+      {
+       i->second.mPackage->CheckBoxes();
+      }
+    bbtkMessage("Debug",1,"****** Checking Factory "<<(void*)this
+               <<" ... OK"<<std::endl);
+  }
+  //===================================================================
+
   //===================================================================
   void Factory::WriteDotFilePackagesList(FILE *ff)
   {
index 34e435d3082c8e30b12d146686cce34f573bda70..73b23c45db71efcde3bab8af1e421aaad695649d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkFactory.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:30 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  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
@@ -79,6 +79,11 @@ namespace bbtk
                           const DataInfo& typeout,
                           std::string& adaptor) const;
     
+    bool FindWidgetAdaptor2(const DataInfo& typein,
+                           const DataInfo& typeout,
+                           std::string& widget,
+                           std::string& adaptor) const;
+
     Connection* NewConnection(BlackBox* from,
                               const std::string& output,
                               BlackBox* to,
@@ -88,6 +93,8 @@ namespace bbtk
 
     void Reset();
     
+    void CheckPackages() const;
+
     typedef enum
       {
        Packages,
index c925050a17fd99e20bf257351e8fcd94a2d11f9f..febbd934840929bd6dc0002b8ca00ab0d83bd772 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:30 $
-  Version:   $Revision: 1.58 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  Version:   $Revision: 1.59 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -615,7 +615,7 @@ printf("EED Interpreter::InterpretLine %s \n", line.c_str() );
 void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
 {
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretLine(\""<<line<<"\")"<<std::endl);
-    bbtkMessage("Echo",2,"\""<<line<<"\""<<std::endl);
+    bbtkMessage("Echo",2,line<<std::endl);
 
     std::vector<std::string> words;
     SplitLine(line,words);
@@ -800,6 +800,7 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
 
       case cReset :  
         this->mExecuter->Reset();
+       mFileNameHistory.clear();
         break;
 
       case cInclude :
@@ -1240,23 +1241,13 @@ void Interpreter::SwitchToStream( std::stringstream* stream )
   void Interpreter::LoadScript( std::string fullPathScriptName,
                                std::string includeScriptName)
   {
-     Utilities::replace( fullPathScriptName , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
-
-     bool okScriptExist=false;
-     int iStrScript,sizeVecStricpt=mFileName.size();
-     for ( iStrScript=0;iStrScript<sizeVecStricpt;iStrScript++)
-     {
-        if (mFileName[iStrScript] == fullPathScriptName )
-        {
-           okScriptExist=true;
-        } // if
-     } // for
-
-     if (find(mFileName.begin(),mFileName.end(),fullPathScriptName)!=mFileName.end())
-//    if (okScriptExist==true)
+     Utilities::replace( fullPathScriptName , 
+                        INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
+   
+     if (find(mFileNameHistory.begin(),
+             mFileNameHistory.end(),
+             fullPathScriptName)!=mFileNameHistory.end())
      {
-           bbtkMessage("Interpreter",1,"file '"<<fullPathScriptName
-                   <<"' already open : I do not open it once more to prevent recursive inclusion"<<std::endl);
         return;
      }
 
@@ -1274,6 +1265,7 @@ void Interpreter::SwitchToStream( std::stringstream* stream )
 
     mFile.push_back(s);
     mFileName.push_back(fullPathScriptName);
+    mFileNameHistory.push_back(fullPathScriptName);
     mIncludeFileName.push_back(includeScriptName);
     mLine.push_back(0);
 
@@ -1326,16 +1318,6 @@ void Interpreter::SwitchToStream( std::stringstream* stream )
     while (mFile.size() != 0) 
     {
        CloseCurrentFile();
-    /*
-      mFile.back()->close();
-      delete mFile.back();
-      mFile.pop_back();
-      bbtkDebugMessage("Interpreter",9,
-                      " Closing file '"<<mFileName.back()<<"'"<<std::endl);
-      mFileName.pop_back();
-      mIncludeFileName.pop_back();
-      mLine.pop_back();
-*/
     }
     bbtkDebugMessage("Interpreter",9,"EO Interpreter::CloseAllFiles()"
                       <<std::endl);
@@ -1925,26 +1907,51 @@ void  Interpreter::NewGUI(const std::string& boxname,
       if ( ( d->GetCreatorTypeInfo() == typeid(AtomicBlackBoxDescriptor)) ||
           ( d->GetCreatorTypeInfo() == typeid(WxBlackBoxDescriptor)) )
        continue;
+      bool widok = true;
+      std::string widget,adaptor;
       // try to find a widget adaptor
-      std::string adaptor;
-      if (F->FindWidgetAdaptor(DataInfo(typeid(Void),""),
+      if (F->FindWidgetAdaptor(DataInfo(d->GetTypeInfo(),""),
                               d->GetDataInfo(),
                               adaptor))
        {
-         // store the input name
-         in.push_back(i->first);
          // command to create the adaptor
          (*s) << "  new "<<adaptor<<" "<<i->first<<std::endl;
-         // command to create the output
-         (*s) << "  output "<<i->first<<" "
-              <<i->first<<".Out "<<i->first<<std::endl;
-           //         <<" Output of the widget which allows to set "
-           //<i->first<<"'"<<std::endl;
          // Sets the label of the widget adaptor to the name of the input
          (*s) << "  set "<<i->first<<".Label "<<i->first<<std::endl;
+         // Sets the initial value of the widget to the value of the input
+         (*s) << "  set "<<i->first<<".In \""
+              <<box->bbGetInputAsString(i->first)<<"\""
+              << std::endl;
+         // store the input name
+         in.push_back(i->first);
          (*s) << "  connect "<<i->first<<".Widget layout.Widget"<<in.size()<<std::endl;
+           //<i->first<<"'"<<std::endl;
          (*s) << "  connect "<<i->first<<".BoxChange change.In"<<in.size()<<std::endl;
        }
+      // try to find a two pieces adaptor
+      else if (F->FindWidgetAdaptor2(DataInfo(d->GetTypeInfo(),""),
+                                    d->GetDataInfo(),
+                                    widget,adaptor) )
+       {
+         // command to create the widget
+         (*s) << "  new "<<widget<<" "<<i->first<<"Widget"<<std::endl;
+         // command to create the adaptor
+         (*s) << "  new "<<adaptor<<" "<<i->first<<std::endl;
+         // connect the two
+         (*s) << "  connect "<<i->first<<"Widget.Out "
+              <<i->first<<".In"<<std::endl;
+         // Sets the label of the widget adaptor to the name of the input
+         (*s) << "  set "<<i->first<<"Widget.Label "<<i->first<<std::endl;
+         // Sets the initial value of the widget to the value of the input
+         (*s) << "  set "<<i->first<<"Widget.In \""
+              <<box->bbGetInputAsString(i->first)<<"\""<< std::endl;
+         // store the input name
+         in.push_back(i->first);
+         (*s) << "  connect "<<i->first<<"Widget.Widget layout.Widget"<<in.size()<<std::endl;
+           //<i->first<<"'"<<std::endl;
+         (*s) << "  connect "<<i->first<<"Widget.BoxChange change.In"<<in.size()<<std::endl;
+
+       }
       // try to find an adaptor from string 
       // If found then can create a text input which 
       // will be automatically adapted 
@@ -1952,21 +1959,32 @@ void  Interpreter::NewGUI(const std::string& boxname,
                               d->GetDataInfo(),
                               adaptor))
        {
-         // store the input name
-         in.push_back(i->first);
          // command to create the adaptor
          (*s) << "  new InputText "<<i->first<<std::endl;
-         // command to create the output
-         (*s) << "  output "<<i->first<<" "
-              <<i->first<<".Out "<<i->first<<std::endl;
-           //         <<" Output of the widget which allows to set "
-           //<i->first<<"'"<<std::endl;
          // Sets the label of the widget adaptor to the name of the input
          (*s) << "  set "<<i->first<<".Title "<<i->first<<std::endl;
+         // Sets the initial value of the widget to the value of the input
+         (*s) << "  set "<<i->first<<".In \""
+              <<box->bbGetInputAsString(i->first)<<"\""<< std::endl;
+         // store the input name
+         in.push_back(i->first);
          (*s) << "  connect "<<i->first<<".Widget layout.Widget"<<in.size()<<std::endl;
+           //<i->first<<"'"<<std::endl;
          (*s) << "  connect "<<i->first<<".BoxChange change.In"<<in.size()<<std::endl;
-       }
 
+       }
+      else 
+       {
+         widok = false;
+       }
+      if (widok)
+       {
+         // command to create the output
+         (*s) << "  output "<<i->first<<" "
+              <<i->first<<".Out "<<i->first<<std::endl;
+           //         <<" Output of the widget which allows to set "
+         
+       }
     }   
   // Inputs for window properties
   (*s) << "  input WinTitle layout.WinTitle Title"<<std::endl;
index bf40302851bed3b2edff02f1ba21a41749dd7f18..48bd0ae2c22cd492ce927a5faf544a458cbb2807 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.h,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:30 $
-  Version:   $Revision: 1.24 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  Version:   $Revision: 1.25 $
 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -284,6 +284,11 @@ namespace bbtk
     /// Vector of names of open files with full path (as open)
     std::vector<std::string> mFileName;
 
+    /// Vector of names of files which have been open 
+    /// before (and may closed then which are no more in mFileName)
+    /// with full path (as open)
+    std::vector<std::string> mFileNameHistory;
+
     /// Vector of names of open files as given to the include command
     std::vector<std::string> mIncludeFileName;
 
index c50abbd2c82d6f58699bbf5ff4767dd55288d607..b24272152df64d0fa61b3a7d90c45efe5289823e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkPackage.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:30 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  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
@@ -78,7 +78,7 @@ namespace bbtk
          i!=mBlackBoxMap.end();
        ++i) 
      {
-        delete i->second;
+       i->second->UnReference();
      } 
     // Adaptors are also stored in the black box map : hence already deleted
     /*
@@ -174,6 +174,8 @@ namespace bbtk
   }
   //==========================================================================
 
+
+
   //==========================================================================
   /// Returns true is the package contains 
   /// an adaptor of input type <typein> and 
@@ -187,9 +189,10 @@ namespace bbtk
                        ">::FindWidgetAdaptor("
                        <<typein<<","
                        <<typeout<<")"<<bbtkendl);
-    
+   
     AdaptorKey key(typein,typeout,
                   BlackBoxDescriptor::DEFAULT_WIDGET_ADAPTOR);
+    // First try to find a single widget adaptor
     AdaptorMapType::const_iterator i = mAdaptorMap.find(key);
     if (i == mAdaptorMap.end())  
       {
@@ -241,7 +244,16 @@ namespace bbtk
   {
     bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::RegisterBlackBox(\""<<d->GetTypeName()<<"\")"<<std::endl);
     
+    BlackBoxMapType::iterator i = mBlackBoxMap.find(d->GetTypeName());
+    if (i!=mBlackBoxMap.end())
+      {
+       bbtkWarning("Package<"<<GetName()<<"> : Trying to register box type <"
+                   <<d->GetTypeName()<<"> which is already in the package");
+       return false;
+      }
+
     mBlackBoxMap[d->GetTypeName()] = d;
+    d->Reference();
     d->SetPackage(this);
     
     // If it is a default adaptor, also register it in the adaptors map
@@ -253,7 +265,7 @@ namespace bbtk
        TypeInfo typeout = d->GetOutputDescriptor("Out")->GetTypeInfo();
        DataInfo infoin(typein,d->GetInputDescriptor("In")->GetNature());
        DataInfo infoout(typeout,d->GetOutputDescriptor("Out")->GetNature());
-       bbtkDebugMessage("Kernel",8,"LG Adaptor "<<infoin<<" to "<<infoout 
+       bbtkDebugMessage("Kernel",9,"Adaptor "<<infoin<<" to "<<infoout 
                         <<" - kind="<<d->GetKind()<<std::endl);  
 
        AdaptorKey key(infoin,infoout,d->GetKind());
@@ -266,11 +278,14 @@ namespace bbtk
        // If already an adaptor registered : error
        else 
          {
-           bbtkError("Package <"<<GetName()<<
-                     "> : trying to register black box <"
-                     <<d->GetTypeName()
-                     <<"> as default adaptor but there is already a default adaptor registered (<"
-                     <<i->second->GetTypeName()<<">)");
+           if (i->second->GetTypeName() != d->GetTypeName()) 
+             {
+               bbtkError("Package <"<<GetName()<<
+                         "> : trying to register black box <"
+                         <<d->GetTypeName()
+                         <<"> as default adaptor but there is already a default adaptor registered (<"
+                         <<i->second->GetTypeName()<<">)");
+             }
          }
       }
     
@@ -280,6 +295,22 @@ namespace bbtk
   }
   //==========================================================================
   
+  //===================================================================
+  void Package::CheckBoxes() const
+  {
+    bbtkMessage("Debug",1,"****** Checking Package "<<(void*)this
+               <<" ["<<GetName()<<"]"<<std::endl);
+    BlackBoxMapType::const_iterator i;
+    for (i=mBlackBoxMap.begin();
+        i!=mBlackBoxMap.end();
+        ++i) 
+      {
+       i->second->Check(true);
+      }
+    bbtkMessage("Debug",1,"****** Checking Package "<<(void*)this
+               <<" ["<<GetName()<<"] ... OK"<<std::endl);
+  }
+  //===================================================================
 
   //==========================================================================
   /// UnRegisters a black box descriptor from the package
@@ -294,6 +325,7 @@ namespace bbtk
        bbtkError("UnRegister : The package <"<<GetName()<<"> does not contains the black box <"<<name<<">");
      }
     mBlackBoxMap.erase(i);
+
     // Is it also in the adaptors map ?
     /*
     AdaptorMapType::iterator j = mAdaptorMap.find(name);
@@ -302,6 +334,9 @@ namespace bbtk
          mAdaptorMap.erase(j);
       }
     */    
+
+    i->second->UnReference();
+
     bbtkDebugDecTab("Kernel",8);    
   }
   //==========================================================================
index f869bcc021a8205f8aa6ccbc8e79b3d2fb26d992..4c0b70534cf890d37f22f4f0a43c7b73bcfc3372 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkPackage.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/08 06:59:30 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/04/09 11:16:57 $
+  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
@@ -115,6 +115,41 @@ namespace bbtk
     const BlackBoxMapType& GetBlackBoxMap() const { return mBlackBoxMap; }
     BlackBoxMapType& GetBlackBoxMap() { return mBlackBoxMap; }
 
+    /// The type of key in the map of adaptor descriptors
+    class AdaptorKey 
+    {
+    public:
+      AdaptorKey( const DataInfo& typein, const DataInfo& typeout, 
+                 BlackBoxDescriptor::Kind kind ) 
+       : mTypeIn(typein), mTypeOut(typeout), mKind(kind) {}
+      
+      bool operator< ( const AdaptorKey& k ) const
+      {
+       return ( ( mKind < k.mKind ) ||
+                ( ( mKind == k.mKind ) &&
+                  ( ( mTypeIn < k.mTypeIn ) ||
+                    ( ( mTypeIn == k.mTypeIn ) && 
+                      ( mTypeOut < k.mTypeOut ) ) ) ) );
+      }
+      
+      bool operator== ( const AdaptorKey& k ) const
+      {
+       return ( ( mKind == k.mKind ) && 
+                ( mTypeIn == k.mTypeIn ) && 
+                ( mTypeOut == k.mTypeOut ) );
+      }
+      DataInfo mTypeIn;
+      DataInfo mTypeOut; 
+      BlackBoxDescriptor::Kind mKind;
+    };
+    
+    /// The type of map of adaptor descriptors
+    typedef std::map< AdaptorKey, BlackBoxDescriptor*> AdaptorMapType;
+
+   const AdaptorMapType& GetAdaptorMap() const { return mAdaptorMap; }
+
+
     // Factories management
     /// Adds the factory to the set of factories which use the package
     void AddFactory(Factory* f) { mFactorySet.insert(f); }
@@ -126,6 +161,8 @@ namespace bbtk
     /// Gets the set of factories which use the package (const)
     const std::set<Factory*>& GetFactorySet() const { return mFactorySet; }
     
+    void CheckBoxes() const;
+
   private:
 
     /// The name of the package
@@ -146,36 +183,14 @@ namespace bbtk
     /// (path relative to bbtk doc root)
     std::string mDocRelativeURL;
 
-
     /// The map of black boxes descriptors
     BlackBoxMapType mBlackBoxMap;
 
-    /// The type of key in the map of adaptor descriptors
-    class AdaptorKey 
-    {
-    public:
-      AdaptorKey( const DataInfo& typein, const DataInfo& typeout, 
-                 BlackBoxDescriptor::Kind kind ) 
-       : mTypeIn(typein), mTypeOut(typeout), mKind(kind) {}
-      
-      bool operator< ( const AdaptorKey& k ) const
-      {
-       return ( ( mKind < k.mKind ) ||
-                ( ( mKind == k.mKind ) &&
-                  ( ( mTypeIn < k.mTypeIn ) ||
-                    ( ( mTypeIn == k.mTypeIn ) && 
-                      ( mTypeOut < k.mTypeOut ) ) ) ) );
-      }
-      
-    private:
-      DataInfo mTypeIn;
-      DataInfo mTypeOut; 
-      BlackBoxDescriptor::Kind mKind;
-    };
-    
-    /// The type of map of adaptor descriptors
-    typedef std::map< AdaptorKey, BlackBoxDescriptor*> AdaptorMapType;
 
+  public:
+
+
+  private:
     /// The map of adaptors descriptors
     AdaptorMapType mAdaptorMap;
 
index d00e4de6fdfa441b44993658500e1373ea3b468d..d7349e8ec230dddd69a754e0d9669bf9261dff54 100644 (file)
@@ -3,8 +3,8 @@
 Program:   bbtk
 Module:    $RCSfile: bbtkWxGUIPackageBrowser2.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/08 06:59:30 $
-Version:   $Revision: 1.3 $
+Date:      $Date: 2008/04/09 11:16:57 $
+Version:   $Revision: 1.4 $
                                                                                 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
 l'Image). All rights reserved. See Doc/License.txt or
@@ -722,7 +722,7 @@ namespace bbtk
     wxListItem kNewItem;
     kNewItem.SetAlign(wxLIST_FORMAT_LEFT);
     int nID = l->GetItemCount();
-    std::cout << nID << std::endl;
+    //    std::cout << nID << std::endl;
     kNewItem.SetId(nID);
     //    kNewItem.SetMask(wxLIST_MASK_DATA);
     //    kNewItem.SetData(d);  
@@ -790,7 +790,7 @@ namespace bbtk
                  .MinimizeButton(true)
                  .MaximizeButton(true)
                  .Bottom()
-                 .MinSize(wxSize(100,100))
+                 .MinSize(wxSize(100,300))
                  );