Extensions for named factories
authorPhilip Rauwolf <rauwolf@itestra.de>
Mon, 17 Jun 2013 11:12:51 +0000 (13:12 +0200)
committerJohannes Schanda <schanda@itestra.de>
Mon, 17 Jun 2013 12:00:52 +0000 (14:00 +0200)
Extended factory creation to support named factories

Change-Id: Iab66080a48676512dee44a7dd4001205310103a9

src/CommonAPI/Factory.h
src/CommonAPI/Runtime.h
src/CommonAPI/types.h

index e5d5993..ede8536 100644 (file)
@@ -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> runtime,
+            const MiddlewareInfo* middlewareInfo,
+            const std::string factoryName,
+            const bool nullOnInvalidName) :
+                    runtime_(runtime),
+                    middlewareInfo_(middlewareInfo) {
+    }
+
     virtual ~Factory() {}
 
     /**
index 7b666b6..5cf7afa 100644 (file)
@@ -90,7 +90,9 @@ class Runtime {
      *
      * @return Factory object for this runtime
      */
-    virtual std::shared_ptr<Factory> createFactory(std::shared_ptr<MainLoopContext> = std::shared_ptr<MainLoopContext>(NULL)) = 0;
+    virtual std::shared_ptr<Factory> createFactory(std::shared_ptr<MainLoopContext> = std::shared_ptr<MainLoopContext>(NULL),
+                                                   const std::string factoryName = "",
+                                                   const bool nullOnInvalidName = false) = 0;
 
     /**
      * \brief Returns the ServicePublisher object for this runtime.
index c7fdeb8..ae2836e 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <cstdint>
 
-
 #if  __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
 #  define COMMONAPI_DEPRECATED __attribute__ ((__deprecated__))
 #elif defined(_MSC_VER) && (_MSC_VER >= 1300)
 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_