My Project
valueattributetranslator.hh
Go to the documentation of this file.
1/* -*- mia-c++ -*-
2 *
3 * This file is part of MIA - a toolbox for medical image analysis
4 * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
5 *
6 * MIA is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#ifndef mia_3d_valueattributetranslator_hh
22#define mia_3d_valueattributetranslator_hh
23
25#include <mia/3d/vector.hh>
26#include <mia/3d/defines3d.hh>
27
29
34template <typename T>
36{
37public:
38 static bool register_for(const std::string& key);
39private:
40 PAttribute do_from_string(const std::string& value) const;
41};
42
54template <typename T>
56{
57public:
58
64
66 operator T3DVector<T>()const;
67
72 const char *typedescr() const
73 {
74 return typeid(T3DVector<T>).name();
75 }
76
77 //
78 int type_id() const
79 {
80 return attribute_type<T3DVector<T>>::value;
81 }
82private:
83 std::string do_as_string() const;
84 bool do_is_equal(const CAttribute& other) const;
85 bool do_is_less(const CAttribute& other) const;
86 T3DVector<T> m_value;
87};
88
94
100
106
112
114
115#endif
std::shared_ptr< CAttribute > PAttribute
define the shared pointer wrapped attribute pointer
a translater for 3D vectors to and from a std::string
static bool register_for(const std::string &key)
a 3D vector value used in attributes
const char * typedescr() const
C3DValueAttribute(const T3DVector< T > &value)
A class to translate an attribute from a string.
The class of all attributes of data that is considered to ve meta-data.
Definition attributes.hh:52
A simple 3D vector type.
Definition 3d/vector.hh:49
#define EXPORT_3D
Definition defines3d.hh:45
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
C3DValueAttributeTranslator< int > C3DIntAttributeTranslator
attribute translator for a 3D integer vector
C3DValueAttribute< float > CVoxelAttribute
a 3D floating point vector used for the voxel size attribute
C3DValueAttribute< int > C3DIntAttribute
a 3D integer vector
C3DValueAttributeTranslator< float > CVoxelAttributeTranslator
attribute translator for a 3D floating point vector used for the voxel size