VPTissue Reference Manual
ISession.h
Go to the documentation of this file.
1 #ifndef ISESSION_H_INCLUDED
2 #define ISESSION_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
23 #include "viewer/IViewerNode.h"
24 
25 #include <boost/property_tree/ptree.hpp>
26 #include <QObject>
27 #include <QMetaType>
28 
29 #include <functional>
30 #include <string>
31 #include <utility>
32 #include <vector>
33 
34 class QAction;
35 class QWidget;
36 Q_DECLARE_METATYPE(std::string)
37 
38 namespace SimShell {
39 
40 namespace Gui {namespace Controller {class AppController;}}
41 
42 namespace Session {
43 
54 {
55  Q_OBJECT
56 public:
57  using ExportCallbackType = std::function<void(const std::string&)>;
58  struct ExporterType {
59  std::string extension;
60  ExportCallbackType callback;
61  };
62  using ExportersType = std::vector<std::pair<std::string, ExporterType>>;
63 
65 
66 public:
70  virtual ~ISession() {}
71 
75  virtual std::shared_ptr<RootViewerType>
76  CreateRootViewer(Gui::Controller::AppController* parent = nullptr) = 0;
77 
83  virtual void ForceExport() = 0;
84 
88  virtual ExportersType GetExporters() = 0;
89 
96  virtual const boost::property_tree::ptree& GetParameters() const = 0;
97 
101  virtual void SetParameters(const boost::property_tree::ptree&) = 0;
102 
108  virtual void StartSimulation(int steps = -1) = 0;
109 
113  virtual void StopSimulation() = 0;
114 
121  virtual void TimeStep() = 0;
122 
126  enum class InfoMessageReason {
127  Stepped, // A time step was done
128  Started, // The simulation has been started
129  Stopped, // The simulation has been stopped
130  Terminated // The simulation terminated (because of the termination condition)
131  };
132 
133 signals:
142  void InfoMessage(const std::string &message, const InfoMessageReason &reason);
143 
151  void ErrorMessage(const std::string &error);
152 };
153 
154 } // namespace
155 } // namespace
156 
157 #endif // end_of_inclde_guard
Interface for a node in a hierarchical tree of viewers.
Definition: IViewerNode.h:31
InfoMessageReason
Enumeration for the reason of an emitted InfoMessage from the project.
Definition: ISession.h:126
Interface for Timeable.
virtual ~ISession()
Virtual destructor for interface class.
Definition: ISession.h:70
see the online Qt documentation
see the online Qt documentation
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32
Interface for IViewerNode.
Generic session interface.
Definition: ISession.h:53
Utility class to for timing.
Definition: Timeable.h:38