diff options
author | Disch, Simon <simon_disch@mentor.com> | 2016-03-07 09:44:48 +0100 |
---|---|---|
committer | Disch, Simon <simon_disch@mentor.com> | 2016-03-07 09:45:53 +0100 |
commit | 9345fac016a33c61175e4a06675c20d8590dc201 (patch) | |
tree | 0934ba12e33faf11cd807ec24ba55a4ec78cbe54 /include | |
parent | 274ad1873235b333e1872ac98e7b382553fc7c8f (diff) | |
download | genivi-common-api-runtime-9345fac016a33c61175e4a06675c20d8590dc201.tar.gz |
CommonAPI 3.1.7
Diffstat (limited to 'include')
-rw-r--r-- | include/CommonAPI/Factory.hpp | 2 | ||||
-rw-r--r-- | include/CommonAPI/Logger.hpp | 19 | ||||
-rw-r--r-- | include/CommonAPI/ProxyManager.hpp | 15 | ||||
-rw-r--r-- | include/CommonAPI/Runtime.hpp | 4 |
4 files changed, 33 insertions, 7 deletions
diff --git a/include/CommonAPI/Factory.hpp b/include/CommonAPI/Factory.hpp index 94bb7ec..b0ecdb3 100644 --- a/include/CommonAPI/Factory.hpp +++ b/include/CommonAPI/Factory.hpp @@ -26,6 +26,8 @@ public: virtual ~Factory() {}; + virtual void init() = 0; + virtual std::shared_ptr<Proxy> createProxy(const std::string &_domain, const std::string &_interface, const std::string &_instance, diff --git a/include/CommonAPI/Logger.hpp b/include/CommonAPI/Logger.hpp index 3a5f0b0..71c4d23 100644 --- a/include/CommonAPI/Logger.hpp +++ b/include/CommonAPI/Logger.hpp @@ -18,21 +18,26 @@ #include <CommonAPI/Export.hpp> -#define COMMONAPI_LOGLEVEL_FATAL 0 -#define COMMONAPI_LOGLEVEL_ERROR 1 -#define COMMONAPI_LOGLEVEL_WARNING 2 -#define COMMONAPI_LOGLEVEL_INFO 3 -#define COMMONAPI_LOGLEVEL_DEBUG 4 -#define COMMONAPI_LOGLEVEL_VERBOSE 5 +#define COMMONAPI_LOGLEVEL_NONE 0 +#define COMMONAPI_LOGLEVEL_FATAL 1 +#define COMMONAPI_LOGLEVEL_ERROR 2 +#define COMMONAPI_LOGLEVEL_WARNING 3 +#define COMMONAPI_LOGLEVEL_INFO 4 +#define COMMONAPI_LOGLEVEL_DEBUG 5 +#define COMMONAPI_LOGLEVEL_VERBOSE 6 #ifndef COMMONAPI_LOGLEVEL -#define COMMONAPI_LOGLEVEL COMMONAPI_LOGLEVEL_INFO +#define COMMONAPI_LOGLEVEL COMMONAPI_LOGLEVEL_NONE #endif #ifdef WIN32 +#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_FATAL #define COMMONAPI_FATAL(...) \ do { Logger::log(Logger::Level::LL_FATAL, __VA_ARGS__); } while (false); +#else +#define COMMONAPI_FATAL(...) +#endif #if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_ERROR #define COMMONAPI_ERROR(...) \ diff --git a/include/CommonAPI/ProxyManager.hpp b/include/CommonAPI/ProxyManager.hpp index 52d666c..c68e844 100644 --- a/include/CommonAPI/ProxyManager.hpp +++ b/include/CommonAPI/ProxyManager.hpp @@ -61,11 +61,26 @@ public: return NULL; } + template<template<typename ...> class ProxyClass_, typename ... AttributeExtensions_> + std::shared_ptr<ProxyClass_<AttributeExtensions_...> > + buildProxy(const std::string &_instance, std::shared_ptr<MainLoopContext> _context) { + std::shared_ptr<Proxy> proxy = createProxy(getDomain(), getInterface(), _instance, _context); + if (proxy) { + return std::make_shared<ProxyClass_<AttributeExtensions_...>>(proxy); + } + return NULL; + } + protected: COMMONAPI_EXPORT std::shared_ptr<Proxy> createProxy(const std::string &, const std::string &, const std::string &, const ConnectionId_t &_connection) const; + + COMMONAPI_EXPORT std::shared_ptr<Proxy> createProxy(const std::string &, + const std::string &, + const std::string &, + std::shared_ptr<MainLoopContext> _context) const; }; } // namespace CommonAPI diff --git a/include/CommonAPI/Runtime.hpp b/include/CommonAPI/Runtime.hpp index 09c0d3c..5b9254c 100644 --- a/include/CommonAPI/Runtime.hpp +++ b/include/CommonAPI/Runtime.hpp @@ -138,6 +138,7 @@ public: inline const std::string &getDefaultBinding() const { return defaultBinding_; }; private: + COMMONAPI_EXPORT void initFactories(); COMMONAPI_EXPORT bool readConfiguration(); COMMONAPI_EXPORT bool splitAddress(const std::string &, std::string &, std::string &, std::string &); @@ -180,6 +181,9 @@ private: std::mutex factoriesMutex_; std::mutex loadMutex_; + bool isConfigured_; + bool isInitialized_; + static std::map<std::string, std::string> properties_; static std::shared_ptr<Runtime> theRuntime__; |