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