WDataSetDipoles.h 3.53 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------

25 26
#ifndef WDATASETDIPOLES_H
#define WDATASETDIPOLES_H
27

28 29
#include <vector>

30 31 32 33 34 35 36
#include <boost/shared_ptr.hpp>

#include "WDataSet.h"

/**
 * Represents a dipole dataset.
 */
37
class WDataSetDipoles : public WDataSet
38 39 40 41 42
{
public:
    /**
     * Creates a new dipole dataset.
     */
43
    WDataSetDipoles();
44 45

    /**
46 47
     * Creates a new dipole data set containing one dipole
     * with the given information and checks consistency of the information.
48 49
     *
     * \param dipPos Spatial location of the dipole
50 51
     * \param mags Magnitudes of dipole over time
     * \param times Times for the dipole activity
52
     */
53
    explicit WDataSetDipoles( WPosition dipPos, std::vector<float> mags, std::vector<float> times );
54 55 56 57

    /**
     * Destructs this dataset.
     */
58
    ~WDataSetDipoles();
59 60 61 62 63 64 65 66

    /**
     * Returns a prototype instantiated with the true type of the deriving class.
     *
     * \return the prototype.
     */
    static boost::shared_ptr< WPrototyped > getPrototype();

67 68 69 70 71 72 73 74 75 76 77
    /**
     * Adds a new dipole with given information and checks consistency of the information.
     *
     * \param dipPos Spatial location of the dipole
     * \param mags Magnitudes of dipole over time
     * \param times Times for the dipole activity
     *
     * \return Id of the added dipole.
     */
    size_t addDipole( WPosition dipPos, std::vector<float> mags, std::vector<float> times );

78 79 80
    /**
     * Return position of dipole.
     *
81
     * \param dipoleId Id number of dipole
82 83
     * \return Position of the dipole.
     */
84
    WPosition getPosition( size_t dipoleId = 0 );
85

86 87 88 89
    /**
     * Return magnitude of dipole for a given time.
     *
     * \param time The selected time.
90
     * \param dipoleId Id number of dipole
91 92
     * \return Magnitude of the dipole.
     */
93 94 95 96 97 98 99 100
    float getMagnitude( float time, size_t dipoleId = 0 );

    /**
     * Return number of dipoles in this dataset
     *
     * \return number of dipoles in this dataset.
     */
    size_t getNumberOfDipoles();
101

102 103 104 105 106 107 108
protected:
    /**
     * The prototype as singleton.
     */
    static boost::shared_ptr< WPrototyped > m_prototype;

private:
109 110 111 112 113 114 115 116 117 118 119 120
    /**
     * Internal class representing one dipole
     */
    class Dipole
    {
    public:
        WPosition m_dipolePosition; //!< The location of the dipole
        std::vector<float> m_magnitudes; //!< The magnitude of the dipole
        std::vector<float> m_times; //!< Times for the different magnitudes
    };

    std::vector< Dipole > m_dipoles; //!< List of dipoles representeing this dipoles dataset
121 122
};

123
#endif  // WDATASETDIPOLES_H