]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Fri, 25 Jul 2008 07:44:12 +0000 (07:44 +0000)
committerguigues <guigues>
Fri, 25 Jul 2008 07:44:12 +0000 (07:44 +0000)
kernel/src/bbtkConnection.cxx
kernel/src/bbtkConnection.h
kernel/src/bbtkObject.cxx
kernel/src/bbtkWxBlackBox.cxx
packages/wx/src/bbwxColourSelector.h
packages/wx/src/bbwxColourSelectorButton.h
packages/wx/src/bbwxCommandButton.cxx
packages/wx/src/bbwxCommandButton.h
packages/wx/src/bbwxSlider.h
samples/README.txt [new file with mode: 0644]

index 4a6b7059e426b6db6e9a90df2c4b6becb6ddfd47..b3ce70a0b00256df328d49f41fd87df6922cd0b0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConnection.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/25 13:37:48 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2008/07/25 07:44:12 $
+  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
@@ -27,6 +27,7 @@
 
 namespace bbtk
 {
+  //==================================================================
   Connection::Pointer Connection::New(BlackBox::Pointer from, 
                                      const std::string& output,
                                      BlackBox::Pointer to, 
@@ -45,6 +46,7 @@ namespace bbtk
                     <<std::endl);
     return p;
   }
+  //==================================================================
 
   //==================================================================
   /// Ctor with the black box from and to and their input and output.
@@ -147,6 +149,123 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
     to->bbConnectInput(input,this);
 
     
+    bbtkDebugMessage("connection",1,"<== Connection::Connection(\""
+                    <<from->bbGetFullName()<<"\",\""<<output<<"\",\""
+                    <<to->bbGetFullName()<<"\",\""<<input<<"\")"
+                    <<std::endl);    
+
+    bbtkDebugMessage("object",2,"==> Connection::Connection(\""
+                    <<from->bbGetName()<<"\",\""<<output<<"\",\""
+                    <<to->bbGetName()<<"\",\""<<input<<"\")"
+                    <<std::endl);    
+  }
+ //==================================================================
+  //==================================================================
+  Connection::Pointer Connection::New(BlackBox::Pointer from, 
+                                     const std::string& output,
+                                     BlackBox::Pointer to, 
+                                     const std::string& input )
+  {
+    bbtkDebugMessage("object",1,"##> Connection::Connection(\""
+                    <<from->bbGetName()<<"\",\""<<output<<"\",\""
+                    <<to->bbGetName()<<"\",\""<<input<<"\")"
+                    <<std::endl);
+    Connection::Pointer p = 
+      MakePointer(new Connection(from,output,to,input));
+    bbtkDebugMessage("object",1,"<## Connection::Connection(\""
+                    <<from->bbGetName()<<"\",\""<<output<<"\",\""
+                    <<to->bbGetName()<<"\",\""<<input<<"\")"
+                    <<std::endl);
+    return p;
+  }
+  //==================================================================
+
+  //==================================================================
+  /// Ctor with the black box from and to and their input and output.
+/// Check the input and output compatibility
+Connection::Connection(BlackBox::Pointer from, const std::string& output,
+                      BlackBox::Pointer to, const std::string& input )
+  : mAdaptor(),
+      mFactory(),
+      mFromAny(false),
+      mToAny(false)
+  {
+    bbtkDebugMessage("object",2,"==> Connection::Connection(\""
+                    <<from->bbGetName()<<"\",\""<<output<<"\",\""
+                    <<to->bbGetName()<<"\",\""<<input<<"\")"
+                    <<std::endl);    
+
+    bbtkDebugMessage("connection",1,"==> Connection::Connection(\""
+                    <<from->bbGetFullName()<<"\",\""<<output<<"\",\""
+                    <<to->bbGetFullName()<<"\",\""<<input<<"\")"
+                    <<std::endl);    
+
+    
+
+    if (! from->bbHasOutput(output) )
+      {
+       bbtkError("The box \""<<from->bbGetTypeName()<<
+                 "\" has no output \""<<output<<"\"");
+      }
+    if (! to->bbHasInput(input) )
+      {
+       bbtkError("The box \""<<to->bbGetTypeName()<<
+                 "\" has no input \""<<input<<"\"");
+      } 
+
+    if (to->bbGetInputConnectorMap().find(input)->second->IsConnected())
+      {
+       bbtkError("The input \""<<input<<"\" of the box \""<<to->bbGetName()
+                 <<"\" is already connected");
+      }
+    
+    //  std::string t1 ( from->bbGetOutputType(output).name() );
+    //   std::string t2 ( to->bbGetInputType(input).name() );
+    // if  //( t1 != t2 ) 
+    if ( from->bbGetOutputType(output) !=
+        to->bbGetInputType(input) )
+      {
+       if ( from->bbGetOutputType(output) == typeid(Data) )
+         {
+           bbtkWarning("Connection '"
+                       <<GetFullName()
+                       <<"' : '"<<from->bbGetName()<<"."<<output
+                       <<"' is of type <"
+                       <<HumanTypeName<Data>()
+                       <<"> : type compatibility with '"
+                       <<to->bbGetName()<<"."<<input
+                       <<"' will be resolved at run time"
+                       );
+           mFromAny = true;
+         }
+       else if (  to->bbGetInputType(input) == typeid(Data) )
+         {   
+           bbtkDebugMessage("Kernel",8," -> '"<<input<<"' type is "
+                            <<TypeName<Data>()<<" : can receive any data"
+                            <<std::endl);
+           mToAny = true;
+         }
+       else 
+         {
+           bbtkError("Connection created between different types without Factory provided");
+         }
+      }
+
+
+    mFrom = from;
+    mOriginalFrom = from;
+    mTo = to;
+    mOriginalTo = to;
+    mInput = mOriginalInput = input;
+    mOutput = mOriginalOutput = output;
+
+     // Lock this pointer !!!
+    //Pointer p = MakePointer(this,true);
+    from->bbConnectOutput(output,this);
+    to->bbConnectInput(input,this);
+
+    
     bbtkDebugMessage("connection",1,"<== Connection::Connection(\""
                     <<from->bbGetFullName()<<"\",\""<<output<<"\",\""
                     <<to->bbGetFullName()<<"\",\""<<input<<"\")"
index f1494f01397346cbdda5a6a6c77918efabcbdc86..467721377fd23af62b6bc63be14c7fa6ecccc380 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConnection.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/18 12:59:15 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/07/25 07:44:12 $
+  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
@@ -62,6 +62,8 @@ namespace bbtk
     static Pointer New(BlackBoxPointer from, const std::string& output,
                       BlackBoxPointer to, const std::string& input,
                       const FactoryPointer f);
+    static Pointer New(BlackBoxPointer from, const std::string& output,
+                      BlackBoxPointer to, const std::string& input);
     /// Dtor
     //    ~Connection();
 
@@ -156,6 +158,9 @@ namespace bbtk
     Connection(BlackBoxPointer from, const std::string& output,
               BlackBoxPointer to, const std::string& input,
               const FactoryPointer f);
+    /// Ctor 
+    Connection(BlackBoxPointer from, const std::string& output,
+              BlackBoxPointer to, const std::string& input);
 
   };
 
index fa41efee9eaa5510b8976e12a797982fe04b3582..63ae62b71c3571e344afd1d3cd32e995a8ff71d2 100644 (file)
@@ -176,6 +176,7 @@ namespace bbtk
 
 
 
+  //=======================================================================
   void Object::ReleasePackages()
   {
     bbtkDebugMessage("object",1,"##> Object::ReleasePackages()"<<std::endl);
@@ -187,6 +188,9 @@ namespace bbtk
       {
        if (i->use_count() != 0) 
          { 
+           bbtkDebugMessage("object",1,"##> Releasing package '"<<
+                            i->lock()->GetThisPointer<Package>()->GetName()
+                            <<"'"<<std::endl);
            //      Object::Pointer p(i->lock());
            Package::WeakPointer w(i->lock()->GetThisPointer<Package>());
            Package::Release(w);
@@ -203,7 +207,8 @@ namespace bbtk
       }  
 
   }
-  
+  //=======================================================================
+
 
 
 
index de81d49f06a024211d05172e1e577ab6dd759ab1..1050f0441871d305191f6b8d25bec281fa3237a1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/07/24 14:37:06 $
-  Version:   $Revision: 1.25 $
+  Date:      $Date: 2008/07/25 07:44:12 $
+  Version:   $Revision: 1.26 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -141,6 +141,7 @@ namespace bbtk
   //=========================================================================
   void WxBlackBoxDialog::bbShow()
   { 
+    if (bbIsShown()) return;
     bbtkDebugMessage("wx",5,"WxBlackBoxDialog::bbShow() ["
                     <<bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
     WxBlackBoxWindow::bbShow();
@@ -224,6 +225,7 @@ namespace bbtk
   //=========================================================================
   void WxBlackBoxFrame::bbShow() 
   { 
+    if (bbIsShown()) return;
     bbtkDebugMessage("wx",5,"WxBlackBoxFrame::bbShow("
                     <<bbGetBlackBox()->bbGetFullName()<<")"<<std::endl);
     WxBlackBoxWindow::bbShow();
index 3bdebbd2f2a94fca2a38b0e8b8882b0595665821..b4cf668a3b105b16461dc1f4c5a9f17ea815b6e6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxColourSelector.h,v $
   Language:  C++
-  Date:      $Date: 2008/05/07 13:14:48 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/07/25 07:44:12 $
+  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
@@ -14,7 +14,7 @@
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
      PURPOSE.  See the above copyright notices for more information.
 
-=========================================================================*//**
+=========================================================================*/
  /**
  * \file 
  * \brief Short description in one line
index ba752c6bf02ba27faec8848dd5f39348887fd44d..51d3f1edeb39054708696c7c246d8caebeb15009 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxColourSelectorButton.h,v $
   Language:  C++
-  Date:      $Date: 2008/05/07 13:14:49 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/07/25 07:44:12 $
+  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
@@ -14,7 +14,7 @@
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
      PURPOSE.  See the above copyright notices for more information.
                                                                                 
-=========================================================================*//**
+=========================================================================*/
 /**
  * \file 
  * \brief Short description in one line
index 5cff6c8615f250d69752a41eb5720c7115466a55..7a9352ee60ba3fe452f0aa636b293857d7d6a171 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxCommandButton.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/06/26 07:37:11 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2008/07/25 07:44:12 $
+  Version:   $Revision: 1.10 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 
   l'Image). All rights reserved. See Doc/License.txt or
@@ -98,7 +98,7 @@ namespace bbwx
       std::string commandstr(mBox->bbGetInputIn());
     
     // bbtk::Interpreter::mGlobalInterpreter->InterpretLine( commandstr );
-    int i;
+    unsigned int i;
     bool ok=true;
     int pos1=0,pos2;
     pos2 = commandstr.find(";",pos1);
index 289c2d9c18dd3bf036faf2b339e7f45d4a446824..6b2313a26a371f1822e7a5a0984ef72e5297e1ff 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk 
   Module:    $RCSfile: bbwxCommandButton.h,v $ 
   Language:  C++ 
-  Date:      $Date: 2008/05/07 13:14:49 $ 
-  Version:   $Revision: 1.4 $ 
+  Date:      $Date: 2008/07/25 07:44:12 $ 
+  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 
@@ -14,7 +14,8 @@
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
      PURPOSE.  See the above copyright notices for more information. 
                                                                                  
-=========================================================================*//** 
+=========================================================================*/
+/**
  * \brief Short description in one line 
  *  
  * Long description which  
index f061465ccc6f7ee550cc7946c348a1cf6e8bb023..39aecd9f2d47b0fa15e7c3fde3bea3ea3a3f3749 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSlider.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/18 12:59:53 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2008/07/25 07:44:12 $
+  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
@@ -14,7 +14,7 @@
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
      PURPOSE.  See the above copyright notices for more information.
                                                                                 
-=========================================================================*//**
+=========================================================================*/
 /**
  * \file 
  * \brief Short description in one line
diff --git a/samples/README.txt b/samples/README.txt
new file mode 100644 (file)
index 0000000..89fb003
--- /dev/null
@@ -0,0 +1,6 @@
+Using bbtk in C++ 
+==================
+
+The examples in subdirs must be built as separate projects 
+(it illustrates how bbtk and packages installs are found and used 
+by external projects)