]> Creatis software - bbtk.git/blob - kernel/src/bbtkBlackBoxInputDescriptor.h
Recreated the complete cvs tree because the project architecture deeply changed
[bbtk.git] / kernel / src / bbtkBlackBoxInputDescriptor.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkBlackBoxInputDescriptor.h,v $
5   Language:  C++
6   Date:      $Date: 2008/01/22 15:02:00 $
7   Version:   $Revision: 1.1.1.1 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 /**
20  *  \file 
21  *  \brief Class bbtk::BlackBoxInputDescriptor : abstract descriptor of an input of a black box (stores a name, a description and type)
22  */
23 /**
24  * \class bbtk::BlackBoxInputDescriptor
25  * \brief Abstract descriptor of an input of a black box (stores a name, a description and type)
26  */
27
28 #ifndef __bbtkBlackBoxInputDescriptor_h__
29 #define __bbtkBlackBoxInputDescriptor_h__
30
31 #include "bbtkSystem.h"
32 #include "bbtkData.h"
33 #include "bbtkRTTI.h"
34
35 namespace bbtk
36 {
37   
38   
39   class BBTK_EXPORT BlackBoxInputDescriptor
40   {
41   public:
42     typedef enum {
43       MANDATORY,
44       OPTIONAL
45     } OptionType;
46     
47     
48     /// Ctor with name and description
49     BlackBoxInputDescriptor( const std::string& name,
50                              const std::string& description,
51                              OptionType option = MANDATORY,
52                              bool copy_construct = true)
53       : mName(name), mDescription(description), 
54         mOption(option), mCopyConstruct(copy_construct) 
55     {}
56     
57     /// Returns the name of the input
58     const std::string& GetName() const { return mName; }
59     /// Returns the description of the input
60     const std::string& GetDescription() const { return mDescription; }
61     /// Returns the type of the input
62     virtual TypeInfo GetTypeInfo() const = 0;
63     /// Returns the name of the type of the input
64     virtual std::string GetTypeName() const = 0;
65     /// Returns the name of the type of the input
66     virtual std::string GetHumanTypeName() const = 0;
67     /// Returns true iff the type is a pointer to class 
68     virtual bool IsPointerType() const = 0;
69     /// Returns the option of the input
70     OptionType GetOption() const { return mOption; }
71     /// Returns true iff the input must be copied 
72     /// by the copy constructor of the box
73     bool GetCopyConstruct() const { return mCopyConstruct; }
74     
75   private:
76     /// Default ctor is private
77     BlackBoxInputDescriptor() : mName(""), mDescription(""), 
78                                 mOption(OPTIONAL) {}
79     /// The name of the input
80     std::string mName;
81     /// The description of the input
82     std::string mDescription;
83     /// The option of the input 
84     OptionType mOption;
85     /// Does the input has to be copied by copy constructor 
86     /// default = true. Must be set to false if it is 
87     /// initialized by the user in bbUserCopyConstructor 
88     /// (typically if it is a pointer)
89     bool mCopyConstruct;
90   };
91   
92 }
93 // namespace bbtk
94 #endif