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