GenericWaypointManager.h 1.51 KB
Newer Older
1 2
#pragma once

3
#include <iostream>
4

5 6 7 8 9 10 11
#include "GenericSlicer.h"
#include "Settings.h"

namespace WaypointManager {

template<class WaypointType,
         template<class, class...> class ContainerType>
12 13
class GenericWaypointManager
{
14
    typedef GenericSlicer<WaypointType, ContainerType> Slicer;
15
public:
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
    typedef ContainerType<WaypointType>  WaypointList;

    GenericWaypointManager() = delete;
    GenericWaypointManager(Slicer *slicer, Settings *settings);

    // Waypoint editing.
    void            setWaypoints(const WaypointList &waypoints);
    void            push_back   (const WaypointType &wp);
    void            push_front  (const WaypointType &wp);
    void            clear       ();
    void            insert      (int i, const ElementType &wp);
    uint32_t        size        ()  const;
    WaypointType    &at         (unsigned int i);


    const ContainerType &getWaypoints  () ;
    const ContainerType &getSlcieaypoints  () ;
    const ContainerType &missionItems  () ;

    void slice();
    void next();
    void previous();
    void reset();

private:
    WaypointList _waypoints;
    WaypointList _slice;
    bool         _sliceValid;
    Slicer      *_slicer;
    Settings    *_settings;

47
};
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63


template<class WaypointType,
         template<class, class...> class ContainerType>
GenericWaypointManager<WaypointType, ContainerType>::GenericWaypointManager(
        Slicer *slicer,
        Settings *Settings) :
    _sliceValid(false)
  , _slicer(slicer)
  , _settings(_settings)
{}



} // namespace WaypointManager