pacemaker 1.0.1
COM automation for people with deadlines and a hatred of GUIs
 
Loading...
Searching...
No Matches
Session Class Reference

Top-level session object that owns the connection to a running INCA instance. More...

#include <Session.hpp>

Public Member Functions

 Session (const Session &)=delete
 Copying is deleted; the COM connection must not be duplicated.
 
Sessionoperator= (const Session &)=delete
 Copying assignment is deleted; the COM connection must not be duplicated.
 
 Session (Session &&)=delete
 Move construction is deleted; the session has a unique identity.
 
Sessionoperator= (Session &&)=delete
 Move assignment is deleted; the session has a unique identity.
 
 ~Session ()
 Destructor; triggers disconnection from INCA via IncaProxy.
 
auto experiment () noexcept -> Experiment &
 Returns a reference to the owned Experiment.
 

Static Public Member Functions

static auto connect () -> Session
 Factory function that connects to a running INCA instance and returns an initialised Session.
 

Detailed Description

Top-level session object that owns the connection to a running INCA instance.

Session is the single entry point for the pacemaker library. It establishes a COM connection to a locally running INCA process, validates that an experiment is open and at least one device is online, and constructs the Experiment object through which the measurement run is controlled.

Typical usage

CoInitialize(NULL);
auto &exp = session.experiment();
exp.add_param("Engine_TorqueRequest");
exp.start_recording();
exp.set_param("Engine_TorqueRequest", 120.0);
exp.stop_recording("run_001.mf4");
CoUninitialize();
static auto connect() -> Session
Factory function that connects to a running INCA instance and returns an initialised Session.

Lifetime and thread safety

The session is non-copyable and non-movable. Exactly one Session should exist per INCA automation connection. COM must be initialised on the calling thread before connect() is invoked.

On destruction, IncaProxy's destructor calls DisconnectFromTool() so INCA is cleanly notified of the disconnection.

Note
Platform: Windows only. INCA must be installed and runnign.
See also
pacemaker::inca::Experiment
pacemaker::inca::com::IncaProxy

Definition at line 44 of file Session.hpp.

Constructor & Destructor Documentation

◆ Session() [1/2]

Session ( const Session & )
delete

Copying is deleted; the COM connection must not be duplicated.

◆ Session() [2/2]

Session ( Session && )
delete

Move construction is deleted; the session has a unique identity.

◆ ~Session()

~Session ( )

Destructor; triggers disconnection from INCA via IncaProxy.

The IncaProxy member is destroyed first (in reverse declaration order), which calls DisconnectFromTool() on the INCA COM object. The destructor is explicitly defined (rather than defaulted in the header) to ensure this sequencing is correct across translation units.

Member Function Documentation

◆ connect()

static auto connect ( ) -> Session
staticnodiscard

Factory function that connects to a running INCA instance and returns an initialised Session.

The function performs the following steps:

  1. Calls CoCreateInstance(CLSID_Inca, CLSCTX_LOCAL_SERVER) to obtain the root INCA COM object.
  2. Retrieves the open experiment and experiment-view objects via IncaProxy.
  3. Enumerates connected devices; selects the first available device.
  4. Constructs and returns a Session owning an IncaProxy and the fully initialised Experiment.
Returns
A fully constructed Session ready for use.
Exceptions
std::runtime_errorif CoCreateInstance fails (INCA not installed or not running).
std::runtime_errorif the open experiment has no devices configured or online.
Precondition
COM must be initialised on the calling thread (e.g. CoInitializeEx)

◆ operator=() [1/2]

Session & operator= ( const Session & )
delete

Copying assignment is deleted; the COM connection must not be duplicated.

◆ operator=() [2/2]

Session & operator= ( Session && )
delete

Move assignment is deleted; the session has a unique identity.

◆ experiment()

auto experiment ( ) -> Experiment &
inlinenodiscardnoexcept

Returns a reference to the owned Experiment.

The reference is valid for the lifetime of the Session. Use it to register parameters, control recordings, and update calibration values.

Returns
Non-const reference to the session's Experiment object.

Definition at line 91 of file Session.hpp.


The documentation for this class was generated from the following file: