MeVisLab Toolbox Reference
mlVecList.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_VEC_LIST_H
14#define ML_VEC_LIST_H
15
16
19
20// Defines the classes:
21// - VecListTemplate : List class template for lists of n-tupels of a given type
22// - Vec3iList, Vec3fList, Vec4iList, Vec4fList, Vec6iList, Vec6fList
23
24// ML includes
25#include "mlBaseInit.h"
26#include "mlModuleIncludes.h"
27#include "mlLinearAlgebra.h"
28
29
30
31#include "mlListBase.h"
32
33
34
36
37
38
39// ------------------------------------------------------------------
40// BaseObject template class VecListTemplate
41
44// ------------------------------------------------------------------
45template <class T>
47{
48public:
49
52
53
54protected:
55
59 std::string itemState(typename VecListTemplate<T>::const_iterator it) const override;
60
62 void setItemState(typename VecListTemplate<T>::iterator it, const std::string& state) override;
64};
65
66template <class T> std::string VecListTemplate<T>::itemState(
67 typename VecListTemplate<T>::const_iterator it) const
68{
69 std::ostringstream ost;
70 size_t n = it->getSize(), i = 0;
71
72 for (i = 0; i < n - 1; i++) {
73 ost << (*it)[i] << ' ';
74 }
75 ost << (*it)[n - 1];
76
77 return ost.str();
78}
79
80template <class T> void VecListTemplate<T>::setItemState(typename VecListTemplate<T>::iterator it,
81 const std::string &state)
82{
83 std::istringstream ist;
84 size_t i = 0;
85 ist.str(state);
86 for (i = 0; i < it->getSize(); i++) {
87 ist >> (*it)[i];
88 }
89}
90
91
92// ------------------------------------------------------------------
96// ------------------------------------------------------------------
98
99
100// ------------------------------------------------------------------
102// ------------------------------------------------------------------
103
105{
106
107private:
108
111
112};
113
114
115
116
117
118// ------------------------------------------------------------------
122// ------------------------------------------------------------------
124
125// ------------------------------------------------------------------
127// ------------------------------------------------------------------
128
130{
131
132private:
133
136
137};
138
139
140
141
142
143// ------------------------------------------------------------------
147// ------------------------------------------------------------------
149
150// ------------------------------------------------------------------
152// ------------------------------------------------------------------
153
155{
156
157private:
158
161
162};
163
164
165
166// ------------------------------------------------------------------
168// ------------------------------------------------------------------
169
171{
172
173private:
174
177
178};
179
180
181
182
183// ------------------------------------------------------------------
185// ------------------------------------------------------------------
186
188{
189
190private:
191
194
195};
196
197
198
199
200// ------------------------------------------------------------------
202// ------------------------------------------------------------------
203
205{
206
207private:
208
211
212};
213
214
215
217
218#endif
219// __MLVECLIST_H__
@ T
Template class for vector arithmetic with floating point data types.
Basic list class template combining properties of ListBase and a vector of the template argument type...
Definition mlListBase.h:312
size_t getSize() const override
Get number of list elements.
Definition mlListBase.h:338
Base object class Vec3fList derived from VecListTemplate.
Definition mlVecList.h:171
Base object class Vec3iList derived from VecListTemplate.
Definition mlVecList.h:105
Base object class Vec4fList derived from VecListTemplate.
Definition mlVecList.h:188
Base object class Vec4iList derived from VecListTemplate.
Definition mlVecList.h:130
Base object class Vec6fList derived from VecListTemplate.
Definition mlVecList.h:205
Base object class Vec6iList derived from VecListTemplate.
Definition mlVecList.h:155
BaseObject list class template (derived from ListTemplate) for lists of n-tupels of a given type.
Definition mlVecList.h:47
VecListTemplate()
Default constructor.
Definition mlVecList.h:51
void setItemState(typename VecListTemplate< T >::iterator it, const std::string &state) override
Initialize the item object from the string state.
Definition mlVecList.h:80
std::string itemState(typename VecListTemplate< T >::const_iterator it) const override
Definition mlVecList.h:66
#define MLBASEEXPORT
defined Header file mlBaseInit.h
Definition mlBaseInit.h:22
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non existing export symbol.