32 using boost::property_tree::ptree;
36 ServerClientProtocol::ServerClientProtocol(QTcpSocket *socket,
QObject *parent)
48 writer.put(
"Exploration.Name", name);
55 writer.put(
"Control.ExplorationNames.size", names.size());
57 for (
auto name : names) {
58 writer.put(
"Control.ExplorationNames.exploration" + to_string(i) +
".name", name);
67 writer.put_child(
"Control.Status.exploration_progress", status.
ToPtree());
74 writer.put(
"Control.Status.name", name);
75 writer.put(
"Control.Status.deleted",
"");
81 if (reader.find(
"parameter_exploration") != reader.not_found()) {
83 exploration->
SetName(exploration->
GetName() + QDateTime::currentDateTime().toString(
"_yyyy_MM_dd_HH_mm_ss_zzz").toStdString());
86 }
else if (reader.find(
"file_exploration") != reader.not_found()) {
88 exploration->
SetName(exploration->
GetName() + QDateTime::currentDateTime().toString(
"_yyyy_MM_dd_HH_mm_ss_zzz").toStdString());
91 }
else if (reader.find(
"Control") != reader.not_found()) {
92 ptree control_pt = reader.get_child(
"Control");
94 if (control_pt.find(
"Subscribe") != control_pt.not_found()) {
95 emit
Subscribe(control_pt.get<std::string>(
"Subscribe"));
96 }
else if (control_pt.find(
"Unsubscribe") != control_pt.not_found()) {
97 emit
Unsubscribe(control_pt.get<std::string>(
"Unsubscribe"));
98 }
else if (control_pt.find(
"Stop") != control_pt.not_found()) {
99 emit
StopTask(control_pt.get<std::string>(
"Stop.name"), control_pt.get<
int>(
"Stop.id"));
100 }
else if (control_pt.find(
"Start") != control_pt.not_found()) {
101 emit
RestartTask(control_pt.get<std::string>(
"Start.name"), control_pt.get<
int>(
"Start.id"));
102 }
else if (control_pt.find(
"Delete") != control_pt.not_found()) {
104 }
else if (control_pt.find(
"RequestExplorations") != control_pt.not_found()) {
void SendStatusDeleted(const std::string &name)
Send a deleted status for the exploration with the specified name.
Base class for the XML/ptree protocols between client, server and node.
Interface for Exploration.
void SetName(const std::string &name)
Changes the name of the exploration.
void Subscribe(const std::string &name)
Emitted when a request for subscription arrives.
virtual void ReceivePtree(const boost::property_tree::ptree &reader)
Receive a ptree message Implementation of Protocol::ReceivePtree.
Class describing a file-based exploration and its simulation tasks.
void SendAck(const std::string &name)
Acknowledgement for sent exploration.
void ExplorationNamesRequested()
Emitted when the names of the explorations are requested.
virtual ~ServerClientProtocol()
Destructor.
Class describing the progress state of an exploration.
boost::property_tree::ptree ToPtree() const
Convert the exploration and progress to a ptree.
void SendExplorationNames(const std::vector< std::string > &names)
Send list of Exploration names.
void SendPtree(const boost::property_tree::ptree &pt)
Sends a ptree over the connection.
Interface for ServerClientProtocol.
const std::string & GetName() const
Returns the name of the exploration.
void DeleteExploration(const std::string &name)
Emitted when a request to stop/delete the given exploration is received.
void StopTask(const std::string &name, int id)
Emitted when a request for stopping a task arrives.
String manipulation utilities.
void ExplorationReceived(const Exploration *exploration)
Emitted when an exploration is received.
Namespace for SimPT parameter explorer package.
void Unsubscribe(const std::string &name)
Emitted when a request for unsubscription arrives.
Class describing a parameter exploration and its simulation tasks.
see the online Qt documentation
Class describing a generic exploration.
void RestartTask(const std::string &name, int id)
Emitted when a request for stopping a task arrives.
Interface for ParameterExploration.
Interface for ExplorationProgress.
void SendStatus(const ExplorationProgress &status)
Send status for given exploration.
Interface for FileExploration.