]> Creatis software - bbtk.git/blob - kernel/src/bbtkBlackBoxInputOutputDescriptor.h
Feature #1774
[bbtk.git] / kernel / src / bbtkBlackBoxInputOutputDescriptor.h
1 /*
2  # ---------------------------------------------------------------------
3  #
4  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5  #                        pour la SantÈ)
6  # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7  # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8  # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9  #
10  #  This software is governed by the CeCILL-B license under French law and
11  #  abiding by the rules of distribution of free software. You can  use,
12  #  modify and/ or redistribute the software under the terms of the CeCILL-B
13  #  license as circulated by CEA, CNRS and INRIA at the following URL
14  #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15  #  or in the file LICENSE.txt.
16  #
17  #  As a counterpart to the access to the source code and  rights to copy,
18  #  modify and redistribute granted by the license, users are provided only
19  #  with a limited warranty  and the software's author,  the holder of the
20  #  economic rights,  and the successive licensors  have only  limited
21  #  liability.
22  #
23  #  The fact that you are presently reading this means that you have had
24  #  knowledge of the CeCILL-B license and that you accept its terms.
25  # ------------------------------------------------------------------------ */
26
27
28 /*=========================================================================
29   Program:   bbtk
30   Module:    $RCSfile: bbtkBlackBoxInputOutputDescriptor.h,v $
31   Language:  C++
32   Date:      $Date: 2012/11/16 08:49:01 $
33   Version:   $Revision: 1.7 $
34 =========================================================================*/
35
36
37 /**
38  *  \file 
39  *  \brief Class bbtk::BlackBoxInputOutputDescriptor : abstract descriptor of an input or an output of a black box (has a name, description, type and nature)
40  */
41 /**
42  * \class bbtk::BlackBoxInputOutputDescriptor
43  * \brief Abstract descriptor of an input or an output of a black box (has a name, description, type and nature)
44  */
45
46 #ifndef __bbtkBlackBoxInputOutputDescriptor_h__
47 #define __bbtkBlackBoxInputOutputDescriptor_h__
48
49 #include "bbtkSystem.h"
50 #include "bbtkData.h"
51 #include "bbtkRTTI.h"
52
53
54 namespace bbtk
55 {
56   class BBTK_EXPORT BlackBoxInputOutputDescriptor
57   {
58   public:
59     /// Ctor with name, description and naure
60     BlackBoxInputOutputDescriptor(TypeInfo creator_type_info,
61                                   const std::string& name,
62                                   const std::string& description,
63                                   const std::string& nature,
64                                   bool copy_construct = true
65                                   )
66       : mCreatorTypeInfo(creator_type_info),
67         mName(name), 
68         mDescription(description),
69         mNature(nature),
70         mCopyConstruct(copy_construct)
71     {}
72     /// Dtor
73     virtual ~BlackBoxInputOutputDescriptor() {}
74
75     /// Returns the TypeInfo of the BlackBoxDescriptor which created this descriptor
76     TypeInfo GetCreatorTypeInfo() const { return mCreatorTypeInfo; }
77     /// Returns the name of the in/output
78     const std::string& GetName() const { return mName; }
79     /// Returns the description of the in/output
80     const std::string& GetDescription() const { return mDescription; }
81     /// Returns the nature of the in/output
82     const std::string& GetNature() const { return mNature; }
83     /// Returns the type of the in/output
84     virtual TypeInfo GetTypeInfo() const = 0;
85     /// Returns the name of the type of the in/output
86     virtual std::string GetTypeName() const = 0;
87     /// Returns the DataInfo of the input (Type+Nature)
88     virtual DataInfo GetDataInfo() const 
89     { return DataInfo(this->GetTypeInfo(),mNature); }
90     /// Returns the name of the type of the in/output
91     virtual std::string GetHumanTypeName() const = 0;
92     /// Returns true iff the type is a pointer to class 
93     virtual bool IsPointerType() const = 0;
94     /// Returns true iff the in/output must be copied 
95     /// by the copy constructor of the box
96     bool GetCopyConstruct() const { return mCopyConstruct; }
97
98   protected:
99     /// Default ctor is reserved to children
100     BlackBoxInputOutputDescriptor() : mCreatorTypeInfo(typeid(void)),
101                                       mName(""), mDescription(""),
102                                       mNature(""),
103                                       mCopyConstruct(true)
104                                 {}
105   private:
106
107     /// The TypeInfo of the BlackBoxDescriptor which created this descriptor
108     TypeInfo mCreatorTypeInfo;
109     /// The name of the input/output
110     std::string mName;
111     /// The description of the input/output
112     std::string mDescription;
113     /// The nature of the input/output
114     std::string mNature;
115     /// Does the in/output has to be copied by copy constructor 
116     /// default = true. Must be set to false if it is 
117     /// initialized by the user in bbUserCopyConstructor 
118     /// (typically if it is a pointer)
119     bool mCopyConstruct;
120   };
121   
122 }
123 // namespace bbtk
124 #endif