VPTissue Reference Manual
|
Generic session interface. More...
#include <ISession.h>
Classes | |
struct | ExporterType |
Public Types | |
using | ExportCallbackType = std::function< void(const std::string &)> |
using | ExportersType = std::vector< std::pair< std::string, ExporterType >> |
enum | InfoMessageReason { Stepped, Started, Stopped, Terminated } |
Enumeration for the reason of an emitted InfoMessage from the project. | |
using | RootViewerType = Viewer::IViewerNode |
Public Types inherited from SimPT_Sim::ClockMan::Timeable<> | |
using | Timings = typename ClockTraits< std::chrono::system_clock, typename std::chrono::system_clock::duration >::CumulativeTimings |
Public Types inherited from SimPT_Sim::ClockMan::ClockTraits< std::chrono::system_clock, typename std::chrono::system_clock::duration > | |
using | Clock = std::chrono::system_clock |
Type for clock. | |
using | CumulativeTimings = SimPT_Sim::ClockMan::CumulativeRecords< typename std::chrono::system_clock::duration > |
Records with cumulative timing info. | |
using | Duration = typename std::chrono::system_clock::duration |
Type for time duration units. | |
using | IndividualTimings = SimPT_Sim::ClockMan::IndividualRecords< typename std::chrono::system_clock::duration > |
Records with individual timing info. | |
using | Stopclock = SimPT_Sim::ClockMan::Stopwatch< std::chrono::system_clock > |
Stopwatch to measure time durations. | |
Signals | |
void | ErrorMessage (const std::string &error) |
Emitted when an error in a time step occurred (Multithreading cannot return bool directly in ProjectBase::TimeStep(), as the computation is queued for another thread) More... | |
void | InfoMessage (const std::string &message, const InfoMessageReason &reason) |
Emitted when an event with an accompanying info message has been done/occurred (Multithreading cannot return bool directly in ProjectBase::TimeStep(), as the computation is queued for another thread) More... | |
Public Member Functions | |
virtual | ~ISession () |
Virtual destructor for interface class. | |
virtual std::shared_ptr< RootViewerType > | CreateRootViewer (Gui::Controller::AppController *parent=nullptr)=0 |
Return root viewer, i.e. More... | |
virtual void | ForceExport ()=0 |
Force enabled viewers to export. More... | |
virtual ExportersType | GetExporters ()=0 |
Return list of callbacks for exporting simulation state to a file. | |
virtual const boost::property_tree::ptree & | GetParameters () const =0 |
Get simulation parameters. More... | |
virtual void | SetParameters (const boost::property_tree::ptree &)=0 |
Set simulation parameters. | |
virtual void | StartSimulation (int steps=-1)=0 |
Starts doing time steps until termination or until stopped. More... | |
virtual void | StopSimulation ()=0 |
Stops taking simulation time steps. | |
virtual void | TimeStep ()=0 |
Perform 1 simulation step, bringing simulation into the "next" state. More... | |
Public Member Functions inherited from SimPT_Sim::ClockMan::Timeable<> | |
virtual | ~Timeable () |
Destructor virtual for polymorphic class. | |
virtual Timings | GetTimings () const =0 |
Timings in duration units specified above. | |
Generic session interface.
A session is a collection of instances associated with an opened/running project.
As this interface is designed to also be implemented by an asynchronously running simulation inside a project, take care to also use it like that. This is why, for example, there a signals for info and errors, rather than return values/getters for the information.
Definition at line 53 of file ISession.h.
|
pure virtual |
Return root viewer, i.e.
the viewer that owns all other viewers.
Implemented in SimPT_Shell::Session::SimSession, and SimPT_Shell::Session::SimSessionCoupled.
|
signal |
Emitted when an error in a time step occurred (Multithreading cannot return bool directly in ProjectBase::TimeStep(), as the computation is queued for another thread)
error | The error message |
|
pure virtual |
Force enabled viewers to export.
This is useful when e.g. parameters or preferences are changed and we need a "checkpoint" in simulation history for this event.
Implemented in SimPT_Shell::Session::SimSession, and SimPT_Shell::Session::SimSessionCoupled.
|
pure virtual |
Get simulation parameters.
Implemented in SimPT_Shell::Session::SimSession, and SimPT_Shell::Session::SimSessionCoupled.
|
signal |
Emitted when an event with an accompanying info message has been done/occurred (Multithreading cannot return bool directly in ProjectBase::TimeStep(), as the computation is queued for another thread)
message | The simulation info message |
reason | The reason why an info message was emitted |
Referenced by SimPT_Shell::Session::SimSessionCoupled::StartSimulation(), and SimPT_Shell::Session::SimSessionCoupled::StopSimulation().
|
pure virtual |
Starts doing time steps until termination or until stopped.
steps | The maximum number of steps to simulate (-1 for unlimited) The previous number of steps is overwritten by this |
Implemented in SimPT_Shell::Session::SimSession, and SimPT_Shell::Session::SimSessionCoupled.
|
pure virtual |
Perform 1 simulation step, bringing simulation into the "next" state.
This method cannot return a result, as the time step may be performed in another thread. Instead, an InfoMessage or ErrorMessage signal will be emitted.
Exception | if no time step could be performed due to other reasons. |