Commit 9c2e8ecd authored by legoc's avatar legoc
Browse files

Simplified use of m_impl in Services, Server, This

parent 3e85db72
......@@ -112,7 +112,6 @@ void This::terminate() {
This::This() :
Services(),
m_impl(nullptr),
m_id(-1),
m_managed(false),
m_starterId(0) {
......@@ -120,8 +119,7 @@ This::This() :
void This::initApplication(int argc, char *argv[]) {
m_impl = new ServicesImpl();
Services::setImpl(m_impl);
Services::init();
if (argc == 0) {
throw InvalidArgumentException("missing info argument");
......
......@@ -164,7 +164,6 @@ private:
void stoppingFunction(StopFunctionType stop);
void handleStopImpl(StopFunctionType function);
ServicesImpl * m_impl;
std::string m_name;
int m_id;
bool m_managed;
......
......@@ -32,7 +32,7 @@ namespace cameo {
Server::Server(const std::string& endpoint) :
Services() {
Services::setImpl(new ServicesImpl());
Services::init();
vector<string> tokens = split(endpoint);
......
......@@ -44,8 +44,9 @@ void Services::terminate() {
m_impl.reset();
}
void Services::setImpl(ServicesImpl * impl) {
m_impl.reset(impl);
void Services::init() {
// Set the impl.
m_impl.reset(new ServicesImpl());
}
std::vector<std::string> Services::split(const std::string& info) {
......
......@@ -35,7 +35,7 @@ public:
void terminate();
void setImpl(ServicesImpl * impl);
void init();
std::vector<std::string> split(const std::string& info);
void setTimeout(int timeout);
......@@ -57,6 +57,7 @@ public:
int m_statusPort;
std::string m_serverStatusEndpoint;
std::unique_ptr<ServicesImpl> m_impl;
std::unique_ptr<RequestSocketImpl> m_requestSocket;
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment