~ubuntu-branches/ubuntu/precise/openwalnut/precise

« back to all changes in this revision

Viewing changes to src/core/dataHandler/WFiberAccumulator.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Eichelbaum
  • Date: 2011-06-21 10:26:54 UTC
  • Revision ID: james.westby@ubuntu.com-20110621102654-rq0zf436q949biih
Tags: upstream-1.2.5
ImportĀ upstreamĀ versionĀ 1.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
#ifndef WFIBERACCUMULATOR_H
 
26
#define WFIBERACCUMULATOR_H
 
27
 
 
28
#include <vector>
 
29
 
 
30
#include <boost/shared_ptr.hpp>
 
31
#include <boost/thread.hpp>
 
32
 
 
33
#include "../common/math/linearAlgebra/WLinearAlgebra.h"
 
34
#include "WDataSetFiberVector.h"
 
35
#include "WDataSetFibers.h"
 
36
#include "WExportDataHandler.h"
 
37
 
 
38
/**
 
39
 * A class that encapsulates the data needed to construct a WDataSetFibers.
 
40
 */
 
41
class OWDATAHANDLER_EXPORT WFiberAccumulator        // NOLINT
 
42
{
 
43
public:
 
44
 
 
45
    /**
 
46
     * Constructor.
 
47
     */
 
48
    WFiberAccumulator();
 
49
 
 
50
    /**
 
51
     * Destructor.
 
52
     */
 
53
    virtual ~WFiberAccumulator();
 
54
 
 
55
    /**
 
56
     * Add a fiber to the dataset.
 
57
     *
 
58
     * \param in The fiber to add, stored as a vector of Positions.
 
59
     *
 
60
     * This function is threadsafe.
 
61
     */
 
62
    void add( std::vector< WVector3d > const& in );
 
63
 
 
64
    /**
 
65
     * Return the dataset that has been accumulated to this point
 
66
     * and start a new dataset.
 
67
     *
 
68
     * \return A shared_ptr pointing to the WDataSetFibers that has been accumulated.
 
69
     *
 
70
     * The returned shared_ptr is the sole owner of the WDataSetFibers.
 
71
     */
 
72
    boost::shared_ptr< WDataSetFibers > buildDataSet();
 
73
 
 
74
    /**
 
75
     * Clears all data.
 
76
     */
 
77
    void clear();
 
78
 
 
79
protected:
 
80
private:
 
81
 
 
82
    /**
 
83
     * A mutex needed to guarantee thread-safety.
 
84
     */
 
85
    boost::mutex m_fiberMutex;
 
86
 
 
87
    /**
 
88
     * One of the vectors needed to construct a WDataSetFibers.
 
89
     * Stores the points in a vector of floats.
 
90
     */
 
91
    boost::shared_ptr< std::vector< float > > m_points;
 
92
 
 
93
    /**
 
94
     * One of the vectors needed to construct a WDataSetFibers.
 
95
     * Stores the starting indices (refering to the points vector) of the fibers.
 
96
     */
 
97
    boost::shared_ptr< std::vector< size_t > > m_fiberIndices;
 
98
 
 
99
    /**
 
100
     * One of the vectors needed to construct a WDataSetFibers.
 
101
     * Stores the length of the fibers.
 
102
     */
 
103
    boost::shared_ptr< std::vector< size_t > > m_fiberLengths;
 
104
 
 
105
    /**
 
106
     * One of the vectors needed to construct a WDataSetFibers.
 
107
     * Stores information about what fiber a point in the points vector refers to.
 
108
     */
 
109
    boost::shared_ptr< std::vector< size_t > > m_pointToFiber;
 
110
};
 
111
 
 
112
#endif  // WFIBERACCUMULATOR_H