VPTissue Reference Manual
SimWrapper.h
Go to the documentation of this file.
1 #ifndef SIMWRAPPER_H_INCLUDED
2 #define SIMWRAPPER_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  */
21 #include <string>
22 #include <memory>
23 
24 namespace SimPT_Sim {
25 
26 class Sim;
27 class SimState;
28 
32 enum SimWrapperStatus { SUCCESS, FAILURE };
33 
38 template <typename T>
40  SimWrapperStatus status;
41  std::string message;
42  T value;
43 };
44 
48 template<>
49 struct SimWrapperResult<void> {
50  SimWrapperStatus status;
51  std::string message;
52 };
53 
54 
58 class SimWrapper {
59 public:
60  SimWrapper();
61 
66 
71 
76 
82  SimWrapperResult<void> Initialize(const std::string& path);
83 
89 
90 private:
91  std::shared_ptr<Sim> m_sim;
92 };
93 
94 } // namespace
95 
96 #endif // include guard
Specialization of SimWrapperResult template for type void.
Definition: SimWrapper.h:49
SimWrapperResult< std::string > GetXMLState() const
Provide sim state in XML format serialized to string.
Definition: SimWrapper.cpp:56
Namespace for the core simulator.
SimWrapperResult< void > Initialize(SimState state)
Set sim state.
Definition: SimWrapper.cpp:71
All exceptions must be dealt with internally, so each method returns an object of this type...
Definition: SimWrapper.h:39
Contains the state of the whole Simulator at a given simulation step.
Definition: SimState.h:33
SimWrapperResult< void > TimeStep()
Let simulator take a time step.
Definition: SimWrapper.cpp:101
SimWrapperStatus
Shows whether a time step was a success or not.
Definition: SimWrapper.h:32
Interface exposing the simulator to Java, Python, and C++ programs.
Definition: SimWrapper.h:58
SimWrapperResult< SimState > GetState() const
Provide sim state in format suitable for i/o.
Definition: SimWrapper.cpp:43