#ifndef MIDAS_DRIVERS_EPICS_EPICS_IOC_H
#define MIDAS_DRIVERS_EPICS_EPICS_IOC_H

#include <cstdint>
#include <memory>
#include <string>

namespace midas {
namespace epics {

/* Minimal scalar Channel Access server with change subscriptions. */
class SoftIoc {
public:
   SoftIoc();
   ~SoftIoc();

   bool add_pv(const std::string &name, double *value, bool writable = true);
   bool add_pv(const std::string &name, std::int32_t *value,
               bool writable = true);
   bool start(std::uint16_t port = 5064);
   bool poll(int timeout_ms);
   const std::string &error() const;

private:
   SoftIoc(const SoftIoc &);
   SoftIoc &operator=(const SoftIoc &);

   struct Impl;
   std::unique_ptr<Impl> impl_;
};

} // namespace epics
} // namespace midas

#endif
