1 /*=========================================================================
4 Module: $RCSfile: bbtkData.h,v $
6 Date: $Date: 2008/04/18 12:59:15 $
7 Version: $Revision: 1.3 $
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.
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.
17 =========================================================================*/
20 *\brief Defines Data and DataInfo
22 * Data is bbtk general type exchanged between black boxes (adapted from boost::any).
23 * DataInfo is the bbtk type of object storing informations on a data type : includes C++ type info (std::type_info) and a string describing the "nature" of the data (what is the content of the structure).
26 #ifndef __bbtkData_h__
27 #define __bbtkData_h__
36 /// The generic type of "data" exchanged between black boxes
37 typedef any<thing> Data;
39 /// Object storing informations on a data type : includes C++ type info (std::type_info) and a string describing the "nature" of the data (what is the content of the structure)
43 DataInfo( TypeInfo type, const std::string& nature="")
44 : mType(type), mNature(nature)
49 TypeInfo GetType() const { return mType; }
50 const std::string& GetNature() const { return mNature; }
53 bool operator== ( const DataInfo& k ) const
55 return ( (mType == k.mType) &&
56 (mNature == k.mNature) );
59 bool operator< ( const DataInfo& k ) const
61 return ( ( mType.before(k.mType) ) ||
62 ( ( mType == k.mType ) &&
63 ( mNature.compare(k.mNature) < 0 ) ) );
68 DataInfo() : mType(typeid(void)), mNature("") {}
76 inline std::ostream& operator<<(std::ostream& s, const DataInfo& d)
78 s << "<" << TypeName(d.GetType()) << "("<< d.GetNature()<<")>";