]> Creatis software - bbtk.git/blob - kernel/src/bbtkBlackBoxInputOutputDescriptor.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkBlackBoxInputOutputDescriptor.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkBlackBoxInputOutputDescriptor.h,v $
5   Language:  C++
6   Date:      $Date: 2008/04/08 06:59:29 $
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::BlackBoxInputOutputDescriptor : abstract descriptor of an input or an output of a black box (has a name, description, type and nature)
22  */
23 /**
24  * \class bbtk::BlackBoxInputOutputDescriptor
25  * \brief Abstract descriptor of an input or an output of a black box (has a name, description, type and nature)
26  */
27
28 #ifndef __bbtkBlackBoxInputOutputDescriptor_h__
29 #define __bbtkBlackBoxInputOutputDescriptor_h__
30
31 #include "bbtkSystem.h"
32 #include "bbtkData.h"
33 #include "bbtkRTTI.h"
34
35
36 namespace bbtk
37 {
38   class BBTK_EXPORT BlackBoxInputOutputDescriptor
39   {
40   public:
41     /// Ctor with name and description
42     BlackBoxInputOutputDescriptor(TypeInfo creator_type_info,
43                                   const std::string& name,
44                                   const std::string& description,
45                                   const std::string& nature,
46                                   bool copy_construct = true
47                                   )
48       : mCreatorTypeInfo(creator_type_info),
49         mName(name), 
50         mDescription(description),
51         mNature(nature),
52         mCopyConstruct(copy_construct)
53     {}
54     
55     /// Returns the TypeInfo of the BlackBoxDescriptor which created this descriptor
56     TypeInfo GetCreatorTypeInfo() const { return mCreatorTypeInfo; }
57     /// Returns the name of the in/output
58     const std::string& GetName() const { return mName; }
59     /// Returns the description of the in/output
60     const std::string& GetDescription() const { return mDescription; }
61     /// Returns the nature of the in/output
62     const std::string& GetNature() const { return mNature; }
63     /// Returns the type of the in/output
64     virtual TypeInfo GetTypeInfo() const = 0;
65     /// Returns the name of the type of the in/output
66     virtual std::string GetTypeName() const = 0;
67     /// Returns the DataInfo of the input (Type+Nature)
68     virtual DataInfo GetDataInfo() const 
69     { return DataInfo(this->GetTypeInfo(),mNature); }
70     /// Returns the name of the type of the in/output
71     virtual std::string GetHumanTypeName() const = 0;
72     /// Returns true iff the type is a pointer to class 
73     virtual bool IsPointerType() const = 0;
74     /// Returns true iff the in/output must be copied 
75     /// by the copy constructor of the box
76     bool GetCopyConstruct() const { return mCopyConstruct; }
77
78   protected:
79     /// Default ctor is reserved to children
80     BlackBoxInputOutputDescriptor() : mCreatorTypeInfo(typeid(void)),
81                                       mName(""), mDescription(""),
82                                       mNature(""),
83                                       mCopyConstruct(true)
84                                 {}
85   private:
86
87     /// The TypeInfo of the BlackBoxDescriptor which created this descriptor
88     TypeInfo mCreatorTypeInfo;
89     /// The name of the input/output
90     std::string mName;
91     /// The description of the input/output
92     std::string mDescription;
93     /// The nature of the input/output
94     std::string mNature;
95     /// Does the in/output has to be copied by copy constructor 
96     /// default = true. Must be set to false if it is 
97     /// initialized by the user in bbUserCopyConstructor 
98     /// (typically if it is a pointer)
99     bool mCopyConstruct;
100   };
101   
102 }
103 // namespace bbtk
104 #endif