pacemaker 3.2.3
COM automation for people with deadlines and a hatred of GUIs
 
Loading...
Searching...
No Matches
Session.hpp
Go to the documentation of this file.
1#ifndef PACEMAKER_INCA_SESSION_HPP_
2#define PACEMAKER_INCA_SESSION_HPP_
3
4#include <any>
5#include <chrono>
6#include <filesystem>
7#include <functional>
8#include <memory>
9#include <string>
10
11
12#include "pacemaker/inca/pacemaker.inca_export.h"
13
15{
47 class Session
48 {
49 public:
64 [[nodiscard]] static auto PACEMAKER_INCA_EXPORT connect(const std::function<std::any(void)> &factory) -> Session;
65
82 [[nodiscard]] static auto PACEMAKER_INCA_EXPORT connect() -> Session;
83
85 Session(const Session &) = delete;
87 Session(Session &&) = delete;
89 Session &operator=(const Session &) = delete;
91 Session &operator=(Session &&) = delete;
92
99 PACEMAKER_INCA_EXPORT ~Session();
100
115 auto PACEMAKER_INCA_EXPORT add_param(const std::string &name) -> void;
116
128 auto PACEMAKER_INCA_EXPORT set_param(const std::string &name, double value) -> void;
129
141 auto PACEMAKER_INCA_EXPORT set_param(const std::size_t &idx, double value) -> void;
142
153 auto PACEMAKER_INCA_EXPORT reset() -> void;
154
163 auto PACEMAKER_INCA_EXPORT start_recording() -> void;
164
176 auto PACEMAKER_INCA_EXPORT stop_recording(const std::filesystem::path &filename) -> void;
177
178 private:
179 struct Impl;
180 std::unique_ptr<Impl> pimpl;
181
182 explicit Session(const std::function<std::any(void)> &factory);
183
190 static constexpr std::chrono::milliseconds k_flush_delay{40};
191 };
192} // namespace pacemaker::inca
193#endif // PACEMAKER_INCA_SESSION_HPP_
Top-level session object that owns the connection to a running INCA instance.
Definition Session.hpp:48
Session(Session &&)=delete
Move construction is deleted; the session has a unique identity.
~Session()
Destructor; triggers disconnection from INCA via IncaProxy.
auto add_param(const std::string &name) -> void
Registers a calibration parameter for use during the experiment.
auto start_recording() -> void
Starts a new measurement recording in INCA.
auto set_param(const std::string &name, double value) -> void
Sets a registered calibration parameter to the given value.
Session & operator=(const Session &)=delete
Copying assignment is deleted; the COM connection must not be duplicated.
static auto connect() -> Session
Factory function that connects to a running INCA instance and returns an initialised Session.
auto reset() -> void
Resets all registered parameters to their reference-page values.
auto set_param(const std::size_t &idx, double value) -> void
Sets a registered calibration parameter to the given value.
Session & operator=(Session &&)=delete
Move assignment is deleted; the session has a unique identity.
auto stop_recording(const std::filesystem::path &filename) -> void
Stops the recording, saves the measurement data, and resets all registered parameters.
Session(const Session &)=delete
Copying is deleted; the COM connection must not be duplicated.
static auto connect(const std::function< std::any(void)> &factory) -> Session
Factory function that connects to a running INCA instance and returns an initialised Session.