]> Creatis software - bbtk.git/blob - kernel/src/bbtkBlackBoxInputDescriptor.h
19c578f91514093d6635413b51b590e5f2f8a844
[bbtk.git] / kernel / src / bbtkBlackBoxInputDescriptor.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkBlackBoxInputDescriptor.h,v $
5   Language:  C++
6   Date:      $Date: 2008/02/06 14:14:22 $
7   Version:   $Revision: 1.2 $
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   class BBTK_EXPORT BlackBoxInputDescriptor
38   {
39   public:
40     typedef enum {
41       MANDATORY,
42       OPTIONAL
43     } OptionType;
44     
45     
46     /// Ctor with name and description
47     BlackBoxInputDescriptor(TypeInfo creator_type_info,
48                             const std::string& name,
49                             const std::string& description,
50                             OptionType option = MANDATORY,
51                             bool copy_construct = true)
52       : mCreatorTypeInfo(creator_type_info),
53         mName(name), mDescription(description), 
54         mOption(option), mCopyConstruct(copy_construct) 
55     {}
56     
57     /// Returns the TypeInfo of the BlackBoxDescriptor which created this descriptor
58     TypeInfo GetCreatorTypeInfo() { return mCreatorTypeInfo; }
59     /// Returns the name of the input
60     const std::string& GetName() const { return mName; }
61     /// Returns the description of the input
62     const std::string& GetDescription() const { return mDescription; }
63     /// Returns the type of the input
64     virtual TypeInfo GetTypeInfo() const = 0;
65     /// Returns the name of the type of the input
66     virtual std::string GetTypeName() const = 0;
67     /// Returns the name of the type of the input
68     virtual std::string GetHumanTypeName() const = 0;
69     /// Returns true iff the type is a pointer to class 
70     virtual bool IsPointerType() const = 0;
71     /// Returns the option of the input
72     OptionType GetOption() const { return mOption; }
73     /// Returns true iff the input must be copied 
74     /// by the copy constructor of the box
75     bool GetCopyConstruct() const { return mCopyConstruct; }
76     
77   private:
78     /// Default ctor is private
79     BlackBoxInputDescriptor() : mCreatorTypeInfo(typeid(void)),
80                                 mName(""), mDescription(""), 
81                                 mOption(OPTIONAL) {}
82
83     /// The TypeInfo of the BlackBoxDescriptor which created this descriptor
84     TypeInfo mCreatorTypeInfo;
85     /// The name of the input
86     std::string mName;
87     /// The description of the input
88     std::string mDescription;
89     /// The option of the input 
90     OptionType mOption;
91     /// Does the input has to be copied by copy constructor 
92     /// default = true. Must be set to false if it is 
93     /// initialized by the user in bbUserCopyConstructor 
94     /// (typically if it is a pointer)
95     bool mCopyConstruct;
96   };
97   
98 }
99 // namespace bbtk
100 #endif