VPTissue Reference Manual
SimTask.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include <boost/property_tree/xml_parser.hpp>
21 #include "SimTask.h"
22 
23 namespace SimPT_Parex {
24 
25 using boost::property_tree::ptree;
26 
27 SimTask::SimTask(): m_task_id(0)
28 {
29 }
30 
31 SimTask::SimTask(int id, std::string tree, std::string name)
32  : m_task_id(id), m_name(name)
33 {
34  std::stringstream s;
35  s << tree;
36  read_xml(s, m_simulation);
37 }
38 
39 SimTask::SimTask(int id, std::string tree, std::string workspace, std::string name)
40  : m_task_id(id), m_name(name)
41 {
42  std::stringstream s;
43  s << tree;
44  read_xml(s, m_simulation);
45 
46  std::stringstream w;
47  w << workspace;
48  read_xml(w, m_workspace);
49 }
50 
51 SimTask::SimTask(int id, const ptree& simulation, std::string name)
52  : m_task_id(id), m_name(name), m_simulation(simulation)
53 {
54 }
55 
56 SimTask::SimTask(int id, const ptree& simulation, const ptree& workspace, std::string name)
57  : m_task_id(id), m_name(name), m_simulation(simulation), m_workspace(workspace)
58 {
59 }
60 
62  : QObject(), m_task_id(st.m_task_id), m_name(st.m_name), m_simulation(st.m_simulation),
63  m_workspace(st.m_workspace)
64 {
65 }
66 
68 {
69 }
70 
71 std::string SimTask::GetExploration() const
72 {
73  return m_name;
74 }
75 
76 int SimTask::GetId() const
77 {
78  return m_task_id;
79 }
80 
81 boost::property_tree::ptree SimTask::GetWorkspace() const
82 {
83  return m_workspace;
84 }
85 
86 ptree SimTask::ToPtree() const
87 {
88  return m_simulation;
89 }
90 
91 std::string SimTask::ToString() const
92 {
93  std::stringstream s;
94  write_xml(s, m_simulation);
95  return s.str();
96 }
97 
98 std::string SimTask::WorkspaceToString() const
99 {
100  std::stringstream s;
101  write_xml(s, m_workspace);
102  return s.str();
103 }
104 
105 } // namespace
SimTask()
Default constructor.
Definition: SimTask.cpp:27
virtual ~SimTask()
Destructor.
Definition: SimTask.cpp:67
std::string ToString() const
Get the simulation in string representation (ptree xml).
Definition: SimTask.cpp:91
boost::property_tree::ptree ToPtree() const
Returns a pTree representing the SimTask.
Definition: SimTask.cpp:86
std::string WorkspaceToString() const
Get the workspace settings in string representation (ptree xml).
Definition: SimTask.cpp:98
Interface for SimTask.
Namespace for SimPT parameter explorer package.
Definition: Client.cpp:52
std::string GetExploration() const
Get the name of the exploration.
Definition: SimTask.cpp:71
Contains all information needed for a transmitable simulation task.
Definition: SimTask.h:31
int GetId() const
Get the id of the task in the exploration.
Definition: SimTask.cpp:76
see the online Qt documentation
boost::property_tree::ptree GetWorkspace() const
Get the workspace settings in ptree representation.
Definition: SimTask.cpp:81