#include "WimaDataContainer.h" WimaDataContainer::WimaDataContainer(QObject *parent) : QObject (parent) , _planData (this /* parent */) , _dataValid (false) { } /*! * \fn bool WimaDataContainer::dataValid() const * Returns \c true if the data is valid, \c false else. */ bool WimaDataContainer::dataValid() const/*! * \fn bool dijkstraAlgorithm(int startIndex, int endIndex, const QList elements, QList &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 */ { return _dataValid; } /*! * \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) { setDataValid(false); _planData = planData; setDataValid(true); } /*! * \fn const WimaPlanData &WimaDataContainer::pull() const * * Returns a constant referenc to the \c WimaPlanData member. * * \sa WimaPlanData */ const WimaPlanData &WimaDataContainer::pull() const { return _planData; } /*! * \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) { if ( _dataValid != valid ) { _dataValid = valid; emit dataValidChanged(_dataValid); } } /*! * \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 */