MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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#include "mlListBase.h"
31
32
34
35
36// ------------------------------------------------------------------
37// BaseObject template class VecListTemplate
38
41// ------------------------------------------------------------------
42template <class T> class VecListTemplate : public ListTemplate<T>
43{
44public:
49
50
51protected:
55 std::string itemState(typename VecListTemplate<T>::const_iterator it) const override;
56
58 void setItemState(typename VecListTemplate<T>::iterator it, const std::string& state) override;
60};
61
62template <class T> std::string VecListTemplate<T>::itemState(typename VecListTemplate<T>::const_iterator it) const
63{
64 std::ostringstream ost;
65 size_t n = it->getSize(), i = 0;
66
67 for (i = 0; i < n - 1; i++) {
68 ost << (*it)[i] << ' ';
69 }
70 ost << (*it)[n - 1];
71
72 return ost.str();
73}
74
75template <class T>
76void VecListTemplate<T>::setItemState(typename VecListTemplate<T>::iterator it, const std::string& state)
77{
78 std::istringstream ist;
79 size_t i = 0;
80 ist.str(state);
81 for (i = 0; i < it->getSize(); i++) {
82 ist >> (*it)[i];
83 }
84}
85
86
87// ------------------------------------------------------------------
91// ------------------------------------------------------------------
93
94
95// ------------------------------------------------------------------
97// ------------------------------------------------------------------
98
100{
101
102private:
105};
106
107
108// ------------------------------------------------------------------
112// ------------------------------------------------------------------
114
115// ------------------------------------------------------------------
117// ------------------------------------------------------------------
118
120{
121
122private:
125};
126
127
128// ------------------------------------------------------------------
132// ------------------------------------------------------------------
134
135// ------------------------------------------------------------------
137// ------------------------------------------------------------------
138
140{
141
142private:
145};
146
147
148// ------------------------------------------------------------------
150// ------------------------------------------------------------------
151
153{
154
155private:
158};
159
160
161// ------------------------------------------------------------------
163// ------------------------------------------------------------------
164
166{
167
168private:
171};
172
173
174// ------------------------------------------------------------------
176// ------------------------------------------------------------------
177
179{
180
181private:
184};
185
186
188
189#endif
190// __MLVECLIST_H__
@ T
Template class for vector arithmetic with floating point datatypes.
Basic list class template combining properties of ListBase and a vector of the template argument type...
Definition mlListBase.h:370
size_t getSize() const override
Get number of list elements.
Definition mlListBase.h:402
Base object class Vec3fList derived from VecListTemplate.
Definition mlVecList.h:153
Base object class Vec3iList derived from VecListTemplate.
Definition mlVecList.h:100
Base object class Vec4fList derived from VecListTemplate.
Definition mlVecList.h:166
Base object class Vec4iList derived from VecListTemplate.
Definition mlVecList.h:120
Base object class Vec6fList derived from VecListTemplate.
Definition mlVecList.h:179
Base object class Vec6iList derived from VecListTemplate.
Definition mlVecList.h:140
BaseObject list class template (derived from ListTemplate) for lists of n-tupels of a given type.
Definition mlVecList.h:43
VecListTemplate()
Default constructor.
Definition mlVecList.h:46
void setItemState(typename VecListTemplate< T >::iterator it, const std::string &state) override
Initialize the item object from the string state.
Definition mlVecList.h:76
std::string itemState(typename VecListTemplate< T >::const_iterator it) const override
Definition mlVecList.h:62
#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.