//===-- rosa/agent/StateDetector.hpp ----------------------*- C++ -*-===//
//
//                                 The RoSA Framework
//
//===----------------------------------------------------------------------===//
///
/// \file rosa/agent/StateDetector.hpp
///
/// \author Maximilian Götzinger (maximilian.goetzinger@tuwien.ac.at)
///
/// \date 2019
///
/// \brief Definition of *state detector* *functionality*.
///
//===----------------------------------------------------------------------===//

#ifndef ROSA_AGENT_STATEDETECTOR_HPP
#define ROSA_AGENT_STATEDETECTOR_HPP

#include "rosa/agent/FunctionAbstractions.hpp"
#include "rosa/agent/History.hpp"

#include <vector>

namespace rosa {
namespace agent {

template <typename INDATATYPE, typename CONFDATATYPE, typename PROCDATATYPE,
          HistoryPolicy HP>
class StateDetector : public Functionality {

  // Make sure the actual type arguments are matching our expectations.
  STATIC_ASSERT((std::is_arithmetic<INDATATYPE>::value),
                "input data type not arithmetic");
  STATIC_ASSERT((std::is_arithmetic<CONFDATATYPE>::value),
                "confidence abstraction type is not to arithmetic");
  STATIC_ASSERT((std::is_arithmetic<PROCDATATYPE>::value),
                "process type is not to arithmetic");

protected:
  using PartFuncPointer =
      std::shared_ptr<PartialFunction<INDATATYPE, CONFDATATYPE>>;
  using StepFuncPointer =
      std::shared_ptr<StepFunction<INDATATYPE, CONFDATATYPE>>;

  /// The NextSignalStateID is a counter variable which stores the ID which the
  /// next signal state shall have.
  uint32_t NextStateID;

  /// The SignalStateHasChanged is a flag that show whether a signal has changed
  /// its state.
  bool StateHasChanged;
};

} // End namespace agent
} // End namespace rosa

#endif // ROSA_AGENT_SIGNALSTATEDETECTOR_HPP
