Program Listing for File switchable_tv_generator.hpp

Return to documentation for file (cosm/tv/switchable_tv_generator.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <memory>

#include "rcppsw/control/periodic_waveform.hpp"
#include "rcppsw/types/timestep.hpp"

#include "cosm/cosm.hpp"

/*******************************************************************************
 * Namespaces
 ******************************************************************************/
namespace cosm::tv {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
class switchable_tv_generator {
 public:
  explicit switchable_tv_generator(
      const rcontrol::config::waveform_config* config);
  ~switchable_tv_generator(void);

  double active_tv(void) const { return m_active; }

  double applied_tv(void) const { return m_applied; }

  void toggle(bool en) { m_en = en; }

  void update(const rtypes::timestep& t);

 private:
  /* clang-format off */
  bool                                     m_en{false};
  double                                   m_active{0.0};
  double                                   m_applied{0.0};
  std::unique_ptr<rcontrol::base_waveform> m_waveform;
  /* clang-format off */
};

} /* namespace cosm::tv */