From 74b90aeece8cc8dd7f6e3fb275851e80b8754d7e Mon Sep 17 00:00:00 2001 From: Philip Rauwolf Date: Mon, 17 Jun 2013 13:12:51 +0200 Subject: Extensions for named factories Extended factory creation to support named factories Change-Id: Iab66080a48676512dee44a7dd4001205310103a9 --- src/CommonAPI/Factory.h | 14 ++++++++++++++ src/CommonAPI/Runtime.h | 4 +++- src/CommonAPI/types.h | 31 ++++++++++++++----------------- 3 files changed, 31 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/CommonAPI/Factory.h b/src/CommonAPI/Factory.h index e5d5993..ede8536 100644 --- a/src/CommonAPI/Factory.h +++ b/src/CommonAPI/Factory.h @@ -22,6 +22,7 @@ #include "MiddlewareInfo.h" #include "Proxy.h" #include "Stub.h" +#include "types.h" namespace CommonAPI { @@ -61,6 +62,19 @@ class Factory { middlewareInfo_(middlewareInfo) { } + /** + * \brief Creates factory. Don't call manually. + * + * Creates factory. Don't call manually. + */ + Factory(const std::shared_ptr runtime, + const MiddlewareInfo* middlewareInfo, + const std::string factoryName, + const bool nullOnInvalidName) : + runtime_(runtime), + middlewareInfo_(middlewareInfo) { + } + virtual ~Factory() {} /** diff --git a/src/CommonAPI/Runtime.h b/src/CommonAPI/Runtime.h index 7b666b6..5cf7afa 100644 --- a/src/CommonAPI/Runtime.h +++ b/src/CommonAPI/Runtime.h @@ -90,7 +90,9 @@ class Runtime { * * @return Factory object for this runtime */ - virtual std::shared_ptr createFactory(std::shared_ptr = std::shared_ptr(NULL)) = 0; + virtual std::shared_ptr createFactory(std::shared_ptr = std::shared_ptr(NULL), + const std::string factoryName = "", + const bool nullOnInvalidName = false) = 0; /** * \brief Returns the ServicePublisher object for this runtime. diff --git a/src/CommonAPI/types.h b/src/CommonAPI/types.h index c7fdeb8..ae2836e 100644 --- a/src/CommonAPI/types.h +++ b/src/CommonAPI/types.h @@ -14,7 +14,6 @@ #include - #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) # define COMMONAPI_DEPRECATED __attribute__ ((__deprecated__)) #elif defined(_MSC_VER) && (_MSC_VER >= 1300) @@ -27,33 +26,31 @@ namespace CommonAPI { enum class AvailabilityStatus { - UNKNOWN, - AVAILABLE, - NOT_AVAILABLE + UNKNOWN, + AVAILABLE, + NOT_AVAILABLE }; - enum class CallStatus { - SUCCESS, - OUT_OF_MEMORY, - NOT_AVAILABLE, - CONNECTION_FAILED, - REMOTE_ERROR + SUCCESS, + OUT_OF_MEMORY, + NOT_AVAILABLE, + CONNECTION_FAILED, + REMOTE_ERROR }; struct Version { - Version() = default; + Version() = default; - Version(const uint32_t& majorValue, const uint32_t& minorValue): - Major(majorValue), - Minor(minorValue) { } + Version(const uint32_t& majorValue, const uint32_t& minorValue): + Major(majorValue), + Minor(minorValue) {} - uint32_t Major; - uint32_t Minor; + uint32_t Major; + uint32_t Minor; }; - } // namespace CommonAPI #endif // COMMONAPI_TYPES_H_ -- cgit v1.2.1