WimaDataContainer.cc 2.25 KB
Newer Older
1 2 3
#include "WimaDataContainer.h"

WimaDataContainer::WimaDataContainer(QObject *parent)
4
    :   QObject     (parent)
5 6
    ,   _planData   (this /* parent */)
    ,   _dataValid  (false)
7 8 9
{

}
10

11 12 13 14
/*!
 * \fn bool WimaDataContainer::dataValid() const
 * Returns \c true if the data is valid, \c false else.
 */
15 16 17 18 19 20 21 22 23 24
bool WimaDataContainer::dataValid() const/*!
 * \fn bool dijkstraAlgorithm(int startIndex, int endIndex, const QList<T> elements, QList<T> &elementPath, double(*distance)(const T &t1, const T &t2))
 * Calculates the shortest path between the elements stored in \a elements.
 * The \l {Dijkstra Algorithm} is used to find the shorest path.
 * Stores the result inside \a elementPath when sucessfull.
 * The function handle \a distance is used to calculate the distance between two elements. The distance must be positive.
 * Returns \c true if successful, \c false else.
 *
 * \sa QList
 */
25
{
26
    return _dataValid;
27 28
}

29 30 31 32 33 34 35 36 37
/*!
 * \fn void WimaDataContainer::push(const WimaPlanData &planData)
 *
 * Updates the \c WimaPlanData members content with \a planData.
 * Emits the planDataChanged() signal.
 *
 * \sa WimaPlanData
 */
void WimaDataContainer::push(const WimaPlanData &planData)
38
{
39 40 41
    setDataValid(false);
    _planData = planData;
    setDataValid(true);
42 43
}

44 45 46 47 48 49 50 51
/*!
 * \fn const WimaPlanData &WimaDataContainer::pull() const
 *
 * Returns a constant referenc to the \c WimaPlanData member.
 *
 * \sa WimaPlanData
 */
const WimaPlanData &WimaDataContainer::pull() const
52
{
53
    return  _planData;
54 55
}

56 57 58 59 60 61 62 63 64
/*!
 * \fn void WimaDataContainer::setDataValid(bool valid)
 *
 * Sets the validity of the data to \a valid.
 * Mainly for internal usage. Should be invoked from \c WimaPlaner only.
 *
 * \sa WimaPlanData
 */
void WimaDataContainer::setDataValid(bool valid)
65
{
66 67
    if ( _dataValid != valid ) {
        _dataValid = valid;
68

69
        emit dataValidChanged(_dataValid);
70 71
    }
}
72

73 74 75 76 77 78 79 80 81 82 83 84
/*!
 * \class WimaDataContainer
 * \brief Data container designed for data exchange between \c WimaPlaner and \c WimaController.
 * Data container designed for data exchange between \c WimaPlaner and \c WimaController.
 * It is meant that only one instance of this class exists. Both \c WimaPlaner and \c WimaController
 * have a reference to this instance and can modify its data.
 *
 * \sa WimaController, WimaPlaner
 */



85