]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkBlackBoxDescriptor.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkBlackBoxDescriptor.h
index 6443d50ac93469b756cf5541393c54bf65de6c49..a680b54f81124bbcd195085ee69ec4ddedef4168 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxDescriptor.h,v $
   Language:  C++
-  Date:      $Date: 2008/03/07 08:40:14 $
-  Version:   $Revision: 1.6 $
+  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
@@ -54,16 +54,16 @@ namespace bbtk
     /// The kinds of black box
     typedef enum
     {
-      STANDARD,
-      ADAPTOR,
-      DEFAULT_ADAPTOR
+      STANDARD=0,
+      ADAPTOR=1,
+      DEFAULT_ADAPTOR=2,
+      WIDGET_ADAPTOR=3,
+      DEFAULT_WIDGET_ADAPTOR=4
     }
     Kind;
 
     /// 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;
@@ -71,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; }
     
@@ -138,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; }
@@ -163,7 +177,12 @@ namespace bbtk
     InputDescriptorMapType mInput;
     /// The outputs 
     OutputDescriptorMapType mOutput;
+
+    /// Reference counting
+    int mRefCount;
     
+  private:
+    BlackBoxDescriptor(const BlackBoxDescriptor&) {}
   };
   // class BlackBoxDescriptor
   //==========================================================================