bbtkBlackBoxDescriptor.h

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkBlackBoxDescriptor.h,v $
00004   Language:  C++
00005   Date:      $Date: 2008/10/17 08:18:12 $
00006   Version:   $Revision: 1.11 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00031 
00041 #ifndef __bbtkBlackBoxDescriptor_h__
00042 #define __bbtkBlackBoxDescriptor_h__
00043 
00044 #include "bbtkObject.h"
00045 #include "bbtkBlackBoxInputDescriptor.h"
00046 #include "bbtkBlackBoxOutputDescriptor.h"
00047 #include <map>
00048 #include <fstream>
00049 
00050 namespace bbtk
00051 {
00052 
00053   class BlackBox;
00054   class Package;
00055   BBTK_FORWARD_DECLARE_POINTER(BlackBox);
00056   BBTK_FORWARD_DECLARE_POINTER(Package);
00057 
00058   //==========================================================================
00059   class BBTK_EXPORT BlackBoxDescriptor : public Object
00060   {
00061     BBTK_ABSTRACT_OBJECT_INTERFACE(BlackBoxDescriptor);
00062   public:
00064     typedef BlackBoxInputDescriptor InputDescriptor;
00066     typedef BlackBoxOutputDescriptor OutputDescriptor;
00068     typedef std::map<std::string, InputDescriptor*> InputDescriptorMapType;
00070     typedef std::map<std::string, OutputDescriptor*> OutputDescriptorMapType;
00072     typedef enum
00073     {
00074       STANDARD=0,
00075       ADAPTOR=1,
00076       DEFAULT_ADAPTOR=2,
00077       GUI=3,
00078       DEFAULT_GUI=4
00079     }
00080     Kind;
00081 
00083     //    static void Release(BlackBoxDescriptor::WeakPointer);
00084 
00087     virtual BlackBoxPointer NewBlackBox(const std::string& boxname) = 0;
00088 
00090     const std::string& GetTypeName() const { return mTypeName; }
00091     
00093     std::string GetFullTypeName() const;
00094     
00096     const std::string& GetDescription() const { return mDescription; }
00097     
00099     const std::string& GetAuthor() const { return mAuthor; }
00100     
00102     const std::string& GetCategory() const { return mCategory; }
00103     
00105     PackagePointer GetPackage() const { return mPackage; }
00106     
00108     Kind GetKind() const { return mKind; }
00109 
00111     virtual void GetHelp(bool full=true) const;
00112 
00114     const InputDescriptorMapType& GetInputDescriptorMap() const 
00115       { return mInput; }
00116       
00118     const OutputDescriptorMapType& GetOutputDescriptorMap() const 
00119       { return mOutput; }
00120       
00122     const InputDescriptor* GetInputDescriptor(const std::string &name) const;
00123 
00125     const OutputDescriptor* GetOutputDescriptor(const std::string &name) const;
00126 
00128     void SetTypeName( const std::string& name ) { mTypeName=name; }
00129 
00131     void AddToDescription( const std::string&, bool clear = false );
00132     
00134     void AddToAuthor( const std::string&, bool clear = false );
00135     
00137     void AddToCategory( const std::string&, bool clear = false );
00138     
00140     void SetPackage(PackagePointer package) { mPackage = package; }
00141     
00143     void SetKind(Kind kind) { mKind = kind; }
00144 
00145     /* 
00146    virtual void InsertHTMLGraph( std::ofstream& s, int detail, int level, 
00147                                   const std::string& output_dir = "" ) { }
00148     */
00154     virtual void InsertHtmlHelp ( std::ofstream& s, 
00155                                   int detail, int level,
00156                                   const std::string& output_dir = "",
00157                                   bool relative_link = false );
00159     virtual void Check(bool recursive=true) const;
00160 
00161   protected:
00163     void AddInputDescriptor( BlackBoxInputDescriptor *d ) 
00164     { mInput[d->GetName()] = d; }
00166     void AddOutputDescriptor( BlackBoxOutputDescriptor *d ) 
00167     { mOutput[d->GetName()] = d; }
00168 
00169     //  private:
00171     std::string mTypeName;
00173     std::string mDescription;
00175     std::string mAuthor;
00177     std::string mCategory;    
00179     Kind mKind;
00181     PackagePointer mPackage;
00183     InputDescriptorMapType mInput;
00185     OutputDescriptorMapType mOutput;
00186 
00187   };
00188   // class BlackBoxDescriptor
00189   //==========================================================================
00190 
00191 
00192  
00193 }
00194 // namespace bbtk
00195 #endif

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6