OpenWalnut
1.3.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
src
core
dataHandler
WDataSetFiberClustering.cpp
1
//---------------------------------------------------------------------------
2
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
7
//
8
// This file is part of OpenWalnut.
9
//
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22
//
23
//---------------------------------------------------------------------------
24
25
#include <string>
26
27
#include "WDataSetFiberClustering.h"
28
29
// The prototype as singleton. Created during first getPrototype() call
30
boost::shared_ptr< WPrototyped >
WDataSetFiberClustering::m_prototype
= boost::shared_ptr< WPrototyped >();
31
32
WDataSetFiberClustering::WDataSetFiberClustering
()
33
{
34
// initialize members
35
}
36
37
WDataSetFiberClustering::~WDataSetFiberClustering
()
38
{
39
// cleanup
40
}
41
42
boost::shared_ptr< WPrototyped >
WDataSetFiberClustering::getPrototype
()
43
{
44
if
( !
m_prototype
)
45
{
46
m_prototype
= boost::shared_ptr< WPrototyped >(
new
WDataSetFiberClustering
() );
47
}
48
return
m_prototype
;
49
}
50
51
const
std::string
WDataSetFiberClustering::getName
()
const
52
{
53
return
"DataSetFiberClustering"
;
54
}
55
56
const
std::string
WDataSetFiberClustering::getDescription
()
const
57
{
58
return
"A collection of fiber clusters."
;
59
}
60
61
void
WDataSetFiberClustering::setCluster
(
size_t
id
,
WFiberCluster::SPtr
cluster )
62
{
63
m_clusters
[ id ] = cluster;
64
}
65
66
WFiberCluster::SPtr
WDataSetFiberClustering::getCluster
(
size_t
id
)
67
{
68
WFiberCluster::SPtr
result =
m_clusters
[ id ];
69
if
( !result )
70
{
71
throw
WInvalidID
(
"The cluster with the specified ID does not exist."
);
72
}
73
return
result;
74
}
75
76
WFiberCluster::SPtr
WDataSetFiberClustering::getOrCreateCluster
(
size_t
id
)
77
{
78
WFiberCluster::SPtr
result =
m_clusters
[ id ];
79
if
( !result )
80
{
81
// create an empty one
82
WFiberCluster::SPtr
newCluster(
new
WFiberCluster
() );
83
m_clusters
[ id ] = newCluster;
84
return
newCluster;
85
}
86
return
result;
87
}
88
89
void
WDataSetFiberClustering::removeCluster
(
size_t
id
)
90
{
91
if
( !
m_clusters
.count(
id
) )
92
{
93
return
;
94
}
95
m_clusters
.erase(
id
);
96
}
97
98
WDataSetFiberClustering::ClusterMap::const_iterator
WDataSetFiberClustering::begin
()
const
99
{
100
return
m_clusters
.begin();
101
}
102
103
WDataSetFiberClustering::ClusterMap::iterator
WDataSetFiberClustering::begin
()
104
{
105
return
m_clusters
.begin();
106
}
107
108
WDataSetFiberClustering::ClusterMap::const_iterator
WDataSetFiberClustering::end
()
const
109
{
110
return
m_clusters
.end();
111
}
112
113
WDataSetFiberClustering::ClusterMap::iterator
WDataSetFiberClustering::end
()
114
{
115
return
m_clusters
.end();
116
}
117
Generated by
1.8.1.2