Reorganise to remove redundant folder
[profile/ivi/common-api-dbus-runtime.git] / src / CommonAPI / DBus / DBusRuntime.cpp
1 /* This Source Code Form is subject to the terms of the Mozilla Public\r
2  * License, v. 2.0. If a copy of the MPL was not distributed with this\r
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
4 #include "DBusRuntime.h"\r
5 \r
6 namespace CommonAPI {\r
7 namespace DBus {\r
8 \r
9 const MiddlewareInfo DBusRuntime::middlewareInfo_("DBus", &DBusRuntime::getInstance);\r
10 \r
11 __attribute__((constructor)) void registerDBusMiddleware(void) {\r
12     Runtime::registerRuntimeLoader("DBus", &DBusRuntime::getInstance);\r
13 }\r
14 \r
15 std::shared_ptr<Runtime> DBusRuntime::getInstance() {\r
16     static std::shared_ptr<Runtime> singleton_;\r
17     if(!singleton_) {\r
18         singleton_ = std::make_shared<DBusRuntime>();\r
19     }\r
20     return singleton_;\r
21 }\r
22 \r
23 std::shared_ptr<Factory> DBusRuntime::createFactory() {\r
24     auto factory = std::make_shared<DBusFactory>(this->shared_from_this(), &middlewareInfo_);\r
25     return factory;\r
26 }\r
27 \r
28 } // namespace DBus\r
29 } // namespace CommonAPI\r