VPTissue Reference Manual
ExplorationTask.h
Go to the documentation of this file.
1 #ifndef SIMPT_PAREX_EXPLORATION_TASK_H_
2 #define SIMPT_PAREX_EXPLORATION_TASK_H_
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  */
22 #include <boost/property_tree/ptree.hpp>
23 #include <QDateTime>
24 
25 namespace SimPT_Parex {
26 
30 enum class TaskState
31 {
32  Waiting,
33  Running,
34  Finished,
35  Cancelled,
36  Failed
37 };
38 
43 {
44 public:
49 
57  ExplorationTask(const boost::property_tree::ptree& pt);
58 
62  virtual ~ExplorationTask();
63 
70  void ChangeState(const TaskState& state);
71 
76  TaskState GetState() const { return m_state; }
77 
81  unsigned int GetNumberOfTries() const { return m_tries; }
82 
88  unsigned int GetRunningTime() const;
89 
93  void IncrementTries();
94 
102  boost::property_tree::ptree ToPtree() const;
103 
104 
105  void setNodeThatContainsResult(const std::string nodeIP, int nodePort) {
106  m_node_ip=nodeIP; m_node_port=nodePort;
107  }
108 
109  std::string getNodeIp() const { return m_node_ip;}
110 
111  int getNodePort() const { return m_node_port; }
112 
113 private:
119  void ReadPtree(const boost::property_tree::ptree& pt);
120 
121 private:
122  TaskState m_state;
123  QDateTime m_start_time;
124  unsigned int m_running_time;
125  unsigned int m_tries;
126 
127  std::string m_node_ip;
128  int m_node_port;
129 };
130 
131 } // namespace
132 
133 #endif // end-of-include-guard
virtual ~ExplorationTask()
Destructor.
TaskState
Enumeration describing the state of a single task of the exploration.
void IncrementTries()
Increment the tries of running the task.
The task is waiting to be sent for the first time.
TaskState GetState() const
Gets the state of the task.
boost::property_tree::ptree ToPtree() const
Convert the task to a ptree.
The task is being executed.
unsigned int GetNumberOfTries() const
Returns the number of tries.
unsigned int GetRunningTime() const
Returns the time the task has run.
ExplorationTask()
Constructs a task in 'Waiting' state.
The task was finished.
void ChangeState(const TaskState &state)
Change the state of the task.
Contains information about task in an exploration.
Namespace for SimPT parameter explorer package.
Definition: Client.cpp:52
The task was cancelled or stopped.