OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
SubprocessManager.h
Go to the documentation of this file.
1#pragma once
2
3// Service header
4#include "DataBaseInfo.h"
5
6// OpenTwin header
7#include "OTCore/JSON.h"
9
10// std header
11#include <mutex>
12
13class Application;
16
17namespace std { class thread; }
18
22public:
25
26 void setModelUrl(const std::string& _url);
27 void setFrontendUrl(const std::string& _url);
28 void setDataBaseInfo(const DataBaseInfo& _info);
29
32 bool sendRequest(const ot::JsonDocument& _document, std::string& _response);
33
37 bool sendSingleRequest(const ot::JsonDocument& _document, std::string& _response);
38
39 bool ensureSubprocessRunning(void);
40
43
44private:
45 void shutdownSubprocess(void);
46
49 bool ensureWorkerRunning(void);
50
53 bool isWorkerAlive(void);
54
56 void worker(std::string _projectName);
57
58 std::thread* m_workerThread;
59 std::mutex m_mutex;
60
61 Application* m_app;
62
63 SubprocessHandler* m_subprocessHandler;
64 CommunicationHandler* m_communicationHandler;
65};
This file contains defines that may be used simplyfy class creation.
#define OT_DECL_NODEFAULT(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:22
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
Definition Application.h:25
Definition CommunicationHandler.h:11
Definition DataBaseInfo.h:6
Definition SubprocessHandler.h:18
Definition SubprocessManager.h:19
SubprocessManager(Application *_app)
Definition SubprocessManager.cpp:14
~SubprocessManager()
Definition SubprocessManager.cpp:24
void setModelUrl(const std::string &_url)
Definition SubprocessManager.cpp:39
void stopConnectionHandlingAfterCrash(void)
Stops the connection handler.
Definition SubprocessManager.cpp:112
void setFrontendUrl(const std::string &_url)
Definition SubprocessManager.cpp:52
bool ensureSubprocessRunning(void)
Definition SubprocessManager.cpp:97
void setDataBaseInfo(const DataBaseInfo &_info)
Definition SubprocessManager.cpp:65
bool sendRequest(const ot::JsonDocument &_document, std::string &_response)
Sends the request to the Subprocess. Will start the subprocess if needed.
Definition SubprocessManager.cpp:78
bool sendSingleRequest(const ot::JsonDocument &_document, std::string &_response)
Sends the request to the Subprocess. Will start the subprocess if needed. Will shutdown the subproces...
Definition SubprocessManager.cpp:91
JSON document.
Definition JSON.h:276
STL namespace.