pacemaker 3.0.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 <chrono>
5#include <filesystem>
6#include <functional>
7#include <memory>
8#include <string>
9
10struct ::IDispatch;
11
13{
45 class Session
46 {
47 public:
62 [[nodiscard]] static auto connect(const std::function<IDispatch *(void)> &factory) -> Session;
63
80 [[nodiscard]] static auto connect() -> Session;
81
83 Session(const Session &) = delete;
85 Session(Session &&) = delete;
87 Session &operator=(const Session &) = delete;
89 Session &operator=(Session &&) = delete;
90
98
113 auto add_param(const std::string &name) -> void;
114
126 auto set_param(const std::string &name, double value) -> void;
127
138 auto reset() -> void;
139
148 auto start_recording() -> void;
149
161 auto stop_recording(const std::filesystem::path &filename) -> void;
162
163 private:
164 struct Impl;
165 std::unique_ptr<Impl> pimpl;
166
167 explicit Session(const std::function<IDispatch *(void)> &factory);
168
175 static constexpr std::chrono::milliseconds k_flush_delay{40};
176 };
177} // namespace pacemaker::inca
178#endif // PACEMAKER_INCA_SESSION_HPP_
Top-level session object that owns the connection to a running INCA instance.
Definition Session.hpp:46
Session(Session &&)=delete
Move construction is deleted; the session has a unique identity.
~Session()
Destructor; triggers disconnection from INCA via IncaProxy.
static auto connect(const std::function< IDispatch *(void)> &factory) -> Session
Factory function that connects to a running INCA instance and returns an initialised Session.
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 and clears the internal parameter tab...
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.