Skip to content

File EventDetector.hpp

File List > astrea > astro > astro > propagation > event_detection > EventDetector.hpp

Go to the documentation of this file

#pragma once

#include <set>
#include <vector>

#include <gtl/btree.hpp>

#include <units/units.hpp>

#include <astro/propagation/event_detection/Event.hpp>

namespace astrea {
namespace astro {

class EventDetector {

    struct EventTracker {
        Event event;                   
        bool firstMeasurement;         
        Time previousTime;             
        Unitless previousValue;        
        std::set<Time> detectionTimes; 
    };

  public:
    EventDetector() = default;

    EventDetector(const std::vector<Event>& events);

    ~EventDetector() = default;

    void set_events(const std::vector<Event>& events);

    std::vector<Event> get_events() const;

    bool detect_events(const Time& time, State& state, Vehicle& vehicle);

    gtl::btree_map<std::string, std::vector<Date>> get_event_times(const Date& epoch) const;

  private:
    std::vector<EventTracker> _eventTrackers; 

    bool detect_event(const Time& time, const Unitless& value, EventTracker& tracker) const;
};

} // namespace astro
} // namespace astrea