summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Huss <dirk_huss@mentor.com>2015-11-25 14:38:28 +0100
committerDirk Huss <dirk_huss@mentor.com>2015-11-25 14:38:28 +0100
commitb6f81b22fcf8d9cf8ee9248408b7d2a72fbff1d9 (patch)
tree8b0b1438ccaa9450ca4b21221eb9cd74f14b10f5
parent3d2fb21d0e93b6b595610285e910ac80c099a174 (diff)
downloadgenivi-common-api-runtime-b6f81b22fcf8d9cf8ee9248408b7d2a72fbff1d9.tar.gz
CommonAPI 3.1.4
-rw-r--r--CMakeLists.txt22
-rw-r--r--CommonAPI.pc.in11
-rw-r--r--README2
-rw-r--r--include/CommonAPI/Address.hpp44
-rw-r--r--include/CommonAPI/Attribute.hpp102
-rw-r--r--include/CommonAPI/AttributeExtension.hpp16
-rw-r--r--include/CommonAPI/CallInfo.hpp22
-rw-r--r--include/CommonAPI/Deployable.hpp36
-rw-r--r--include/CommonAPI/Deployment.hpp40
-rw-r--r--include/CommonAPI/Enumeration.hpp62
-rw-r--r--include/CommonAPI/Event.hpp122
-rw-r--r--include/CommonAPI/Export.hpp16
-rw-r--r--include/CommonAPI/Extensions/AttributeCacheExtension.hpp95
-rw-r--r--include/CommonAPI/Factory.hpp50
-rw-r--r--include/CommonAPI/IniFileReader.hpp24
-rw-r--r--include/CommonAPI/InputStream.hpp248
-rw-r--r--include/CommonAPI/Logger.hpp126
-rw-r--r--include/CommonAPI/MainLoopContext.hpp58
-rw-r--r--include/CommonAPI/OutputStream.hpp226
-rw-r--r--include/CommonAPI/Proxy.hpp14
-rw-r--r--include/CommonAPI/ProxyManager.hpp16
-rw-r--r--include/CommonAPI/Runtime.hpp52
-rw-r--r--include/CommonAPI/SelectiveEvent.hpp8
-rw-r--r--include/CommonAPI/SerializableArguments.hpp32
-rw-r--r--include/CommonAPI/Struct.hpp248
-rw-r--r--include/CommonAPI/Stub.hpp14
-rw-r--r--include/CommonAPI/TypeOutputStream.hpp265
-rw-r--r--include/CommonAPI/Types.hpp38
-rw-r--r--include/CommonAPI/Variant.hpp554
-rw-r--r--include/CommonAPI/Version.hpp2
-rw-r--r--src/CommonAPI/Address.cpp90
-rw-r--r--src/CommonAPI/IniFileReader.cpp146
-rw-r--r--src/CommonAPI/Logger.cpp138
-rw-r--r--src/CommonAPI/MainLoopContext.cpp2
-rw-r--r--src/CommonAPI/Proxy.cpp2
-rw-r--r--src/CommonAPI/ProxyManager.cpp6
-rw-r--r--src/CommonAPI/Runtime.cpp42
-rw-r--r--src/CommonAPI/Utils.cpp18
38 files changed, 1579 insertions, 1430 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52eac34..7b212df 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,7 @@ PROJECT(libcommonapi)
# version of CommonAPI
SET( LIBCOMMONAPI_MAJOR_VERSION 3 )
SET( LIBCOMMONAPI_MINOR_VERSION 1 )
-SET( LIBCOMMONAPI_PATCH_VERSION 3 )
+SET( LIBCOMMONAPI_PATCH_VERSION 4 )
message(STATUS "Project name: ${PROJECT_NAME}")
@@ -23,7 +23,7 @@ message(STATUS "This is CMake for Common API C++ Version ${COMPONENT_VERSION}.")
# OS
set(DL_LIBRARY "")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
- set(DL_LIBRARY "dl")
+ set(DL_LIBRARY "dl")
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
##############################################################################
@@ -79,11 +79,11 @@ message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# CommonAPI build section
IF(MSVC)
- message("using MSVC Compiler")
- add_definitions(-DCOMMONAPI_INTERNAL_COMPILATION)
- add_compile_options(/EHsc /wd"4996")
+ message("using MSVC Compiler")
+ add_definitions(-DCOMMONAPI_INTERNAL_COMPILATION)
+ add_compile_options(/EHsc /wd"4996")
ELSE ()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -DCOMMONAPI_INTERNAL_COMPILATION -DUSE_CONSOLE")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector -fasynchronous-unwind-tables -fno-omit-frame-pointer -Werror -DCOMMONAPI_INTERNAL_COMPILATION -DUSE_CONSOLE")
ENDIF(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_LOGLEVEL=COMMONAPI_LOGLEVEL_${MAX_LOG_LEVEL}")
@@ -102,7 +102,7 @@ include_directories(
)
link_directories(
- ${DLT_LIBDIR}
+ ${DLT_LIBDIR}
)
file(GLOB CAPI_SRCS "src/CommonAPI/*.cpp")
@@ -226,3 +226,11 @@ else()
endif()
##############################################################################
+# create pkg-config file
+if(NOT WIN32 AND PKG_CONFIG_FOUND)
+ configure_file(CommonAPI.pc.in ${PROJECT_BINARY_DIR}/CommonAPI.pc @ONLY)
+ install(FILES ${PROJECT_BINARY_DIR}/CommonAPI.pc DESTINATION lib/pkconfig)
+endif()
+
+##############################################################################
+
diff --git a/CommonAPI.pc.in b/CommonAPI.pc.in
new file mode 100644
index 0000000..2436e3f
--- /dev/null
+++ b/CommonAPI.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@CMAKE_INSTALL_PREFIX@/@INSTALL_LIB_DIR@
+includedir=@CMAKE_INSTALL_PREFIX@/include
+
+Name: @PROJECT@
+Description: GENIVI Common API C++ Library
+Version: @COMPONENT_VERSION@
+Libs: -L${libdir} -lCommonAPI
+Cflags: -I${includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@
+
diff --git a/README b/README
index 3527542..02f1a3b 100644
--- a/README
+++ b/README
@@ -1,3 +1,3 @@
-This is CommonAPI 3.1.3
+This is CommonAPI 3.1.4
Please refer to INSTALL for further information. \ No newline at end of file
diff --git a/include/CommonAPI/Address.hpp b/include/CommonAPI/Address.hpp
index 0826a8f..74a13d4 100644
--- a/include/CommonAPI/Address.hpp
+++ b/include/CommonAPI/Address.hpp
@@ -15,36 +15,36 @@ namespace CommonAPI {
class Address {
public:
- COMMONAPI_EXPORT Address() = default;
- COMMONAPI_EXPORT Address(const std::string &_address);
- COMMONAPI_EXPORT Address(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance);
- COMMONAPI_EXPORT Address(const Address &_source);
- COMMONAPI_EXPORT virtual ~Address();
+ COMMONAPI_EXPORT Address() = default;
+ COMMONAPI_EXPORT Address(const std::string &_address);
+ COMMONAPI_EXPORT Address(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance);
+ COMMONAPI_EXPORT Address(const Address &_source);
+ COMMONAPI_EXPORT virtual ~Address();
- COMMONAPI_EXPORT bool operator==(const Address &_other) const;
- COMMONAPI_EXPORT bool operator!=(const Address &_other) const;
- COMMONAPI_EXPORT bool operator<(const Address &_other) const;
+ COMMONAPI_EXPORT bool operator==(const Address &_other) const;
+ COMMONAPI_EXPORT bool operator!=(const Address &_other) const;
+ COMMONAPI_EXPORT bool operator<(const Address &_other) const;
- COMMONAPI_EXPORT std::string getAddress() const;
- COMMONAPI_EXPORT void setAddress(const std::string &_address);
+ COMMONAPI_EXPORT std::string getAddress() const;
+ COMMONAPI_EXPORT void setAddress(const std::string &_address);
- COMMONAPI_EXPORT const std::string &getDomain() const;
- COMMONAPI_EXPORT void setDomain(const std::string &_domain);
+ COMMONAPI_EXPORT const std::string &getDomain() const;
+ COMMONAPI_EXPORT void setDomain(const std::string &_domain);
- COMMONAPI_EXPORT const std::string &getInterface() const;
- COMMONAPI_EXPORT void setInterface(const std::string &_interface);
+ COMMONAPI_EXPORT const std::string &getInterface() const;
+ COMMONAPI_EXPORT void setInterface(const std::string &_interface);
- COMMONAPI_EXPORT const std::string &getInstance() const;
- COMMONAPI_EXPORT void setInstance(const std::string &_instance);
+ COMMONAPI_EXPORT const std::string &getInstance() const;
+ COMMONAPI_EXPORT void setInstance(const std::string &_instance);
private:
- std::string domain_;
- std::string interface_;
- std::string instance_;
+ std::string domain_;
+ std::string interface_;
+ std::string instance_;
- friend COMMONAPI_EXPORT std::ostream &operator<<(std::ostream &_out, const Address &_address);
+ friend COMMONAPI_EXPORT std::ostream &operator<<(std::ostream &_out, const Address &_address);
};
} // namespace CommonAPI
diff --git a/include/CommonAPI/Attribute.hpp b/include/CommonAPI/Attribute.hpp
index 200d3bb..5d7a531 100644
--- a/include/CommonAPI/Attribute.hpp
+++ b/include/CommonAPI/Attribute.hpp
@@ -26,28 +26,28 @@ namespace CommonAPI {
*
* Class representing a read only attribute
*/
-template <typename _ValueType>
+template <typename ValueType_>
class ReadonlyAttribute {
public:
- typedef _ValueType ValueType;
+ typedef ValueType_ ValueType;
- typedef std::function<void(const CallStatus &, _ValueType)> AttributeAsyncCallback;
+ typedef std::function<void(const CallStatus &, ValueType_)> AttributeAsyncCallback;
- virtual ~ReadonlyAttribute() { }
+ virtual ~ReadonlyAttribute() { }
- /**
- * \brief Get value of attribute, usually from remote. Synchronous call.
- *
- * Get value of attribute, usually from remote. Synchronous call.
- *
- * @param value Reference to be filled with value.
- * @param callStatus call status reference will be filled with status of the operation
- */
- virtual void getValue(CallStatus &_status,
- _ValueType &_value,
- const CallInfo *_info = nullptr) const = 0;
+ /**
+ * \brief Get value of attribute, usually from remote. Synchronous call.
+ *
+ * Get value of attribute, usually from remote. Synchronous call.
+ *
+ * @param value Reference to be filled with value.
+ * @param callStatus call status reference will be filled with status of the operation
+ */
+ virtual void getValue(CallStatus &_status,
+ ValueType_ &_value,
+ const CallInfo *_info = nullptr) const = 0;
- /**
+ /**
* \brief Get value of attribute, usually from remote. Asynchronous call.
*
* Get value of attribute, usually from remote. Asynchronous call.
@@ -55,8 +55,8 @@ class ReadonlyAttribute {
* @param attributeAsyncCallback std::function object for the callback to be invoked.
* @return std::future containing the call status of the operation.
*/
- virtual std::future<CallStatus> getValueAsync(AttributeAsyncCallback attributeAsyncCallback,
- const CallInfo *_info = nullptr) = 0;
+ virtual std::future<CallStatus> getValueAsync(AttributeAsyncCallback attributeAsyncCallback,
+ const CallInfo *_info = nullptr) = 0;
};
/**
@@ -64,13 +64,13 @@ class ReadonlyAttribute {
*
* Class representing a read and writable attribute
*/
-template <typename _ValueType>
-class Attribute: public ReadonlyAttribute<_ValueType> {
+template <typename ValueType_>
+class Attribute: public ReadonlyAttribute<ValueType_> {
public:
- typedef typename ReadonlyAttribute<_ValueType>::ValueType ValueType;
- typedef typename ReadonlyAttribute<_ValueType>::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename ReadonlyAttribute<ValueType_>::ValueType ValueType;
+ typedef typename ReadonlyAttribute<ValueType_>::AttributeAsyncCallback AttributeAsyncCallback;
- virtual ~Attribute() { }
+ virtual ~Attribute() { }
/**
* \brief Set value of attribute, usually to remote. Synchronous call.
@@ -81,12 +81,12 @@ class Attribute: public ReadonlyAttribute<_ValueType> {
* @param callStatus call status reference will be filled with status of the operation
* @param responseValue Reference which will contain the actuall value set by the remote.
*/
- virtual void setValue(const _ValueType& requestValue,
- CallStatus& callStatus,
- _ValueType& responseValue,
- const CallInfo *_info = nullptr) = 0;
+ virtual void setValue(const ValueType_& requestValue,
+ CallStatus& callStatus,
+ ValueType_& responseValue,
+ const CallInfo *_info = nullptr) = 0;
- /**
+ /**
* \brief Set value of attribute, usually to remote. Asynchronous call.
*
* Set value of attribute, usually to remote. Asynchronous call.
@@ -95,9 +95,9 @@ class Attribute: public ReadonlyAttribute<_ValueType> {
* @param attributeAsyncCallback std::function object for the callback to be invoked.
* @return std::future containing the call status of the operation.
*/
- virtual std::future<CallStatus> setValueAsync(const _ValueType& requestValue,
- AttributeAsyncCallback attributeAsyncCallback,
- const CallInfo *_info = nullptr) = 0;
+ virtual std::future<CallStatus> setValueAsync(const ValueType_& requestValue,
+ AttributeAsyncCallback attributeAsyncCallback,
+ const CallInfo *_info = nullptr) = 0;
};
/**
@@ -105,31 +105,31 @@ class Attribute: public ReadonlyAttribute<_ValueType> {
*
* Class representing an observable attribute
*/
-template <typename _AttributeBaseClass>
-class _ObservableAttributeImpl: public _AttributeBaseClass {
+template <typename AttributeBaseClass_>
+class ObservableAttributeImpl: public AttributeBaseClass_ {
public:
- typedef typename _AttributeBaseClass::ValueType ValueType;
- typedef typename _AttributeBaseClass::AttributeAsyncCallback AttributeAsyncCallback;
- typedef Event<ValueType> ChangedEvent;
-
- virtual ~_ObservableAttributeImpl() { }
-
- /**
- * \brief Returns the event handler for the remote change notification event
- *
- * Returns the event handler for the remote change notification event
- *
- * @return The event handler object
- */
- virtual ChangedEvent& getChangedEvent() = 0;
+ typedef typename AttributeBaseClass_::ValueType ValueType;
+ typedef typename AttributeBaseClass_::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef Event<ValueType> ChangedEvent;
+
+ virtual ~ObservableAttributeImpl() { }
+
+ /**
+ * \brief Returns the event handler for the remote change notification event
+ *
+ * Returns the event handler for the remote change notification event
+ *
+ * @return The event handler object
+ */
+ virtual ChangedEvent& getChangedEvent() = 0;
};
-template <typename _ValueType>
-struct ObservableReadonlyAttribute: _ObservableAttributeImpl< ReadonlyAttribute<_ValueType> > {
+template <typename ValueType_>
+struct ObservableReadonlyAttribute: ObservableAttributeImpl< ReadonlyAttribute<ValueType_> > {
};
-template <typename _ValueType>
-struct ObservableAttribute: _ObservableAttributeImpl< Attribute<_ValueType> > {
+template <typename ValueType_>
+struct ObservableAttribute: ObservableAttributeImpl< Attribute<ValueType_> > {
};
#ifdef WIN32
diff --git a/include/CommonAPI/AttributeExtension.hpp b/include/CommonAPI/AttributeExtension.hpp
index cc26723..b878eb1 100644
--- a/include/CommonAPI/AttributeExtension.hpp
+++ b/include/CommonAPI/AttributeExtension.hpp
@@ -19,29 +19,29 @@
namespace CommonAPI {
-template<typename _AttributeType>
+template<typename AttributeType_>
class AttributeExtension {
public:
- _AttributeType& getBaseAttribute() {
+ AttributeType_& getBaseAttribute() {
return baseAttribute_;
}
protected:
AttributeExtension() = delete;
- AttributeExtension(_AttributeType& baseAttribute): baseAttribute_(baseAttribute) {
+ AttributeExtension(AttributeType_& baseAttribute): baseAttribute_(baseAttribute) {
}
- _AttributeType& baseAttribute_;
+ AttributeType_& baseAttribute_;
};
-template<template<typename ...> class _ProxyType, template<typename> class _AttributeExtension>
+template<template<typename ...> class ProxyType_, template<typename> class AttributeExtension_>
struct DefaultAttributeProxyHelper;
-template<template<typename ...> class _ProxyClass, template<typename> class _AttributeExtension>
+template<template<typename ...> class ProxyClass_, template<typename> class AttributeExtension_>
std::shared_ptr<
- typename DefaultAttributeProxyHelper<_ProxyClass, _AttributeExtension>::class_t
+ typename DefaultAttributeProxyHelper<ProxyClass_, AttributeExtension_>::class_t
> createProxyWithDefaultAttributeExtension(
- const std::string &_domain, const std::string &_instance);
+ const std::string &_domain, const std::string &_instance);
} // namespace CommonAPI
diff --git a/include/CommonAPI/CallInfo.hpp b/include/CommonAPI/CallInfo.hpp
index a6f43bd..53a43e9 100644
--- a/include/CommonAPI/CallInfo.hpp
+++ b/include/CommonAPI/CallInfo.hpp
@@ -12,18 +12,18 @@
namespace CommonAPI {
struct COMMONAPI_EXPORT CallInfo {
- CallInfo()
- : timeout_(DEFAULT_SEND_TIMEOUT_MS), sender_(0) {
- }
- CallInfo(Timeout_t _timeout)
- : timeout_(_timeout), sender_(0) {
- }
- CallInfo(Timeout_t _timeout, Sender_t _sender)
- : timeout_(_timeout), sender_(_sender) {
- }
+ CallInfo()
+ : timeout_(DEFAULT_SEND_TIMEOUT_MS), sender_(0) {
+ }
+ CallInfo(Timeout_t _timeout)
+ : timeout_(_timeout), sender_(0) {
+ }
+ CallInfo(Timeout_t _timeout, Sender_t _sender)
+ : timeout_(_timeout), sender_(_sender) {
+ }
- Timeout_t timeout_;
- Sender_t sender_;
+ Timeout_t timeout_;
+ Sender_t sender_;
};
} // namespace CommonAPI
diff --git a/include/CommonAPI/Deployable.hpp b/include/CommonAPI/Deployable.hpp
index 7a9002c..4b4b901 100644
--- a/include/CommonAPI/Deployable.hpp
+++ b/include/CommonAPI/Deployable.hpp
@@ -15,43 +15,43 @@ namespace CommonAPI {
struct DeployableBase {
};
-template<typename _Type, typename _TypeDepl>
+template<typename Type_, typename TypeDepl_>
struct Deployable : DeployableBase
{
- Deployable(const _TypeDepl *_depl = nullptr)
- : depl_(const_cast<_TypeDepl *>(_depl)) {
- }
+ Deployable(const TypeDepl_ *_depl = nullptr)
+ : depl_(const_cast<TypeDepl_ *>(_depl)) {
+ }
- Deployable(const _Type &_value, const _TypeDepl *_depl)
- : value_(_value),
- depl_(const_cast<_TypeDepl *>(_depl)) {
+ Deployable(const Type_ &_value, const TypeDepl_ *_depl)
+ : value_(_value),
+ depl_(const_cast<TypeDepl_ *>(_depl)) {
};
- Deployable<_Type, _TypeDepl>& operator=(const Deployable<_Type, _TypeDepl> &_source) {
+ Deployable<Type_, TypeDepl_>& operator=(const Deployable<Type_, TypeDepl_> &_source) {
value_ = _source.value_;
depl_ = _source.depl_;
return (*this);
}
- operator _Type() const {
- return value_;
+ operator Type_() const {
+ return value_;
}
- const _Type &getValue() const {
- return value_;
+ const Type_ &getValue() const {
+ return value_;
}
- _Type &getValue() {
+ Type_ &getValue() {
return value_;
}
- const _TypeDepl *getDepl() const {
- return depl_;
- }
+ const TypeDepl_ *getDepl() const {
+ return depl_;
+ }
protected:
- _Type value_;
- _TypeDepl *depl_;
+ Type_ value_;
+ TypeDepl_ *depl_;
};
} // namespace CommonAPI
diff --git a/include/CommonAPI/Deployment.hpp b/include/CommonAPI/Deployment.hpp
index db2a914..98a99a9 100644
--- a/include/CommonAPI/Deployment.hpp
+++ b/include/CommonAPI/Deployment.hpp
@@ -17,21 +17,21 @@ namespace CommonAPI {
// defined like this:
//
// struct BindingUInt16Deployment : CommonAPI::Deployment<> {
-// // Binding-specific bool deployment parameters
+// // Binding-specific bool deployment parameters
// };
//
// struct BindingStringDeployment : CommonAPI::Deployment<> {
-// // Binding-specific String deployment parameters
+// // Binding-specific String deployment parameters
// };
//
-// template<typename... _Types>
+// template<typename... Types_>
// struct BindingStructDeployment
-// : CommonAPI::Deployment<_Types...> {
-// BindingStructDeployment(<SPECIFIC PARAMETERS>, _Types... t)
-// : CommonAPI::Deployment<_Types...>(t),
-// <SPECIFIC INITIALIZERS> {};
+// : CommonAPI::Deployment<Types_...> {
+// BindingStructDeployment(<SPECIFIC PARAMETERS>, Types_... t)
+// : CommonAPI::Deployment<Types_...>(t),
+// <SPECIFIC INITIALIZERS> {};
//
-// // Binding-specific struct deployment parameters
+// // Binding-specific struct deployment parameters
// };
//
// The generated code needs to use these definitions to
@@ -46,28 +46,28 @@ namespace CommonAPI {
struct EmptyDeployment {};
-template<typename _ElementDepl>
+template<typename ElementDepl_>
struct ArrayDeployment {
- ArrayDeployment(_ElementDepl *_elementDepl)
- : elementDepl_(_elementDepl) {}
+ ArrayDeployment(ElementDepl_ *_elementDepl)
+ : elementDepl_(_elementDepl) {}
- _ElementDepl *elementDepl_;
+ ElementDepl_ *elementDepl_;
};
-template<typename _KeyDepl, typename _ValueDepl>
+template<typename KeyDepl_, typename ValueDepl_>
struct MapDeployment {
- MapDeployment(_KeyDepl *_key, _ValueDepl *_value)
- : key_(_key), value_(_value) {}
+ MapDeployment(KeyDepl_ *_key, ValueDepl_ *_value)
+ : key_(_key), value_(_value) {}
- const _KeyDepl *key_;
- const _ValueDepl *value_;
+ const KeyDepl_ *key_;
+ const ValueDepl_ *value_;
};
// The following shall be used as a base for structure/variant deployments.
-template<typename... _Types>
+template<typename... Types_>
struct Deployment {
- Deployment(_Types*... _values) : values_(_values...) {}
- std::tuple<_Types*...> values_;
+ Deployment(Types_*... _values) : values_(_values...) {}
+ std::tuple<Types_*...> values_;
};
} // namespace CommonAPI
diff --git a/include/CommonAPI/Enumeration.hpp b/include/CommonAPI/Enumeration.hpp
index da0372d..15b4748 100644
--- a/include/CommonAPI/Enumeration.hpp
+++ b/include/CommonAPI/Enumeration.hpp
@@ -8,47 +8,47 @@
namespace CommonAPI {
-template<typename _Base>
+template<typename Base_>
struct Enumeration {
- Enumeration() = default;
- Enumeration(const _Base &_value) :
- value_(_value) {
- }
+ Enumeration() = default;
+ Enumeration(const Base_ &_value) :
+ value_(_value) {
+ }
- inline Enumeration &operator=(const _Base &_value) {
- value_ = _value;
- return (*this);
- }
+ inline Enumeration &operator=(const Base_ &_value) {
+ value_ = _value;
+ return (*this);
+ }
- inline operator const _Base() const {
- return value_;
- }
+ inline operator const Base_() const {
+ return value_;
+ }
- inline bool operator==(const Enumeration<_Base> &_other) const {
- return (value_ == _other.value_);
- }
+ inline bool operator==(const Enumeration<Base_> &_other) const {
+ return (value_ == _other.value_);
+ }
- inline bool operator!=(const Enumeration<_Base> &_other) const {
- return (value_ != _other.value_);
- }
+ inline bool operator!=(const Enumeration<Base_> &_other) const {
+ return (value_ != _other.value_);
+ }
- inline bool operator<(const Enumeration<_Base> &_other) const {
- return (value_ < _other.value_);
- }
+ inline bool operator<(const Enumeration<Base_> &_other) const {
+ return (value_ < _other.value_);
+ }
- inline bool operator<=(const Enumeration<_Base> &_other) const {
- return (value_ <= _other.value_);
- }
+ inline bool operator<=(const Enumeration<Base_> &_other) const {
+ return (value_ <= _other.value_);
+ }
- inline bool operator>(const Enumeration<_Base> &_other) const {
- return (value_ > _other.value_);
- }
+ inline bool operator>(const Enumeration<Base_> &_other) const {
+ return (value_ > _other.value_);
+ }
- inline bool operator>=(const Enumeration<_Base> &_other) const {
- return (value_ >= _other.value_);
- }
+ inline bool operator>=(const Enumeration<Base_> &_other) const {
+ return (value_ >= _other.value_);
+ }
- _Base value_;
+ Base_ value_;
};
} // namespace CommonAPI
diff --git a/include/CommonAPI/Event.hpp b/include/CommonAPI/Event.hpp
index d56ea4b..c1c816a 100644
--- a/include/CommonAPI/Event.hpp
+++ b/include/CommonAPI/Event.hpp
@@ -16,6 +16,8 @@
#include <set>
#include <tuple>
+#include <CommonAPI/Types.hpp>
+
namespace CommonAPI {
/**
@@ -23,14 +25,16 @@ namespace CommonAPI {
*
* Class representing an event
*/
-template<typename... _Arguments>
+template<typename... Arguments_>
class Event {
public:
- typedef std::tuple<_Arguments...> ArgumentsTuple;
- typedef std::function<void(const _Arguments&...)> Listener;
+ typedef std::tuple<Arguments_...> ArgumentsTuple;
+ typedef std::function<void(const Arguments_&...)> Listener;
typedef uint32_t Subscription;
typedef std::set<Subscription> SubscriptionsSet;
- typedef std::map<Subscription, Listener> ListenersMap;
+ typedef std::function<void(const CallStatus)> ErrorListener;
+ typedef std::tuple<Listener, ErrorListener> Listeners;
+ typedef std::map<Subscription, Listeners> ListenersMap;
/**
* \brief Constructor
@@ -50,7 +54,7 @@ public:
* @param listener A listener to be added
* @return key of the new subscription
*/
- Subscription subscribe(Listener listener);
+ Subscription subscribe(Listener listener, ErrorListener errorListener = nullptr);
/**
* \brief Remove a listener from this event
@@ -65,14 +69,24 @@ public:
virtual ~Event() {}
protected:
- void notifyListeners(const _Arguments&... eventArguments);
- void notifySpecificListener(const Subscription subscription, const _Arguments&... eventArguments);
+ void notifyListeners(const Arguments_&... _eventArguments);
+ void notifySpecificListener(const Subscription _subscription, const Arguments_&... _eventArguments);
+ void notifyError(const CallStatus status);
- virtual void onFirstListenerAdded(const Listener& listener) {}
- virtual void onListenerAdded(const Listener& listener, const Subscription subscription) {}
+ virtual void onFirstListenerAdded(const Listener &_listener) {
+ (void)_listener;
+ }
+ virtual void onListenerAdded(const Listener &_listener, const Subscription _subscription) {
+ (void)_listener;
+ (void)_subscription;
+ }
- virtual void onListenerRemoved(const Listener& listener) {}
- virtual void onLastListenerRemoved(const Listener& listener) {}
+ virtual void onListenerRemoved(const Listener &_listener) {
+ (void)_listener;
+ }
+ virtual void onLastListenerRemoved(const Listener &_listener) {
+ (void)_listener;
+ }
private:
ListenersMap subscriptions_;
@@ -85,16 +99,19 @@ private:
std::mutex subscriptionMutex_;
};
-template<typename ... _Arguments>
-typename Event<_Arguments...>::Subscription Event<_Arguments...>::subscribe(Listener listener) {
+template<typename ... Arguments_>
+typename Event<Arguments_...>::Subscription Event<Arguments_...>::subscribe(Listener listener, ErrorListener errorListener) {
Subscription subscription;
bool isFirstListener;
+ Listeners listeners;
subscriptionMutex_.lock();
subscription = nextSubscription_++;
- // TODO?: check for key/subscription overrun
- listener = pendingSubscriptions_[subscription] = std::move(listener);
- isFirstListener = (0 == subscriptions_.size());
+ isFirstListener = (0 == pendingSubscriptions_.size()) && (pendingUnsubscriptions_.size() == subscriptions_.size());
+ listener = std::move(listener);
+ errorListener = std::move(errorListener);
+ listeners = std::make_tuple(listener, errorListener);
+ pendingSubscriptions_[subscription] = std::move(listeners);
subscriptionMutex_.unlock();
if (isFirstListener)
@@ -104,30 +121,35 @@ typename Event<_Arguments...>::Subscription Event<_Arguments...>::subscribe(List
return subscription;
}
-template<typename ... _Arguments>
-void Event<_Arguments...>::unsubscribe(Subscription subscription) {
+template<typename ... Arguments_>
+void Event<Arguments_...>::unsubscribe(Subscription subscription) {
bool isLastListener(false);
bool hasUnsubscribed(false);
Listener listener;
subscriptionMutex_.lock();
auto listenerIterator = subscriptions_.find(subscription);
- if (subscriptions_.end() != listenerIterator
- && pendingUnsubscriptions_.end() == pendingUnsubscriptions_.find(subscription)) {
- listener = listenerIterator->second;
- pendingUnsubscriptions_.insert(subscription);
- isLastListener = (1 == subscriptions_.size());
- hasUnsubscribed = true;
+ if (subscriptions_.end() != listenerIterator) {
+ if (pendingUnsubscriptions_.end() == pendingUnsubscriptions_.find(subscription)) {
+ if (0 == pendingSubscriptions_.erase(subscription)) {
+ pendingUnsubscriptions_.insert(subscription);
+ listener = std::get<0>(listenerIterator->second);
+ hasUnsubscribed = true;
+ }
+ isLastListener = (pendingUnsubscriptions_.size() == subscriptions_.size());
+ }
}
else {
listenerIterator = pendingSubscriptions_.find(subscription);
if (pendingSubscriptions_.end() != listenerIterator) {
- listener = listenerIterator->second;
- pendingSubscriptions_.erase(listenerIterator);
- isLastListener = (0 == subscriptions_.size());
- hasUnsubscribed = true;
+ listener = std::get<0>(listenerIterator->second);
+ if (0 != pendingSubscriptions_.erase(subscription)) {
+ isLastListener = (pendingUnsubscriptions_.size() == subscriptions_.size());
+ hasUnsubscribed = true;
+ }
}
}
+ isLastListener = isLastListener && (0 == pendingSubscriptions_.size());
subscriptionMutex_.unlock();
if (hasUnsubscribed) {
@@ -138,8 +160,8 @@ void Event<_Arguments...>::unsubscribe(Subscription subscription) {
}
}
-template<typename ... _Arguments>
-void Event<_Arguments...>::notifyListeners(const _Arguments&... eventArguments) {
+template<typename ... Arguments_>
+void Event<Arguments_...>::notifyListeners(const Arguments_&... eventArguments) {
subscriptionMutex_.lock();
notificationMutex_.lock();
for (auto iterator = pendingUnsubscriptions_.begin();
@@ -158,15 +180,15 @@ void Event<_Arguments...>::notifyListeners(const _Arguments&... eventArguments)
subscriptionMutex_.unlock();
for (auto iterator = subscriptions_.begin(); iterator != subscriptions_.end(); iterator++) {
- iterator->second(eventArguments...);
+ (std::get<0>(iterator->second))(eventArguments...);
}
notificationMutex_.unlock();
}
-template<typename ... _Arguments>
-void Event<_Arguments...>::notifySpecificListener(const Subscription subscription, const _Arguments&... eventArguments) {
- subscriptionMutex_.lock();
+template<typename ... Arguments_>
+void Event<Arguments_...>::notifySpecificListener(const Subscription subscription, const Arguments_&... eventArguments) {
+ subscriptionMutex_.lock();
notificationMutex_.lock();
for (auto iterator = pendingUnsubscriptions_.begin();
iterator != pendingUnsubscriptions_.end();
@@ -187,7 +209,37 @@ void Event<_Arguments...>::notifySpecificListener(const Subscription subscriptio
subscriptionMutex_.unlock();
for (auto iterator = subscriptions_.begin(); iterator != subscriptions_.end(); iterator++) {
if (subscription == iterator->first) {
- iterator->second(eventArguments...);
+ (std::get<0>(iterator->second))(eventArguments...);
+ }
+ }
+
+ notificationMutex_.unlock();
+}
+
+template<typename ... Arguments_>
+void Event<Arguments_...>::notifyError(const CallStatus status) {
+
+ subscriptionMutex_.lock();
+ notificationMutex_.lock();
+ for (auto iterator = pendingUnsubscriptions_.begin();
+ iterator != pendingUnsubscriptions_.end();
+ iterator++) {
+ subscriptions_.erase(*iterator);
+ }
+ pendingUnsubscriptions_.clear();
+
+ for (auto iterator = pendingSubscriptions_.begin();
+ iterator != pendingSubscriptions_.end();
+ iterator++) {
+ subscriptions_.insert(*iterator);
+ }
+ pendingSubscriptions_.clear();
+
+ subscriptionMutex_.unlock();
+ for (auto iterator = subscriptions_.begin(); iterator != subscriptions_.end(); iterator++) {
+ ErrorListener listener = std::get<1>(iterator->second);
+ if (listener) {
+ listener(status);
}
}
diff --git a/include/CommonAPI/Export.hpp b/include/CommonAPI/Export.hpp
index 1fe9734..1513ac9 100644
--- a/include/CommonAPI/Export.hpp
+++ b/include/CommonAPI/Export.hpp
@@ -7,16 +7,16 @@
#define COMMONAPI_EXPORT_HPP_
#ifdef WIN32
- #define COMMONAPI_EXPORT __declspec(dllexport)
+ #define COMMONAPI_EXPORT __declspec(dllexport)
- #if COMMONAPI_DLL_COMPILATION
- #define COMMONAPI_IMPORT_EXPORT __declspec(dllexport)
- #else
- #define COMMONAPI_IMPORT_EXPORT __declspec(dllimport)
- #endif
+ #if COMMONAPI_DLL_COMPILATION
+ #define COMMONAPI_IMPORT_EXPORT __declspec(dllexport)
+ #else
+ #define COMMONAPI_IMPORT_EXPORT __declspec(dllimport)
+ #endif
#else
- #define COMMONAPI_EXPORT
- #define COMMONAPI_IMPORT_EXPORT
+ #define COMMONAPI_EXPORT
+ #define COMMONAPI_IMPORT_EXPORT
#endif
#endif // COMMONAPI_EXPORT_HPP_
diff --git a/include/CommonAPI/Extensions/AttributeCacheExtension.hpp b/include/CommonAPI/Extensions/AttributeCacheExtension.hpp
index 92bced6..f6a0cb1 100644
--- a/include/CommonAPI/Extensions/AttributeCacheExtension.hpp
+++ b/include/CommonAPI/Extensions/AttributeCacheExtension.hpp
@@ -15,59 +15,66 @@
namespace CommonAPI {
namespace Extensions {
-template<typename _AttributeType,
- bool = (std::is_base_of<
- CommonAPI::ObservableAttribute<
- typename _AttributeType::ValueType>,
- _AttributeType>::value
- || std::is_base_of<
- CommonAPI::ObservableReadonlyAttribute<
- typename _AttributeType::ValueType>,
- _AttributeType>::value)>
-class AttributeCacheExtension {
+namespace AttributeCache {
+template<typename AttributeType_>
+struct AttributeTraits;
+
+template<typename AttributeType_, bool>
+class AttributeCacheExtensionImpl;
+}
+
+template <typename AttributeType_>
+using AttributeCacheExtension = AttributeCache::AttributeCacheExtensionImpl<AttributeType_,
+ AttributeCache::AttributeTraits<AttributeType_>::observable>;
+
+namespace AttributeCache {
+
+template<typename AttributeType_>
+struct AttributeTraits {
+ static const bool observable = (std::is_base_of<
+ CommonAPI::ObservableAttribute<
+ typename AttributeType_::ValueType>,
+ AttributeType_>::value
+ || std::is_base_of<
+ CommonAPI::ObservableReadonlyAttribute<
+ typename AttributeType_::ValueType>,
+ AttributeType_>::value);
};
-template<typename _AttributeType>
-class AttributeCacheExtension<_AttributeType, false> : public CommonAPI::AttributeExtension<
- _AttributeType> {
+template<typename AttributeType_>
+class AttributeCacheExtensionImpl<AttributeType_, false> : public CommonAPI::AttributeExtension<
+ AttributeType_> {
protected:
- typedef CommonAPI::AttributeExtension<_AttributeType> __baseClass_t;
+ typedef CommonAPI::AttributeExtension<AttributeType_> __baseClass_t;
- typedef typename _AttributeType::ValueType value_t;
+ typedef typename AttributeType_::ValueType value_t;
- AttributeCacheExtension(_AttributeType& baseAttribute)
- : CommonAPI::AttributeExtension<_AttributeType>(baseAttribute) {
+public:
+ AttributeCacheExtensionImpl(AttributeType_& baseAttribute)
+ : CommonAPI::AttributeExtension<AttributeType_>(baseAttribute) {
}
- ~AttributeCacheExtension() {
- }
};
-template<typename _AttributeType>
-class AttributeCacheExtension<_AttributeType, true> : public CommonAPI::AttributeExtension<
- _AttributeType> {
- typedef CommonAPI::AttributeExtension<_AttributeType> __baseClass_t;
+template<typename AttributeType_>
+class AttributeCacheExtensionImpl<AttributeType_, true> : public CommonAPI::AttributeExtension<
+ AttributeType_> {
+ typedef CommonAPI::AttributeExtension<AttributeType_> __baseClass_t;
protected:
- typedef typename _AttributeType::ValueType value_t;
+ typedef typename AttributeType_::ValueType value_t;
typedef std::shared_ptr<const value_t> valueptr_t;
- AttributeCacheExtension(_AttributeType& baseAttribute)
- : CommonAPI::AttributeExtension<_AttributeType>(baseAttribute) {
- auto &event = __baseClass_t::getBaseAttribute().getChangedEvent();
- subscription_ =
- event.subscribe(
- std::bind(
- &AttributeCacheExtension<_AttributeType, true>::onValueUpdate,
- this, std::placeholders::_1));
- }
-
- ~AttributeCacheExtension() {
+public:
+ AttributeCacheExtensionImpl(AttributeType_& baseAttribute)
+ : CommonAPI::AttributeExtension<AttributeType_>(baseAttribute) {
auto &event = __baseClass_t::getBaseAttribute().getChangedEvent();
- event.unsubscribe(subscription_);
+ event.subscribe(
+ std::bind(
+ &AttributeCacheExtensionImpl<AttributeType_, true>::onValueUpdate,
+ this, std::placeholders::_1));
}
-public:
/**
* @brief getCachedValue Retrieve attribute value from the cache
* @return The value of the attribute or a null pointer if the value is not
@@ -80,12 +87,6 @@ public:
return cachedValue_;
}
- // This may get called more than once if a previous retrieval is still
- // on-going (saving the current state would just take up extra resources)
- __baseClass_t::getBaseAttribute().getValueAsync(
- std::bind(&AttributeCacheExtension<_AttributeType, true>::valueRetrieved,
- this, std::placeholders::_1, std::placeholders::_2));
-
return nullptr;
}
@@ -109,20 +110,22 @@ private:
void valueRetrieved(const CommonAPI::CallStatus &callStatus, value_t t) {
if (callStatus == CommonAPI::CallStatus::SUCCESS) {
- assert(!cachedValue_ || *cachedValue_ == t);
onValueUpdate(t);
}
}
void onValueUpdate(const value_t& t) {
+ if (cachedValue_ && *cachedValue_ == t) {
+ return;
+ }
+
cachedValue_ = std::make_shared<const value_t>(t);
}
valueptr_t cachedValue_;
-
- typename _AttributeType::ChangedEvent::Subscription subscription_;
};
+} // namespace AttributeCache
} // namespace Extensions
} // namespace CommonAPI
diff --git a/include/CommonAPI/Factory.hpp b/include/CommonAPI/Factory.hpp
index df8354d..94bb7ec 100644
--- a/include/CommonAPI/Factory.hpp
+++ b/include/CommonAPI/Factory.hpp
@@ -26,31 +26,31 @@ public:
virtual ~Factory() {};
- virtual std::shared_ptr<Proxy> createProxy(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance,
- const ConnectionId_t &_connectionId) = 0;
-
- virtual std::shared_ptr<Proxy> createProxy(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance,
- std::shared_ptr<MainLoopContext> mainLoopContext) = 0;
-
- virtual bool registerStub(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance,
- std::shared_ptr<StubBase> _stub,
- const ConnectionId_t &_connectionId) = 0;
-
- virtual bool registerStub(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance,
- std::shared_ptr<StubBase> _stub,
- std::shared_ptr<MainLoopContext> mainLoopContext) = 0;
-
- virtual bool unregisterStub(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance) = 0;
+ virtual std::shared_ptr<Proxy> createProxy(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ const ConnectionId_t &_connectionId) = 0;
+
+ virtual std::shared_ptr<Proxy> createProxy(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ std::shared_ptr<MainLoopContext> mainLoopContext) = 0;
+
+ virtual bool registerStub(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ std::shared_ptr<StubBase> _stub,
+ const ConnectionId_t &_connectionId) = 0;
+
+ virtual bool registerStub(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ std::shared_ptr<StubBase> _stub,
+ std::shared_ptr<MainLoopContext> mainLoopContext) = 0;
+
+ virtual bool unregisterStub(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance) = 0;
};
} // namespace CommonAPI
diff --git a/include/CommonAPI/IniFileReader.hpp b/include/CommonAPI/IniFileReader.hpp
index 13b64c3..a04e5b3 100644
--- a/include/CommonAPI/IniFileReader.hpp
+++ b/include/CommonAPI/IniFileReader.hpp
@@ -16,23 +16,23 @@ namespace CommonAPI {
class IniFileReader {
public:
- class Section {
- public:
- COMMONAPI_EXPORT const std::map<std::string, std::string> &getMappings() const;
- COMMONAPI_EXPORT std::string getValue(const std::string &_key) const;
- private:
- std::map<std::string, std::string> mappings_;
+ class Section {
+ public:
+ COMMONAPI_EXPORT const std::map<std::string, std::string> &getMappings() const;
+ COMMONAPI_EXPORT std::string getValue(const std::string &_key) const;
+ private:
+ std::map<std::string, std::string> mappings_;
- friend class IniFileReader;
- };
+ friend class IniFileReader;
+ };
- COMMONAPI_EXPORT bool load(const std::string &_path);
+ COMMONAPI_EXPORT bool load(const std::string &_path);
- COMMONAPI_EXPORT const std::map<std::string, std::shared_ptr<Section>> &getSections() const;
- COMMONAPI_EXPORT std::shared_ptr<Section> getSection(const std::string &_name) const;
+ COMMONAPI_EXPORT const std::map<std::string, std::shared_ptr<Section>> &getSections() const;
+ COMMONAPI_EXPORT std::shared_ptr<Section> getSection(const std::string &_name) const;
private:
- std::map<std::string, std::shared_ptr<Section>> sections_;
+ std::map<std::string, std::shared_ptr<Section>> sections_;
};
} // namespace CommonAPI
diff --git a/include/CommonAPI/InputStream.hpp b/include/CommonAPI/InputStream.hpp
index f5cbc12..5e8da99 100644
--- a/include/CommonAPI/InputStream.hpp
+++ b/include/CommonAPI/InputStream.hpp
@@ -22,218 +22,218 @@
namespace CommonAPI {
-template<class _Derived>
+template<class Derived_>
class InputStream {
public:
- template<class _Deployment>
- InputStream &readValue(bool &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(bool &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(int8_t &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(int8_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(int16_t &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(int16_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(int32_t &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(int32_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(int64_t &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(int64_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(uint8_t &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(uint8_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(uint16_t &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(uint16_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(uint32_t &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(uint32_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(uint64_t &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(uint64_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(float &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(float &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(double &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(double &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(std::string &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(std::string &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment, typename _Base>
- InputStream &readValue(Enumeration<_Base> &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_, typename Base_>
+ InputStream &readValue(Enumeration<Base_> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment, typename... _Types>
- InputStream &readValue(Struct<_Types...> &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_, typename... Types_>
+ InputStream &readValue(Struct<Types_...> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment, class _PolymorphicStruct>
- InputStream &readValue(std::shared_ptr<_PolymorphicStruct> &_value,
- const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_, class PolymorphicStruct_>
+ InputStream &readValue(std::shared_ptr<PolymorphicStruct_> &_value,
+ const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment, typename... _Types>
- InputStream &readValue(Variant<_Types...> &_value, const _Deployment *_depl = nullptr) {
+ template<class Deployment_, typename... Types_>
+ InputStream &readValue(Variant<Types_...> &_value, const Deployment_ *_depl = nullptr) {
return get()->readValue(_value, _depl);
}
- template<class _Deployment, typename _ElementType>
- InputStream &readValue(std::vector<_ElementType> &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_, typename ElementType_>
+ InputStream &readValue(std::vector<ElementType_> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment, typename _KeyType, typename _ValueType, typename _HasherType>
- InputStream &readValue(std::unordered_map<_KeyType, _ValueType, _HasherType> &_value,
- const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_, typename KeyType_, typename ValueType_, typename HasherType_>
+ InputStream &readValue(std::unordered_map<KeyType_, ValueType_, HasherType_> &_value,
+ const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
- template<class _Deployment>
- InputStream &readValue(Version &_value, const _Deployment *_depl = nullptr) {
- return get()->readValue(_value, _depl);
+ template<class Deployment_>
+ InputStream &readValue(Version &_value, const Deployment_ *_depl = nullptr) {
+ return get()->readValue(_value, _depl);
}
bool hasError() const {
- return get()->hasError();
+ return get()->hasError();
}
private:
- inline _Derived *get() {
- return static_cast<_Derived *>(this);
+ inline Derived_ *get() {
+ return static_cast<Derived_ *>(this);
}
- inline const _Derived *get() const {
- return static_cast<const _Derived *>(this);
+ inline const Derived_ *get() const {
+ return static_cast<const Derived_ *>(this);
}
};
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, bool &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, bool &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, int8_t &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, int8_t &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, int16_t &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, int16_t &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, int32_t &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, int32_t &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, int64_t &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, int64_t &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, uint8_t &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, uint8_t &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, uint16_t &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, uint16_t &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, uint32_t &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, uint32_t &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, uint64_t &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, uint64_t &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, float &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, float &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, double &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, double &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, std::string &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, std::string &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, Version &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, Version &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename _Base>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, Enumeration<_Base> &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_, typename Base_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, Enumeration<Base_> &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename... _Types>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, Struct<_Types...> &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_, typename... Types_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, Struct<Types_...> &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived, class _PolymorphicStruct>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, std::shared_ptr<_PolymorphicStruct> &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_, class PolymorphicStruct_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, std::shared_ptr<PolymorphicStruct_> &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename... _Types>
-InputStream<_Derived> & operator>>(InputStream<_Derived> &_input, Variant<_Types...> &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_, typename... Types_>
+InputStream<Derived_> & operator>>(InputStream<Derived_> &_input, Variant<Types_...> &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename _ElementType>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, std::vector<_ElementType> &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_, typename ElementType_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, std::vector<ElementType_> &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename _KeyType, typename _ValueType, typename _HasherType>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, std::unordered_map<_KeyType, _ValueType, _HasherType> &_value) {
- return _input.template readValue<EmptyDeployment>(_value);
+template<class Derived_, typename KeyType_, typename ValueType_, typename HasherType_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, std::unordered_map<KeyType_, ValueType_, HasherType_> &_value) {
+ return _input.template readValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename _Type, typename _TypeDeployment>
-InputStream<_Derived> &operator>>(InputStream<_Derived> &_input, Deployable<_Type, _TypeDeployment> &_value) {
- return _input.template readValue<_TypeDeployment>(_value.getValue(), _value.getDepl());
+template<class Derived_, typename Type_, typename TypeDeployment_>
+InputStream<Derived_> &operator>>(InputStream<Derived_> &_input, Deployable<Type_, TypeDeployment_> &_value) {
+ return _input.template readValue<TypeDeployment_>(_value.getValue(), _value.getDepl());
}
} // namespace CommonAPI
diff --git a/include/CommonAPI/Logger.hpp b/include/CommonAPI/Logger.hpp
index 2247ea1..3a5f0b0 100644
--- a/include/CommonAPI/Logger.hpp
+++ b/include/CommonAPI/Logger.hpp
@@ -7,7 +7,7 @@
#define COMMONAPI_LOGGER_HPP_
#ifdef USE_DLT
-#include <dlt.h>
+#include <dlt/dlt.h>
#endif
#include <cstdint>
@@ -18,12 +18,12 @@
#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_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
#ifndef COMMONAPI_LOGLEVEL
#define COMMONAPI_LOGLEVEL COMMONAPI_LOGLEVEL_INFO
@@ -32,39 +32,39 @@
#ifdef WIN32
#define COMMONAPI_FATAL(...) \
- do { Logger::log(Logger::Level::LL_FATAL, __VA_ARGS__); } while (false);
+ do { Logger::log(Logger::Level::LL_FATAL, __VA_ARGS__); } while (false);
#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_ERROR
#define COMMONAPI_ERROR(...) \
- do { Logger::log(Logger::Level::LL_ERROR, __VA_ARGS__); } while (false);
+ do { Logger::log(Logger::Level::LL_ERROR, __VA_ARGS__); } while (false);
#else
#define COMMONAPI_ERROR(...)
#endif
#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_WARNING
#define COMMONAPI_WARNING(...) \
- do { Logger::log(Logger::Level::LL_WARNING, __VA_ARGS__); } while (false);
+ do { Logger::log(Logger::Level::LL_WARNING, __VA_ARGS__); } while (false);
#else
#define COMMONAPI_WARNING(...)
#endif
#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_INFO
#define COMMONAPI_INFO(...) \
- do { Logger::log(Logger::Level::LL_INFO, __VA_ARGS__); } while (false);
+ do { Logger::log(Logger::Level::LL_INFO, __VA_ARGS__); } while (false);
#else
#define COMMONAPI_INFO(...)
#endif
#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_DEBUG
#define COMMONAPI_DEBUG(...) \
- do { Logger::log(Logger::Level::LL_DEBUG, __VA_ARGS__); } while (false);
+ do { Logger::log(Logger::Level::LL_DEBUG, __VA_ARGS__); } while (false);
#else
#define COMMONAPI_DEBUG(...)
#endif
#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_VERBOSE
#define COMMONAPI_VERBOSE(...) \
- do { Logger::log(Logger::Level::LL_VERBOSE, __VA_ARGS__); } while (false);
+ do { Logger::log(Logger::Level::LL_VERBOSE, __VA_ARGS__); } while (false);
#else
#define COMMONAPI_VERBOSE(...)
#endif
@@ -72,41 +72,41 @@
#else // !WIN32
#define COMMONAPI_FATAL(params...) \
- do { Logger::log(Logger::Level::LL_FATAL, params); } while (false);
+ do { Logger::log(Logger::Level::LL_FATAL, params); } while (false);
#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_ERROR
- #define COMMONAPI_ERROR(params...) \
- do { Logger::log(Logger::Level::LL_ERROR, params); } while (false);
+ #define COMMONAPI_ERROR(params...) \
+ do { Logger::log(Logger::Level::LL_ERROR, params); } while (false);
#else
- #define COMMONAPI_ERROR(params...)
+ #define COMMONAPI_ERROR(params...)
#endif
#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_WARNING
- #define COMMONAPI_WARNING(params...) \
- do { Logger::log(Logger::Level::LL_WARNING, params); } while (false);
+ #define COMMONAPI_WARNING(params...) \
+ do { Logger::log(Logger::Level::LL_WARNING, params); } while (false);
#else
- #define COMMONAPI_WARNING(params...)
+ #define COMMONAPI_WARNING(params...)
#endif
#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_INFO
- #define COMMONAPI_INFO(params...) \
- do { Logger::log(Logger::Level::LL_INFO, params); } while (false);
+ #define COMMONAPI_INFO(params...) \
+ do { Logger::log(Logger::Level::LL_INFO, params); } while (false);
#else
- #define COMMONAPI_INFO(params...)
+ #define COMMONAPI_INFO(params...)
#endif
#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_DEBUG
- #define COMMONAPI_DEBUG(params...) \
- do { Logger::log(Logger::Level::LL_DEBUG, params); } while (false);
+ #define COMMONAPI_DEBUG(params...) \
+ do { Logger::log(Logger::Level::LL_DEBUG, params); } while (false);
#else
- #define COMMONAPI_DEBUG(params...)
+ #define COMMONAPI_DEBUG(params...)
#endif
#if COMMONAPI_LOGLEVEL >= COMMONAPI_LOGLEVEL_VERBOSE
- #define COMMONAPI_VERBOSE(params...) \
- do { Logger::log(Logger::Level::LL_VERBOSE, params); } while (false);
+ #define COMMONAPI_VERBOSE(params...) \
+ do { Logger::log(Logger::Level::LL_VERBOSE, params); } while (false);
#else
- #define COMMONAPI_VERBOSE(params...)
+ #define COMMONAPI_VERBOSE(params...)
#endif
#endif // WIN32
@@ -115,67 +115,71 @@ namespace CommonAPI {
class Logger {
public:
- COMMONAPI_EXPORT enum class Level : uint8_t {
- LL_FATAL = 0, LL_ERROR = 1, LL_WARNING = 2, LL_INFO = 3, LL_DEBUG = 4, LL_VERBOSE = 5
- };
+ COMMONAPI_EXPORT enum class Level : uint8_t {
+ LL_FATAL = 0, LL_ERROR = 1, LL_WARNING = 2, LL_INFO = 3, LL_DEBUG = 4, LL_VERBOSE = 5
+ };
- COMMONAPI_EXPORT Logger();
- COMMONAPI_EXPORT ~Logger();
+ COMMONAPI_EXPORT Logger();
+ COMMONAPI_EXPORT ~Logger();
- template<typename... _LogEntries>
- COMMONAPI_EXPORT static void log(Level _level, _LogEntries... _entries) {
+ template<typename... LogEntries_>
+ COMMONAPI_EXPORT static void log(Level _level, LogEntries_... _entries) {
#if defined(USE_CONSOLE) || defined(USE_FILE) || defined(USE_DLT)
- if (_level < maximumLogLevel_) {
+ if (_level < maximumLogLevel_) {
std::stringstream buffer;
log_intern(buffer, _entries...);
Logger::get()->doLog(_level, buffer.str());
- }
+ }
+#else
+ (void)_level;
+ std::tuple<LogEntries_...> args(_entries...);
#endif
- }
+ }
- COMMONAPI_EXPORT static void init(bool, const std::string &, bool, const std::string &);
+ COMMONAPI_EXPORT static void init(bool, const std::string &, bool, const std::string &);
private:
- COMMONAPI_EXPORT static inline Logger *get() {
- static Logger theLogger;
- return &theLogger;
- }
+ COMMONAPI_EXPORT static inline Logger *get() {
+ static Logger theLogger;
+ return &theLogger;
+ }
- COMMONAPI_EXPORT static void log_intern(std::stringstream &_buffer) {
- }
+ COMMONAPI_EXPORT static void log_intern(std::stringstream &_buffer) {
+ (void)_buffer;
+ }
- template<typename _LogEntry, typename... _MoreLogEntries>
- COMMONAPI_EXPORT static void log_intern(std::stringstream &_buffer, _LogEntry _entry, _MoreLogEntries... _moreEntries) {
- _buffer << _entry;
- log_intern(_buffer, _moreEntries...);
- }
+ template<typename LogEntry_, typename... MoreLogEntries_>
+ COMMONAPI_EXPORT static void log_intern(std::stringstream &_buffer, LogEntry_ _entry, MoreLogEntries_... _moreEntries) {
+ _buffer << _entry;
+ log_intern(_buffer, _moreEntries...);
+ }
- COMMONAPI_EXPORT void doLog(Level _level, const std::string &_message);
+ COMMONAPI_EXPORT void doLog(Level _level, const std::string &_message);
#if defined(USE_CONSOLE) || defined(USE_FILE) || defined(USE_DLT)
- static Level stringAsLevel(const std::string &_level);
+ static Level stringAsLevel(const std::string &_level);
#endif
#if defined(USE_CONSOLE) || defined(USE_FILE)
- static std::string levelAsString(Level _level);
+ static std::string levelAsString(Level _level);
#endif
#ifdef USE_DLT
- static DltLogLevelType levelAsDlt(Level _level);
+ static DltLogLevelType levelAsDlt(Level _level);
#endif
#if defined(USE_CONSOLE) || defined(USE_FILE)
- static std::mutex mutex_;
+ static std::mutex mutex_;
#endif
#if defined(USE_CONSOLE) || defined(USE_FILE) || defined(USE_DLT)
- static Level maximumLogLevel_;
+ static Level maximumLogLevel_;
#endif
#ifdef USE_CONSOLE
- static bool useConsole_;
+ static bool useConsole_;
#endif
#ifdef USE_FILE
- static std::shared_ptr<std::ofstream> file_;
+ static std::shared_ptr<std::ofstream> file_;
#endif
#ifdef USE_DLT
- static bool useDlt_;
- DLT_DECLARE_CONTEXT(dlt_);
+ static bool useDlt_;
+ DLT_DECLARE_CONTEXT(dlt_);
#endif
};
diff --git a/include/CommonAPI/MainLoopContext.hpp b/include/CommonAPI/MainLoopContext.hpp
index 4487292..e46e99f 100644
--- a/include/CommonAPI/MainLoopContext.hpp
+++ b/include/CommonAPI/MainLoopContext.hpp
@@ -112,12 +112,12 @@ struct Watch {
virtual const pollfd& getAssociatedFileDescriptor() = 0;
#ifdef WIN32
- /**
- * \brief Returns the event bound to the file descriptor that is managed by this watch.
- *
- * @return The event bound to the associated file descriptor.
- */
- virtual const HANDLE& getAssociatedEvent() = 0;
+ /**
+ * \brief Returns the event bound to the file descriptor that is managed by this watch.
+ *
+ * @return The event bound to the associated file descriptor.
+ */
+ virtual const HANDLE& getAssociatedEvent() = 0;
#endif
/**
@@ -200,91 +200,91 @@ typedef WakeupListenerList::iterator WakeupListenerSubscription;
*/
class MainLoopContext {
public:
- COMMONAPI_EXPORT MainLoopContext(const std::string &_name = "COMMONAPI_DEFAULT_MAINLOOP_CONTEXT")
- : name_(_name){
+ COMMONAPI_EXPORT MainLoopContext(const std::string &_name = "COMMONAPI_DEFAULT_MAINLOOP_CONTEXT")
+ : name_(_name){
}
- COMMONAPI_EXPORT MainLoopContext(const MainLoopContext&) = delete;
- COMMONAPI_EXPORT MainLoopContext& operator=(const MainLoopContext&) = delete;
- COMMONAPI_EXPORT MainLoopContext(MainLoopContext&&) = delete;
- COMMONAPI_EXPORT MainLoopContext& operator=(MainLoopContext&&) = delete;
+ COMMONAPI_EXPORT MainLoopContext(const MainLoopContext&) = delete;
+ COMMONAPI_EXPORT MainLoopContext& operator=(const MainLoopContext&) = delete;
+ COMMONAPI_EXPORT MainLoopContext(MainLoopContext&&) = delete;
+ COMMONAPI_EXPORT MainLoopContext& operator=(MainLoopContext&&) = delete;
- COMMONAPI_EXPORT const std::string &getName() const;
+ COMMONAPI_EXPORT const std::string &getName() const;
/**
* \brief Registers for all DispatchSources that are added or removed.
*/
- COMMONAPI_EXPORT DispatchSourceListenerSubscription subscribeForDispatchSources(DispatchSourceAddedCallback dispatchAddedCallback, DispatchSourceRemovedCallback dispatchRemovedCallback);
+ COMMONAPI_EXPORT DispatchSourceListenerSubscription subscribeForDispatchSources(DispatchSourceAddedCallback dispatchAddedCallback, DispatchSourceRemovedCallback dispatchRemovedCallback);
/**
* \brief Registers for all Watches that are added or removed.
*/
- COMMONAPI_EXPORT WatchListenerSubscription subscribeForWatches(WatchAddedCallback watchAddedCallback, WatchRemovedCallback watchRemovedCallback);
+ COMMONAPI_EXPORT WatchListenerSubscription subscribeForWatches(WatchAddedCallback watchAddedCallback, WatchRemovedCallback watchRemovedCallback);
/**
* \brief Registers for all Timeouts that are added or removed.
*/
- COMMONAPI_EXPORT TimeoutSourceListenerSubscription subscribeForTimeouts(TimeoutSourceAddedCallback timeoutAddedCallback, TimeoutSourceRemovedCallback timeoutRemovedCallback);
+ COMMONAPI_EXPORT TimeoutSourceListenerSubscription subscribeForTimeouts(TimeoutSourceAddedCallback timeoutAddedCallback, TimeoutSourceRemovedCallback timeoutRemovedCallback);
/**
* \brief Registers for all Wakeup-Events that need to interrupt a call to "poll".
*/
- COMMONAPI_EXPORT WakeupListenerSubscription subscribeForWakeupEvents(WakeupCallback wakeupCallback);
+ COMMONAPI_EXPORT WakeupListenerSubscription subscribeForWakeupEvents(WakeupCallback wakeupCallback);
/**
* \brief Unsubscribes your listeners for DispatchSources.
*/
- COMMONAPI_EXPORT void unsubscribeForDispatchSources(DispatchSourceListenerSubscription subscription);
+ COMMONAPI_EXPORT void unsubscribeForDispatchSources(DispatchSourceListenerSubscription subscription);
/**
* \brief Unsubscribes your listeners for Watches.
*/
- COMMONAPI_EXPORT void unsubscribeForWatches(WatchListenerSubscription subscription);
+ COMMONAPI_EXPORT void unsubscribeForWatches(WatchListenerSubscription subscription);
/**
* \brief Unsubscribes your listeners for Timeouts.
*/
- COMMONAPI_EXPORT void unsubscribeForTimeouts(TimeoutSourceListenerSubscription subscription);
+ COMMONAPI_EXPORT void unsubscribeForTimeouts(TimeoutSourceListenerSubscription subscription);
/**
* \brief Unsubscribes your listeners for Wakeup-Events.
*/
- COMMONAPI_EXPORT void unsubscribeForWakeupEvents(WakeupListenerSubscription subscription);
+ COMMONAPI_EXPORT void unsubscribeForWakeupEvents(WakeupListenerSubscription subscription);
/**
* \brief Notifies all listeners about a new DispatchSource.
*/
- COMMONAPI_EXPORT void registerDispatchSource(DispatchSource* dispatchSource, const DispatchPriority dispatchPriority = DispatchPriority::DEFAULT);
+ COMMONAPI_EXPORT void registerDispatchSource(DispatchSource* dispatchSource, const DispatchPriority dispatchPriority = DispatchPriority::DEFAULT);
/**
* \brief Notifies all listeners about the removal of a DispatchSource.
*/
- COMMONAPI_EXPORT void deregisterDispatchSource(DispatchSource* dispatchSource);
+ COMMONAPI_EXPORT void deregisterDispatchSource(DispatchSource* dispatchSource);
/**
* \brief Notifies all listeners about a new Watch.
*/
- COMMONAPI_EXPORT void registerWatch(Watch* watch, const DispatchPriority dispatchPriority = DispatchPriority::DEFAULT);
+ COMMONAPI_EXPORT void registerWatch(Watch* watch, const DispatchPriority dispatchPriority = DispatchPriority::DEFAULT);
/**
* \brief Notifies all listeners about the removal of a Watch.
*/
- COMMONAPI_EXPORT void deregisterWatch(Watch* watch);
+ COMMONAPI_EXPORT void deregisterWatch(Watch* watch);
/**
* \brief Notifies all listeners about a new Timeout.
*/
- COMMONAPI_EXPORT void registerTimeoutSource(Timeout* timeoutEvent, const DispatchPriority dispatchPriority = DispatchPriority::DEFAULT);
+ COMMONAPI_EXPORT void registerTimeoutSource(Timeout* timeoutEvent, const DispatchPriority dispatchPriority = DispatchPriority::DEFAULT);
/**
* \brief Notifies all listeners about the removal of a Timeout.
*/
- COMMONAPI_EXPORT void deregisterTimeoutSource(Timeout* timeoutEvent);
+ COMMONAPI_EXPORT void deregisterTimeoutSource(Timeout* timeoutEvent);
/**
* \brief Notifies all listeners about a wakeup event that just happened.
*/
- COMMONAPI_EXPORT void wakeup();
+ COMMONAPI_EXPORT void wakeup();
/**
* \brief Will return true if at least one subscribe for DispatchSources or Watches has been called.
@@ -292,7 +292,7 @@ public:
* This function will be used to prevent creation of a factory if a mainloop context is given, but
* no listeners have been registered. This is done in order to ensure correct use of the mainloop context.
*/
- COMMONAPI_EXPORT bool isInitialized();
+ COMMONAPI_EXPORT bool isInitialized();
private:
DispatchSourceListenerList dispatchSourceListeners_;
diff --git a/include/CommonAPI/OutputStream.hpp b/include/CommonAPI/OutputStream.hpp
index 1ca221c..df12297 100644
--- a/include/CommonAPI/OutputStream.hpp
+++ b/include/CommonAPI/OutputStream.hpp
@@ -22,218 +22,218 @@
namespace CommonAPI {
-template<class _Derived>
+template<class Derived_>
class OutputStream {
public:
- template<class _Deployment>
- OutputStream &writeValue(const bool &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const bool &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const int8_t &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const int8_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const int16_t &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const int16_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const int32_t &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const int32_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const int64_t &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const int64_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const uint8_t &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const uint8_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const uint16_t &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const uint16_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const uint32_t &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const uint32_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const uint64_t &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const uint64_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const float &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const float &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const double &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const double &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const std::string &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const std::string &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment>
- OutputStream &writeValue(const Version &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_>
+ OutputStream &writeValue(const Version &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment, typename _Base>
- OutputStream &writeValue(const Enumeration<_Base> &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
- }
+ template<class Deployment_, typename Base_>
+ OutputStream &writeValue(const Enumeration<Base_> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
+ }
- template<class _Deployment, typename... _Types>
- OutputStream &writeValue(const Struct<_Types...> &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_, typename... Types_>
+ OutputStream &writeValue(const Struct<Types_...> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment, class _PolymorphicStruct>
- OutputStream &writeValue(const std::shared_ptr<_PolymorphicStruct> &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_, class PolymorphicStruct_>
+ OutputStream &writeValue(const std::shared_ptr<PolymorphicStruct_> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment, typename... _Types>
- OutputStream &writeValue(const Variant<_Types...> &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_, typename... Types_>
+ OutputStream &writeValue(const Variant<Types_...> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment, typename _ElementType>
- OutputStream &writeValue(const std::vector<_ElementType> &_value, const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_, typename ElementType_>
+ OutputStream &writeValue(const std::vector<ElementType_> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
- template<class _Deployment, typename _KeyType, typename _ValueType, typename _HasherType>
- OutputStream &writeValue(const std::unordered_map<_KeyType, _ValueType, _HasherType> &_value,
- const _Deployment *_depl = nullptr) {
- return get()->writeValue(_value, _depl);
+ template<class Deployment_, typename KeyType_, typename ValueType_, typename HasherType_>
+ OutputStream &writeValue(const std::unordered_map<KeyType_, ValueType_, HasherType_> &_value,
+ const Deployment_ *_depl = nullptr) {
+ return get()->writeValue(_value, _depl);
}
bool hasError() const {
- return get()->hasError();
+ return get()->hasError();
}
private:
- inline _Derived *get() {
- return static_cast<_Derived *>(this);
+ inline Derived_ *get() {
+ return static_cast<Derived_ *>(this);
}
- inline const _Derived *get() const {
- return static_cast<const _Derived *>(this);
+ inline const Derived_ *get() const {
+ return static_cast<const Derived_ *>(this);
}
};
-template<class _Derived>
-inline OutputStream<_Derived> &operator<<(OutputStream<_Derived> &_output, const bool &_value) {
+template<class Derived_>
+inline OutputStream<Derived_> &operator<<(OutputStream<Derived_> &_output, const bool &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const int8_t &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const int8_t &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const int16_t &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const int16_t &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const int32_t &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const int32_t &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const int64_t &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const int64_t &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const uint8_t &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const uint8_t &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const uint16_t &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const uint16_t &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const uint32_t &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const uint32_t &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const uint64_t &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const uint64_t &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const float &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const float &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const double &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const double &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const std::string &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const std::string &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename _Type, typename _TypeDepl>
-inline OutputStream<_Derived> &operator<<(OutputStream<_Derived> &_output, const Deployable<_Type, _TypeDepl> &_value) {
- return _output.template writeValue<_TypeDepl>(_value.getValue(), _value.getDepl());
+template<class Derived_, typename Type_, typename TypeDepl_>
+inline OutputStream<Derived_> &operator<<(OutputStream<Derived_> &_output, const Deployable<Type_, TypeDepl_> &_value) {
+ return _output.template writeValue<TypeDepl_>(_value.getValue(), _value.getDepl());
}
-template<class _Derived>
-inline OutputStream<_Derived>& operator<<(OutputStream<_Derived> &_output, const Version &_value) {
+template<class Derived_>
+inline OutputStream<Derived_>& operator<<(OutputStream<Derived_> &_output, const Version &_value) {
return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename _Base>
-OutputStream<_Derived> &operator<<(OutputStream<_Derived> &_output, const Enumeration<_Base> &_value) {
- return _output.template writeValue<EmptyDeployment>(_value);
+template<class Derived_, typename Base_>
+OutputStream<Derived_> &operator<<(OutputStream<Derived_> &_output, const Enumeration<Base_> &_value) {
+ return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename... _Types>
-OutputStream<_Derived> &operator<<(OutputStream<_Derived> &_output, const Struct<_Types...> &_value) {
- return _output.template writeValue<EmptyDeployment>(_value);
+template<class Derived_, typename... Types_>
+OutputStream<Derived_> &operator<<(OutputStream<Derived_> &_output, const Struct<Types_...> &_value) {
+ return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived, class _PolymorphicStruct>
-OutputStream<_Derived> &operator<<(OutputStream<_Derived> &_output, const std::shared_ptr<_PolymorphicStruct> &_value) {
- return _output.template writeValue<EmptyDeployment>(_value);
+template<class Derived_, class PolymorphicStruct_>
+OutputStream<Derived_> &operator<<(OutputStream<Derived_> &_output, const std::shared_ptr<PolymorphicStruct_> &_value) {
+ return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename... _Types>
-OutputStream<_Derived> &operator<<(OutputStream<_Derived> &_output, const Variant<_Types...> &_value) {
- return _output.template writeValue<EmptyDeployment>(_value);
+template<class Derived_, typename... Types_>
+OutputStream<Derived_> &operator<<(OutputStream<Derived_> &_output, const Variant<Types_...> &_value) {
+ return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename _ElementType>
-OutputStream<_Derived> &operator<<(OutputStream<_Derived> &_output, const std::vector<_ElementType> &_value) {
- return _output.template writeValue<EmptyDeployment>(_value);
+template<class Derived_, typename ElementType_>
+OutputStream<Derived_> &operator<<(OutputStream<Derived_> &_output, const std::vector<ElementType_> &_value) {
+ return _output.template writeValue<EmptyDeployment>(_value);
}
-template<class _Derived, typename _KeyType, typename _ValueType, typename _HasherType>
-OutputStream<_Derived> &operator<<(OutputStream<_Derived> &_output,
- const std::unordered_map<_KeyType, _ValueType, _HasherType> &_value) {
- return _output.template writeValue<EmptyDeployment>(_value);
+template<class Derived_, typename KeyType_, typename ValueType_, typename HasherType_>
+OutputStream<Derived_> &operator<<(OutputStream<Derived_> &_output,
+ const std::unordered_map<KeyType_, ValueType_, HasherType_> &_value) {
+ return _output.template writeValue<EmptyDeployment>(_value);
}
} // namespace CommonAPI
diff --git a/include/CommonAPI/Proxy.hpp b/include/CommonAPI/Proxy.hpp
index 5b7d745..993348b 100644
--- a/include/CommonAPI/Proxy.hpp
+++ b/include/CommonAPI/Proxy.hpp
@@ -26,20 +26,20 @@ typedef ReadonlyAttribute<Version> InterfaceVersionAttribute;
class Proxy {
public:
- COMMONAPI_EXPORT virtual ~Proxy() {}
+ COMMONAPI_EXPORT virtual ~Proxy() {}
- COMMONAPI_EXPORT const Address &getAddress() const;
+ COMMONAPI_EXPORT const Address &getAddress() const;
- COMMONAPI_EXPORT virtual bool isAvailable() const = 0;
+ COMMONAPI_EXPORT virtual bool isAvailable() const = 0;
- COMMONAPI_EXPORT virtual bool isAvailableBlocking() const = 0;
+ COMMONAPI_EXPORT virtual bool isAvailableBlocking() const = 0;
- COMMONAPI_EXPORT virtual ProxyStatusEvent& getProxyStatusEvent() = 0;
+ COMMONAPI_EXPORT virtual ProxyStatusEvent& getProxyStatusEvent() = 0;
- COMMONAPI_EXPORT virtual InterfaceVersionAttribute& getInterfaceVersionAttribute() = 0;
+ COMMONAPI_EXPORT virtual InterfaceVersionAttribute& getInterfaceVersionAttribute() = 0;
protected:
- Address address_;
+ Address address_;
};
} // namespace CommonAPI
diff --git a/include/CommonAPI/ProxyManager.hpp b/include/CommonAPI/ProxyManager.hpp
index 571eb97..d7bcada 100644
--- a/include/CommonAPI/ProxyManager.hpp
+++ b/include/CommonAPI/ProxyManager.hpp
@@ -39,7 +39,7 @@ public:
virtual const ConnectionId_t &getConnectionId() const = 0;
virtual void getAvailableInstances(CommonAPI::CallStatus&, std::vector<std::string>& availableInstances) = 0;
- virtual std::future<CallStatus> getAvailableInstancesAsync(GetAvailableInstancesCallback callback) = 0;
+ virtual std::future<CallStatus> getAvailableInstancesAsync(GetAvailableInstancesCallback callback) = 0;
virtual void getInstanceAvailabilityStatus(const std::string& instanceAddress,
CallStatus& callStatus,
@@ -50,22 +50,22 @@ public:
virtual InstanceAvailabilityStatusChangedEvent& getInstanceAvailabilityStatusChangedEvent() = 0;
- template<template<typename ...> class _ProxyClass, typename ... _AttributeExtensions>
- std::shared_ptr<_ProxyClass<_AttributeExtensions...> >
+ template<template<typename ...> class ProxyClass_, typename ... AttributeExtensions_>
+ std::shared_ptr<ProxyClass_<AttributeExtensions_...> >
buildProxy(const std::string &_instance) {
std::shared_ptr<Proxy> proxy = createProxy(getDomain(), getInterface(), _instance, getConnectionId());
if (proxy) {
- return std::make_shared<_ProxyClass<_AttributeExtensions...>>(proxy);
+ return std::make_shared<ProxyClass_<AttributeExtensions_...>>(proxy);
}
return NULL;
}
protected:
- 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 &,
+ const ConnectionId_t &_connection) const;
};
} // namespace CommonAPI
diff --git a/include/CommonAPI/Runtime.hpp b/include/CommonAPI/Runtime.hpp
index 8d33d48..09c0d3c 100644
--- a/include/CommonAPI/Runtime.hpp
+++ b/include/CommonAPI/Runtime.hpp
@@ -41,89 +41,89 @@ public:
COMMONAPI_EXPORT void init();
- template<template<typename ...> class _ProxyClass, typename ... _AttributeExtensions>
+ template<template<typename ...> class ProxyClass_, typename ... AttributeExtensions_>
COMMONAPI_EXPORT std::shared_ptr<
- _ProxyClass<_AttributeExtensions...>
+ ProxyClass_<AttributeExtensions_...>
>
buildProxy(const std::string &_domain,
const std::string &_instance,
const ConnectionId_t &_connectionId = DEFAULT_CONNECTION_ID) {
std::shared_ptr<Proxy> proxy
= createProxy(_domain,
- _ProxyClass<_AttributeExtensions...>::getInterface(),
+ ProxyClass_<AttributeExtensions_...>::getInterface(),
_instance,
_connectionId);
if (proxy) {
- return std::make_shared<_ProxyClass<_AttributeExtensions...>>(proxy);
+ return std::make_shared<ProxyClass_<AttributeExtensions_...>>(proxy);
}
return nullptr;
}
- template<template<typename ...> class _ProxyClass, typename ... _AttributeExtensions>
+ template<template<typename ...> class ProxyClass_, typename ... AttributeExtensions_>
COMMONAPI_EXPORT std::shared_ptr<
- _ProxyClass<_AttributeExtensions...>
+ ProxyClass_<AttributeExtensions_...>
>
buildProxy(const std::string &_domain,
const std::string &_instance,
std::shared_ptr<MainLoopContext> _context) {
std::shared_ptr<Proxy> proxy
= createProxy(_domain,
- _ProxyClass<_AttributeExtensions...>::getInterface(),
+ ProxyClass_<AttributeExtensions_...>::getInterface(),
_instance,
_context);
if (proxy) {
- return std::make_shared<_ProxyClass<_AttributeExtensions...>>(proxy);
+ return std::make_shared<ProxyClass_<AttributeExtensions_...>>(proxy);
}
return nullptr;
}
- template <template<typename ...> class _ProxyClass, template<typename> class _AttributeExtension>
- COMMONAPI_EXPORT std::shared_ptr<typename DefaultAttributeProxyHelper<_ProxyClass, _AttributeExtension>::class_t>
+ template <template<typename ...> class ProxyClass_, template<typename> class AttributeExtension_>
+ COMMONAPI_EXPORT std::shared_ptr<typename DefaultAttributeProxyHelper<ProxyClass_, AttributeExtension_>::class_t>
buildProxyWithDefaultAttributeExtension(const std::string &_domain,
const std::string &_instance,
const ConnectionId_t &_connectionId = DEFAULT_CONNECTION_ID) {
std::shared_ptr<Proxy> proxy
= createProxy(_domain,
- DefaultAttributeProxyHelper<_ProxyClass, _AttributeExtension>::class_t::getInterface(),
+ DefaultAttributeProxyHelper<ProxyClass_, AttributeExtension_>::class_t::getInterface(),
_instance,
_connectionId);
if (proxy) {
- return std::make_shared<typename DefaultAttributeProxyHelper<_ProxyClass, _AttributeExtension>::class_t>(proxy);
+ return std::make_shared<typename DefaultAttributeProxyHelper<ProxyClass_, AttributeExtension_>::class_t>(proxy);
}
return nullptr;
}
- template <template<typename ...> class _ProxyClass, template<typename> class _AttributeExtension>
- COMMONAPI_EXPORT std::shared_ptr<typename DefaultAttributeProxyHelper<_ProxyClass, _AttributeExtension>::class_t>
+ template <template<typename ...> class ProxyClass_, template<typename> class AttributeExtension_>
+ COMMONAPI_EXPORT std::shared_ptr<typename DefaultAttributeProxyHelper<ProxyClass_, AttributeExtension_>::class_t>
buildProxyWithDefaultAttributeExtension(const std::string &_domain,
const std::string &_instance,
std::shared_ptr<MainLoopContext> _context) {
std::shared_ptr<Proxy> proxy
= createProxy(_domain,
- DefaultAttributeProxyHelper<_ProxyClass, _AttributeExtension>::class_t::getInterface(),
+ DefaultAttributeProxyHelper<ProxyClass_, AttributeExtension_>::class_t::getInterface(),
_instance,
_context);
if (proxy) {
- return std::make_shared<typename DefaultAttributeProxyHelper<_ProxyClass, _AttributeExtension>::class_t>(proxy);
+ return std::make_shared<typename DefaultAttributeProxyHelper<ProxyClass_, AttributeExtension_>::class_t>(proxy);
}
return nullptr;
}
- template<typename _Stub>
+ template<typename Stub_>
COMMONAPI_EXPORT bool registerService(const std::string &_domain,
const std::string &_instance,
- std::shared_ptr<_Stub> _service,
+ std::shared_ptr<Stub_> _service,
const ConnectionId_t &_connectionId = DEFAULT_CONNECTION_ID) {
- return registerStub(_domain, _Stub::StubInterface::getInterface(), _instance, _service, _connectionId);
+ return registerStub(_domain, Stub_::StubInterface::getInterface(), _instance, _service, _connectionId);
}
- template<typename _Stub>
+ template<typename Stub_>
COMMONAPI_EXPORT bool registerService(const std::string &_domain,
const std::string &_instance,
- std::shared_ptr<_Stub> _service,
+ std::shared_ptr<Stub_> _service,
std::shared_ptr<MainLoopContext> _context) {
- return registerStub(_domain, _Stub::StubInterface::getInterface(), _instance, _service, _context);
+ return registerStub(_domain, Stub_::StubInterface::getInterface(), _instance, _service, _context);
}
COMMONAPI_EXPORT bool unregisterService(const std::string &_domain,
@@ -147,9 +147,9 @@ private:
std::shared_ptr<MainLoopContext>);
COMMONAPI_EXPORT std::shared_ptr<Proxy> createProxyHelper(const std::string &, const std::string &, const std::string &,
- const ConnectionId_t &);
+ const ConnectionId_t &, bool);
COMMONAPI_EXPORT std::shared_ptr<Proxy> createProxyHelper(const std::string &, const std::string &, const std::string &,
- std::shared_ptr<MainLoopContext>);
+ std::shared_ptr<MainLoopContext>, bool);
COMMONAPI_EXPORT bool registerStub(const std::string &, const std::string &, const std::string &,
@@ -157,9 +157,9 @@ private:
COMMONAPI_EXPORT bool registerStub(const std::string &, const std::string &, const std::string &,
std::shared_ptr<StubBase>, std::shared_ptr<MainLoopContext>);
COMMONAPI_EXPORT bool registerStubHelper(const std::string &, const std::string &, const std::string &,
- std::shared_ptr<StubBase>, const ConnectionId_t &);
+ std::shared_ptr<StubBase>, const ConnectionId_t &, bool);
COMMONAPI_EXPORT bool registerStubHelper(const std::string &, const std::string &, const std::string &,
- std::shared_ptr<StubBase>, std::shared_ptr<MainLoopContext>);
+ std::shared_ptr<StubBase>, std::shared_ptr<MainLoopContext>, bool);
COMMONAPI_EXPORT bool unregisterStub(const std::string &, const std::string &, const std::string &);
diff --git a/include/CommonAPI/SelectiveEvent.hpp b/include/CommonAPI/SelectiveEvent.hpp
index ffae1bf..2eef184 100644
--- a/include/CommonAPI/SelectiveEvent.hpp
+++ b/include/CommonAPI/SelectiveEvent.hpp
@@ -14,11 +14,11 @@
namespace CommonAPI {
-template<typename ... _Arguments>
-class SelectiveEvent: public Event<_Arguments...> {
+template<typename ... Arguments_>
+class SelectiveEvent: public Event<Arguments_...> {
public:
- typedef typename Event<_Arguments...>::Listener Listener;
- typedef typename Event<_Arguments...>::Subscription Subscription;
+ typedef typename Event<Arguments_...>::Listener Listener;
+ typedef typename Event<Arguments_...>::Subscription Subscription;
virtual ~SelectiveEvent() {}
};
diff --git a/include/CommonAPI/SerializableArguments.hpp b/include/CommonAPI/SerializableArguments.hpp
index 1f2af63..c19633a 100644
--- a/include/CommonAPI/SerializableArguments.hpp
+++ b/include/CommonAPI/SerializableArguments.hpp
@@ -15,45 +15,47 @@
namespace CommonAPI {
-template<class _In, class _Out, typename... _Arguments>
+template<class In_, class Out_, typename... Arguments_>
struct SerializableArguments;
-template<class _In, class _Out>
-struct SerializableArguments<_In, _Out> {
- static bool serialize(OutputStream<_Out> &_output) {
+template<class In_, class Out_>
+struct SerializableArguments<In_, Out_> {
+ static bool serialize(OutputStream<Out_> &_output) {
+ (void)_output;
return true;
}
- static bool deserialize(InputStream<_In> &_input) {
+ static bool deserialize(InputStream<In_> &_input) {
+ (void)_input;
return true;
}
};
-template<class _In, class _Out, typename _ArgumentType>
-struct SerializableArguments<_In, _Out, _ArgumentType> {
- static bool serialize(OutputStream<_Out> &_output, const _ArgumentType &_argument) {
+template<class In_, class Out_, typename ArgumentType_>
+struct SerializableArguments<In_, Out_, ArgumentType_> {
+ static bool serialize(OutputStream<Out_> &_output, const ArgumentType_ &_argument) {
_output << _argument;
return !_output.hasError();
}
- static bool deserialize(InputStream<_In> &_input, _ArgumentType &_argument) {
+ static bool deserialize(InputStream<In_> &_input, ArgumentType_ &_argument) {
_input >> _argument;
return !_input.hasError();
}
};
-template <class _In, class _Out, typename _ArgumentType, typename ... _Rest>
-struct SerializableArguments<_In, _Out, _ArgumentType, _Rest...> {
- static bool serialize(OutputStream<_Out> &_output, const _ArgumentType &_argument, const _Rest&... _rest) {
+template <class In_, class Out_, typename ArgumentType_, typename ... Rest_>
+struct SerializableArguments<In_, Out_, ArgumentType_, Rest_...> {
+ static bool serialize(OutputStream<Out_> &_output, const ArgumentType_ &_argument, const Rest_&... _rest) {
_output << _argument;
return !_output.hasError() ?
- SerializableArguments<_In, _Out, _Rest...>::serialize(_output, _rest...) : false;
+ SerializableArguments<In_, Out_, Rest_...>::serialize(_output, _rest...) : false;
}
- static bool deserialize(InputStream<_In> &_input, _ArgumentType &_argument, _Rest&... _rest) {
+ static bool deserialize(InputStream<In_> &_input, ArgumentType_ &_argument, Rest_&... _rest) {
_input >> _argument;
return !_input.hasError() ?
- SerializableArguments<_In, _Out, _Rest...>::deserialize(_input, _rest...) : false;
+ SerializableArguments<In_, Out_, Rest_...>::deserialize(_input, _rest...) : false;
}
};
diff --git a/include/CommonAPI/Struct.hpp b/include/CommonAPI/Struct.hpp
index b8d748f..6dfb692 100644
--- a/include/CommonAPI/Struct.hpp
+++ b/include/CommonAPI/Struct.hpp
@@ -17,66 +17,67 @@ namespace CommonAPI {
typedef uint32_t Serial;
-template<class _Derived>
+template<class Derived_>
class InputStream;
-template<class _Derived>
+template<class Derived_>
class OutputStream;
-template<class _Derived>
+template<class Derived_>
class TypeOutputStream;
template<int, class, class, class>
struct StructReader;
template<
- int _Index, class _Input,
- template<class...> class _V, class... _Values,
- template<class...> class _D, class... _Depls>
-struct StructReader<_Index, _Input, _V<_Values...>, _D<_Depls...>> {
- void operator()(InputStream<_Input> &_input,
- _V<_Values...> &_values,
- const _D<_Depls...> *_depls) {
- StructReader<_Index-1, _Input, _V<_Values...>, _D<_Depls...>>{}(_input, _values, _depls);
- _input.template readValue<>(std::get<_Index>(_values.values_),
- (_depls ? std::get<_Index>(_depls->values_) : nullptr));
- }
+ int Index_, class Input_,
+ template<class...> class V_, class... Values_,
+ template<class...> class D_, class... Depls_>
+struct StructReader<Index_, Input_, V_<Values_...>, D_<Depls_...>> {
+ void operator()(InputStream<Input_> &_input,
+ V_<Values_...> &_values,
+ const D_<Depls_...> *_depls) {
+ StructReader<Index_-1, Input_, V_<Values_...>, D_<Depls_...>>{}(_input, _values, _depls);
+ _input.template readValue<>(std::get<Index_>(_values.values_),
+ (_depls ? std::get<Index_>(_depls->values_) : nullptr));
+ }
};
template<
- int _Index, class _Input,
- template<class...> class _V, class... _Values,
- class _D>
-struct StructReader<_Index, _Input, _V<_Values...>, _D> {
- void operator()(InputStream<_Input> &_input,
- _V<_Values...> &_values,
- const _D *_depls) {
- StructReader<_Index-1, _Input, _V<_Values...>, _D>{}(_input, _values, _depls);
- _input.template readValue<_D>(std::get<_Index>(_values.values_));
- }
+ int Index_, class Input_,
+ template<class...> class V_, class... Values_,
+ class D_>
+struct StructReader<Index_, Input_, V_<Values_...>, D_> {
+ void operator()(InputStream<Input_> &_input,
+ V_<Values_...> &_values,
+ const D_ *_depls) {
+ StructReader<Index_-1, Input_, V_<Values_...>, D_>{}(_input, _values, _depls);
+ _input.template readValue<D_>(std::get<Index_>(_values.values_));
+ }
};
-template<class _Input,
- template<class...> class _V, class... _Values,
- template<class...> class _D, class... _Depls>
-struct StructReader<0, _Input, _V<_Values...>, _D<_Depls...>> {
- void operator()(InputStream<_Input> &_input,
- _V<_Values...> &_values,
- const _D<_Depls...> *_depls) {
- _input.template readValue<>(std::get<0>(_values.values_),
- (_depls ? std::get<0>(_depls->values_) : nullptr));
- }
+template<class Input_,
+ template<class...> class V_, class... Values_,
+ template<class...> class D_, class... Depls_>
+struct StructReader<0, Input_, V_<Values_...>, D_<Depls_...>> {
+ void operator()(InputStream<Input_> &_input,
+ V_<Values_...> &_values,
+ const D_<Depls_...> *_depls) {
+ _input.template readValue<>(std::get<0>(_values.values_),
+ (_depls ? std::get<0>(_depls->values_) : nullptr));
+ }
};
-template<class _Input,
- template<class...> class _V, class... _Values,
- class _D>
-struct StructReader<0, _Input, _V<_Values...>, _D> {
- void operator()(InputStream<_Input> &_input,
- _V<_Values...> &_values,
- const _D *_depls) {
- _input.template readValue<_D>(std::get<0>(_values.values_));
- }
+template<class Input_,
+ template<class...> class V_, class... Values_,
+ class D_>
+struct StructReader<0, Input_, V_<Values_...>, D_> {
+ void operator()(InputStream<Input_> &_input,
+ V_<Values_...> &_values,
+ const D_ *_depls) {
+ (void)_depls;
+ _input.template readValue<D_>(std::get<0>(_values.values_));
+ }
};
@@ -84,97 +85,136 @@ template< int, class, class, class >
struct StructWriter;
template<
- int _Index, class _Output,
- template<class ...> class _V, class... _Values,
- template <class...> class _D, class... _Depls>
-struct StructWriter<_Index, _Output, _V<_Values...>, _D<_Depls...>> {
- void operator()(OutputStream<_Output> &_output,
- const _V<_Values...> &_values,
- const _D<_Depls...> *_depls) {
- StructWriter<_Index-1, _Output, _V<_Values...>, _D<_Depls...>>{}(_output, _values, _depls);
- _output.template writeValue<>(std::get<_Index>(_values.values_),
- (_depls ? std::get<_Index>(_depls->values_) : nullptr));
- }
+ int Index_, class Output_,
+ template<class ...> class V_, class... Values_,
+ template <class...> class D_, class... Depls_>
+struct StructWriter<Index_, Output_, V_<Values_...>, D_<Depls_...>> {
+ void operator()(OutputStream<Output_> &_output,
+ const V_<Values_...> &_values,
+ const D_<Depls_...> *_depls) {
+ StructWriter<Index_-1, Output_, V_<Values_...>, D_<Depls_...>>{}(_output, _values, _depls);
+ _output.template writeValue<>(std::get<Index_>(_values.values_),
+ (_depls ? std::get<Index_>(_depls->values_) : nullptr));
+ }
};
template<
- int _Index, class _Output,
- template<class...> class _V, class... _Values,
- class _D>
-struct StructWriter<_Index, _Output, _V<_Values...>, _D> {
- void operator()(OutputStream<_Output> &_output,
- const _V<_Values...> &_values,
- const _D *_depls) {
- StructWriter<_Index-1, _Output, _V<_Values...>, _D>{}(_output, _values, _depls);
- _output.template writeValue<_D>(std::get<_Index>(_values.values_));
- }
+ int Index_, class Output_,
+ template<class...> class V_, class... Values_,
+ class D_>
+struct StructWriter<Index_, Output_, V_<Values_...>, D_> {
+ void operator()(OutputStream<Output_> &_output,
+ const V_<Values_...> &_values,
+ const D_ *_depls) {
+ StructWriter<Index_-1, Output_, V_<Values_...>, D_>{}(_output, _values, _depls);
+ _output.template writeValue<D_>(std::get<Index_>(_values.values_));
+ }
};
-template<class _Output,
- template<class...> class _V, class... _Values,
- template<class...> class _D, class... _Depls>
-struct StructWriter<0, _Output, _V<_Values...>, _D<_Depls...>> {
- void operator()(OutputStream<_Output> &_output,
- const _V<_Values...> &_values,
- const _D<_Depls...> *_depls) {
- _output.template writeValue<>(std::get<0>(_values.values_),
- (_depls ? std::get<0>(_depls->values_) : nullptr));
- }
+template<class Output_,
+ template<class...> class V_, class... Values_,
+ template<class...> class D_, class... Depls_>
+struct StructWriter<0, Output_, V_<Values_...>, D_<Depls_...>> {
+ void operator()(OutputStream<Output_> &_output,
+ const V_<Values_...> &_values,
+ const D_<Depls_...> *_depls) {
+ _output.template writeValue<>(std::get<0>(_values.values_),
+ (_depls ? std::get<0>(_depls->values_) : nullptr));
+ }
};
-template<class _Output,
- template<class...> class _V, class... _Values,
- class _D>
-struct StructWriter<0, _Output, _V<_Values...>, _D> {
- void operator()(OutputStream<_Output> &_output,
- const _V<_Values...> &_values,
- const _D *_depls) {
- _output.template writeValue<_D>(std::get<0>(_values.values_));
- }
+template<class Output_,
+ template<class...> class V_, class... Values_,
+ class D_>
+struct StructWriter<0, Output_, V_<Values_...>, D_> {
+ void operator()(OutputStream<Output_> &_output,
+ const V_<Values_...> &_values,
+ const D_ *_depls) {
+ (void)_depls;
+ _output.template writeValue<D_>(std::get<0>(_values.values_));
+ }
};
-template<int, class, class>
+template<class, int, class, class>
struct StructTypeWriter;
-template<int _Index, class _TypeOutput,
- template<class...> class _V, class... _Values>
-struct StructTypeWriter<_Index, _TypeOutput, _V<_Values...>> {
- void operator()(TypeOutputStream<_TypeOutput> &_output,
- const _V<_Values...> &_values) {
- StructTypeWriter<_Index-1, _TypeOutput, _V<_Values...>>{}(_output, _values);
+template<int Index_, class TypeOutput_,
+ template<class...> class V_, class... Values_>
+struct StructTypeWriter<EmptyDeployment, Index_, TypeOutput_, V_<Values_...>> {
+ void operator()(TypeOutputStream<TypeOutput_> &_output,
+ const V_<Values_...> &_values,
+ const EmptyDeployment *_depl = nullptr) {
+ StructTypeWriter<EmptyDeployment, Index_-1, TypeOutput_, V_<Values_...>>{}(_output, _values, _depl);
#ifdef WIN32
- _output.writeType(std::get<_Index>(_values.values_));
+ _output.writeType(std::get<Index_>(_values.values_), _depl);
#else
- _output.template writeType(std::get<_Index>(_values.values_));
+ _output.template writeType(std::get<Index_>(_values.values_), _depl);
#endif
- }
+ }
};
-template<class _TypeOutput,
- template<class...> class _V, class... _Values>
-struct StructTypeWriter<0, _TypeOutput, _V<_Values...>> {
- void operator()(TypeOutputStream<_TypeOutput> &_output,
- const _V<_Values...> &_values) {
+template<class TypeOutput_,
+ template<class...> class V_, class... Values_>
+struct StructTypeWriter<EmptyDeployment, 0, TypeOutput_, V_<Values_...>> {
+ void operator()(TypeOutputStream<TypeOutput_> &_output,
+ const V_<Values_...> &_values,
+ const EmptyDeployment *_depl = nullptr) {
#ifdef WIN32
- _output.writeType(std::get<0>(_values.values_));
+ _output.writeType(std::get<0>(_values.values_), _depl);
#else
- _output.template writeType(std::get<0>(_values.values_));
+ _output.template writeType(std::get<0>(_values.values_), _depl);
#endif
- }
+ }
+};
+template<typename Deployment_, int Index_, class TypeOutput_,
+ template<class...> class V_, class... Values_>
+struct StructTypeWriter<Deployment_, Index_, TypeOutput_, V_<Values_...>> {
+ void operator()(TypeOutputStream<TypeOutput_> &_output,
+ const V_<Values_...> &_values,
+ const Deployment_ *_depl = nullptr) {
+ StructTypeWriter<Deployment_, Index_-1, TypeOutput_, V_<Values_...>>{}(_output, _values, _depl);
+#ifdef WIN32
+ _output.writeType(std::get<Index_>(_values.values_),
+ (_depl ? std::get<Index_>(_depl->values_)
+ : nullptr));
+#else
+ _output.template writeType(std::get<Index_>(_values.values_),
+ (_depl ? std::get<Index_>(_depl->values_)
+ : nullptr));
+#endif
+ }
+};
+
+template<typename Deployment_, class TypeOutput_,
+ template<class...> class V_, class... Values_>
+struct StructTypeWriter<Deployment_, 0, TypeOutput_, V_<Values_...>> {
+ void operator()(TypeOutputStream<TypeOutput_> &_output,
+ const V_<Values_...> &_values,
+ const Deployment_ *_depl = nullptr) {
+#ifdef WIN32
+ _output.writeType(std::get<0>(_values.values_),
+ (_depl ? std::get<0>(_depl->values_)
+ : nullptr));
+#else
+ _output.template writeType(std::get<0>(_values.values_),
+ (_depl ? std::get<0>(_depl->values_)
+ : nullptr));
+#endif
+ }
};
// Structures are mapped to a (generated) struct which inherits from CommonAPI::Struct.
// CommonAPI::Struct holds the structured data in a tuple. The generated class provides
// getter- and setter-methods for the structure members.
-template<typename... _Types>
+template<typename... Types_>
struct Struct {
- std::tuple<_Types...> values_;
+ std::tuple<Types_...> values_;
};
// Polymorphic structs are mapped to an interface that is derived from the base class
// PolymorphicStruct and contain their parameter in a Struct.
struct PolymorphicStruct {
- virtual const Serial getSerial() const = 0;
+ virtual Serial getSerial() const = 0;
};
} // namespace CommonAPI
diff --git a/include/CommonAPI/Stub.hpp b/include/CommonAPI/Stub.hpp
index 75ee4e0..61db6bd 100644
--- a/include/CommonAPI/Stub.hpp
+++ b/include/CommonAPI/Stub.hpp
@@ -33,21 +33,21 @@ public:
virtual ~StubBase() {}
};
-template<typename _StubAdapter, typename _StubRemoteEventHandler>
+template<typename StubAdapter_, typename StubRemoteEventHandler_>
class Stub: public virtual StubBase {
- static_assert(std::is_base_of<StubAdapter, _StubAdapter>::value, "Invalid StubAdapter Class!");
+ static_assert(std::is_base_of<StubAdapter, StubAdapter_>::value, "Invalid StubAdapter Class!");
public:
- typedef _StubAdapter StubAdapterType;
- typedef _StubRemoteEventHandler RemoteEventHandlerType;
+ typedef StubAdapter_ StubAdapterType;
+ typedef StubRemoteEventHandler_ RemoteEventHandlerType;
virtual ~Stub() {}
- virtual _StubRemoteEventHandler* initStubAdapter(const std::shared_ptr<_StubAdapter> &_stubAdapter) = 0;
+ virtual StubRemoteEventHandler_* initStubAdapter(const std::shared_ptr<StubAdapter_> &_stubAdapter) = 0;
- inline const std::shared_ptr<_StubAdapter> getStubAdapter() const { return stubAdapter_; }
+ inline const std::shared_ptr<StubAdapter_> getStubAdapter() const { return stubAdapter_.lock(); }
protected:
- std::shared_ptr<_StubAdapter> stubAdapter_;
+ std::weak_ptr<StubAdapter_> stubAdapter_;
};
enum SelectiveBroadcastSubscriptionEvent {
diff --git a/include/CommonAPI/TypeOutputStream.hpp b/include/CommonAPI/TypeOutputStream.hpp
index 28f9d01..1728253 100644
--- a/include/CommonAPI/TypeOutputStream.hpp
+++ b/include/CommonAPI/TypeOutputStream.hpp
@@ -18,192 +18,207 @@
namespace CommonAPI {
-template<class _Derived>
+template<class Derived_>
class TypeOutputStream {
public:
- inline TypeOutputStream &writeType(const bool &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const bool &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const int8_t &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const int8_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const int16_t &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const int16_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const int32_t &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const int32_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const int64_t &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const int64_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const uint8_t &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const uint8_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const uint16_t &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const uint16_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const uint32_t &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const uint32_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const uint64_t &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const uint64_t &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const float &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const float &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const double &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const double &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const std::string &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const std::string &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- inline TypeOutputStream &writeType(const Version &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_>
+ inline TypeOutputStream &writeType(const Version &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- template<typename _Type>
- TypeOutputStream &writeType(const Enumeration<_Type> &_value) {
- _Type tmpValue;
- return get()->writeType(tmpValue);
- }
+ template<class Deployment_, typename Type_>
+ TypeOutputStream &writeType(const Enumeration<Type_> &_value, const Deployment_ *_depl = nullptr) {
+ (void)_value;
+ Type_ tmpValue;
+ return get()->writeType(tmpValue, _depl);
+ }
- template<typename... _Types>
- TypeOutputStream &writeType(const Struct<_Types...> &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_, typename... Types_>
+ TypeOutputStream &writeType(const Struct<Types_...> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- template<class _PolymorphicStruct>
- TypeOutputStream &writeType(const std::shared_ptr<_PolymorphicStruct> &_value) {
- return get()->writeType(_value);
+ template<class Deployment_, class PolymorphicStruct_>
+ TypeOutputStream &writeType(const std::shared_ptr<PolymorphicStruct_> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
}
- template<typename... _Types>
- TypeOutputStream &writeType(const Variant<_Types...> &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_, typename... Types_>
+ TypeOutputStream &writeType(const Variant<Types_...> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- template<typename _ElementType>
- TypeOutputStream &writeType(const std::vector<_ElementType> &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_, typename ElementType_>
+ TypeOutputStream &writeType(const std::vector<ElementType_> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
- template<typename _KeyType, typename _ValueType, typename _HasherType>
- TypeOutputStream &writeType(const std::unordered_map<_KeyType, _ValueType, _HasherType> &_value) {
- return get()->writeType(_value);
- }
+ template<class Deployment_, typename KeyType_, typename ValueType_, typename HasherType_>
+ TypeOutputStream &writeType(const std::unordered_map<KeyType_, ValueType_, HasherType_> &_value, const Deployment_ *_depl = nullptr) {
+ return get()->writeType(_value, _depl);
+ }
private:
- inline _Derived *get() {
- return static_cast<_Derived *>(this);
- }
+ inline Derived_ *get() {
+ return static_cast<Derived_ *>(this);
+ }
};
-template<class _Derived>
-inline TypeOutputStream<_Derived> &operator<<(TypeOutputStream<_Derived> &_output, const bool &_value) {
- return _output.writeType(_value);
+
+template<class Derived_>
+inline TypeOutputStream<Derived_> &operator<<(TypeOutputStream<Derived_> &_output, const bool &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const int8_t &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const int8_t &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const int16_t &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const int16_t &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const int32_t &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const int32_t &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const int64_t &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const int64_t &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const uint8_t &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const uint8_t &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const uint16_t &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const uint16_t &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const uint32_t &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const uint32_t &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const uint64_t &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const uint64_t &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const float &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const float &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const double &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const double &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const std::string &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const std::string &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived, typename _Type, typename _TypeDepl>
-inline TypeOutputStream<_Derived> &operator<<(TypeOutputStream<_Derived> &_output, const Deployable<_Type, _TypeDepl> &_value) {
- return _output.writeType(_value.getValue());
+template<class Derived_, typename Type_, typename TypeDepl_>
+inline TypeOutputStream<Derived_> &operator<<(TypeOutputStream<Derived_> &_output, const Deployable<Type_, TypeDepl_> &_value) {
+ return _output.template writeType<TypeDepl_>(_value.getValue(), _value.getDepl());
}
-template<class _Derived>
-inline TypeOutputStream<_Derived>& operator<<(TypeOutputStream<_Derived> &_output, const Version &_value) {
- return _output.writeType(_value);
+template<class Derived_>
+inline TypeOutputStream<Derived_>& operator<<(TypeOutputStream<Derived_> &_output, const Version &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived, typename... _Types>
-TypeOutputStream<_Derived> &operator<<(TypeOutputStream<_Derived> &_output, const Struct<_Types...> &_value) {
- return _output.writeType(_value);
+template<class Derived_, typename... Types_>
+TypeOutputStream<Derived_> &operator<<(TypeOutputStream<Derived_> &_output, const Struct<Types_...> &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived, class _PolymorphicStruct>
-TypeOutputStream<_Derived> &operator<<(TypeOutputStream<_Derived> &_output, const std::shared_ptr<_PolymorphicStruct> &_value) {
- return _output.writeType(_value);
+template<class Derived_, class PolymorphicStruct_>
+TypeOutputStream<Derived_> &operator<<(TypeOutputStream<Derived_> &_output, const std::shared_ptr<PolymorphicStruct_> &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived, typename... _Types>
-TypeOutputStream<_Derived> &operator<<(TypeOutputStream<_Derived> &_output, const Variant<_Types...> &_value) {
- return _output.writeType(_value);
+template<class Derived_, typename... Types_>
+TypeOutputStream<Derived_> &operator<<(TypeOutputStream<Derived_> &_output, const Variant<Types_...> &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived, typename _ElementType>
-TypeOutputStream<_Derived> &operator<<(TypeOutputStream<_Derived> &_output, const std::vector<_ElementType> &_value) {
- return _output.writeType(_value);
+template<class Derived_, typename ElementType_>
+TypeOutputStream<Derived_> &operator<<(TypeOutputStream<Derived_> &_output, const std::vector<ElementType_> &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
-template<class _Derived, typename _KeyType, typename _ValueType, typename _HasherType>
-TypeOutputStream<_Derived> &operator<<(TypeOutputStream<_Derived> &_output,
- const std::unordered_map<_KeyType, _ValueType, _HasherType> &_value) {
- return _output.writeType(_value);
+template<class Derived_, typename KeyType_, typename ValueType_, typename HasherType_>
+TypeOutputStream<Derived_> &operator<<(TypeOutputStream<Derived_> &_output,
+ const std::unordered_map<KeyType_, ValueType_, HasherType_> &_value) {
+ return _output.template writeType<EmptyDeployment>(_value);
}
} // namespace CommonAPI
diff --git a/include/CommonAPI/Types.hpp b/include/CommonAPI/Types.hpp
index de1d85a..9cf62c3 100644
--- a/include/CommonAPI/Types.hpp
+++ b/include/CommonAPI/Types.hpp
@@ -16,6 +16,21 @@
#include <memory>
#include <tuple>
+// define CallStatus before including Event.hpp
+namespace CommonAPI {
+ enum class CallStatus {
+ SUCCESS,
+ OUT_OF_MEMORY,
+ NOT_AVAILABLE,
+ CONNECTION_FAILED,
+ REMOTE_ERROR,
+ UNKNOWN,
+ INVALID_VALUE,
+ SUBSCRIPTION_REFUSED
+ };
+} // namespace CommonAPI
+
+
#include <CommonAPI/ByteBuffer.hpp>
#include <CommonAPI/ContainerUtils.hpp>
#include <CommonAPI/Event.hpp>
@@ -58,15 +73,6 @@ enum class AvailabilityStatus {
NOT_AVAILABLE
};
-enum class CallStatus {
- SUCCESS,
- OUT_OF_MEMORY,
- NOT_AVAILABLE,
- CONNECTION_FAILED,
- REMOTE_ERROR,
- UNKNOWN
-};
-
typedef uint32_t CallId_t;
typedef std::string ConnectionId_t;
typedef int Timeout_t; // in ms, -1 means "forever"
@@ -85,21 +91,21 @@ public:
virtual std::size_t hashCode() = 0;
};
-template <typename ... Args>
+template <typename ... Args_>
struct SelectiveBroadcastFunctorHelper {
- typedef std::function<void(Args...)> SelectiveBroadcastFunctor;
+ typedef std::function<void(Args_...)> SelectiveBroadcastFunctor;
};
typedef std::unordered_set<
- std::shared_ptr<CommonAPI::ClientId>,
- SharedPointerClientIdContentHash,
- SharedPointerClientIdContentEqual
+ std::shared_ptr<CommonAPI::ClientId>,
+ SharedPointerClientIdContentHash,
+ SharedPointerClientIdContentEqual
> ClientIdList;
-template<typename _EnumType>
+template<typename EnumType_>
class EnumHasher {
public:
- size_t operator()(const _EnumType& testEnum) const {
+ size_t operator()(const EnumType_& testEnum) const {
return static_cast<int32_t>(testEnum);
}
};
diff --git a/include/CommonAPI/Variant.hpp b/include/CommonAPI/Variant.hpp
index 7af1b81..34304b9 100644
--- a/include/CommonAPI/Variant.hpp
+++ b/include/CommonAPI/Variant.hpp
@@ -23,13 +23,13 @@
namespace CommonAPI {
-template<class _Derived>
+template<class Derived_>
class InputStream;
-template<class _Derived>
+template<class Derived_>
class OutputStream;
-template<typename... _Types>
+template<typename... Types_>
struct MaxSize;
template<>
@@ -37,21 +37,21 @@ struct MaxSize<> {
static const unsigned int value = 0;
};
-template<typename _Type, typename... _Types>
-struct MaxSize<_Type, _Types...> {
- static const unsigned int current_type_size = sizeof(_Type);
- static const unsigned int next_type_size = MaxSize<_Types...>::value;
+template<typename Type_, typename... Types_>
+struct MaxSize<Type_, Types_...> {
+ static const unsigned int current_type_size = sizeof(Type_);
+ static const unsigned int next_type_size = MaxSize<Types_...>::value;
static const unsigned int value =
current_type_size > next_type_size ?
current_type_size : next_type_size;
};
-template<typename _SearchType, typename... _RestTypes>
+template<typename SearchType_, typename... RestTypes_>
struct VariantTypeSelector;
-template<typename _SearchType, typename... _RestTypes>
-struct VariantTypeSelector<_SearchType, _SearchType, _RestTypes...> {
- typedef _SearchType type;
+template<typename SearchType_, typename... RestTypes_>
+struct VariantTypeSelector<SearchType_, SearchType_, RestTypes_...> {
+ typedef SearchType_ type;
};
/**
@@ -59,14 +59,14 @@ struct VariantTypeSelector<_SearchType, _SearchType, _RestTypes...> {
*
* A templated generic variant class which provides type safe access and operators
*/
-template<typename... _Types>
+template<typename... Types_>
class Variant {
private:
- typedef std::tuple_size<std::tuple<_Types...>> TypesTupleSize;
+ typedef std::tuple_size<std::tuple<Types_...>> TypesTupleSize;
public:
- static const unsigned int maxSize = MaxSize<_Types...>::value;
+ static const unsigned int maxSize = MaxSize<Types_...>::value;
/**
* \brief Construct an empty variant
@@ -120,9 +120,9 @@ public:
*
* @param _value Value to assign
*/
- template<typename _Type>
- typename std::enable_if<!std::is_same<_Type, Variant<_Types...>>::value, Variant<_Types...>&>::type
- operator=(const _Type &_value);
+ template<typename Type_>
+ typename std::enable_if<!std::is_same<Type_, Variant<Types_...>>::value, Variant<Types_...>&>::type
+ operator=(const Type_ &_value);
/**
* \brief Equality of another variant. Must have identical template list and content.
@@ -131,7 +131,7 @@ public:
*
* @param _other Variant to compare
*/
- bool operator==(const Variant<_Types...> &_other) const;
+ bool operator==(const Variant<Types_...> &_other) const;
/**
* \brief Not-Equality of another variant. Must have identical template list and content.
@@ -140,7 +140,7 @@ public:
*
* @param _other Variant to compare
*/
- bool operator!=(const Variant<_Types...> &_other) const;
+ bool operator!=(const Variant<Types_...> &_other) const;
/**
* \brief Testif the contained type is the same as the template on this method.
@@ -149,8 +149,8 @@ public:
*
* @return Is same type
*/
- template<typename _Type>
- const bool isType() const;
+ template<typename Type_>
+ bool isType() const;
/**
* \brief Construct variant with content type set to value.
@@ -159,11 +159,11 @@ public:
*
* @param _value Value to place
*/
- template<typename _Type>
- Variant(const _Type &_value,
- typename std::enable_if<!std::is_const<_Type>::value>::type* = 0,
- typename std::enable_if<!std::is_reference<_Type>::value>::type* = 0,
- typename std::enable_if<!std::is_same<_Type, Variant>::value>::type* = 0);
+ template<typename Type_>
+ Variant(const Type_ &_value,
+ typename std::enable_if<!std::is_const<Type_>::value>::type* = 0,
+ typename std::enable_if<!std::is_reference<Type_>::value>::type* = 0,
+ typename std::enable_if<!std::is_same<Type_, Variant>::value>::type* = 0);
/**
* \brief Construct variant with content type set to value.
@@ -172,19 +172,19 @@ public:
*
* @param _value Value to place
*/
- template<typename _Type>
- Variant(_Type &&_value,
- typename std::enable_if<!std::is_const<_Type>::value>::type* = 0,
- typename std::enable_if<!std::is_reference<_Type>::value>::type* = 0,
- typename std::enable_if<!std::is_same<_Type, Variant>::value>::type* = 0);
+ template<typename Type_>
+ Variant(Type_ &&_value,
+ typename std::enable_if<!std::is_const<Type_>::value>::type* = 0,
+ typename std::enable_if<!std::is_reference<Type_>::value>::type* = 0,
+ typename std::enable_if<!std::is_same<Type_, Variant>::value>::type* = 0);
/**
* \brief Get value of variant, template to content type. Throws exception if type is not contained.
*
* Get value of variant, template to content type. Throws exception if type is not contained.
*/
- template<typename _Type>
- const _Type &get() const;
+ template<typename Type_>
+ const Type_ &get() const;
/**
* \brief Get index in template list of type actually contained, starting at 1 at the end of the template list
@@ -198,476 +198,478 @@ public:
}
private:
- template<typename _Type>
- void set(const _Type &_value, const bool clear);
+ template<typename Type_>
+ void set(const Type_ &_value, const bool clear);
- template<typename _Type>
- void set(_Type &&_value, const bool clear);
+ template<typename Type_>
+ void set(Type_ &&_value, const bool clear);
- template<typename _FriendType>
+ template<typename FriendType_>
friend struct TypeWriter;
- template<typename ... _FriendTypes>
+ template<typename ... FriendTypes_>
friend struct AssignmentVisitor;
- template<typename _FriendType>
+ template<typename FriendType_>
friend struct TypeEqualsVisitor;
- template<typename ... _FriendTypes>
+ template<typename ... FriendTypes_>
friend struct PartialEqualsVisitor;
- template<class _Derived, typename ... _FriendTypes>
+ template<class Derived_, typename ... FriendTypes_>
friend struct InputStreamReadVisitor;
- template<class Variant, typename ... _FTypes>
+ template<class Variant_, typename ... FTypes_>
friend struct ApplyVoidIndexVisitor;
public:
inline bool hasValue() const {
- return (valueType_ < TypesTupleSize::value);
+ return (valueType_ <= TypesTupleSize::value);
}
typename std::aligned_storage<maxSize>::type valueStorage_;
uint8_t valueType_;
};
-template<class _Variant, typename... _Types>
+template<class Variant_, typename... Types_>
struct ApplyVoidIndexVisitor;
-template<class _Variant>
-struct ApplyVoidIndexVisitor<_Variant> {
+template<class Variant_>
+struct ApplyVoidIndexVisitor<Variant_> {
static const uint8_t index = 0;
static
- void visit(_Variant &, uint8_t &) {
+ void visit(Variant_ &, uint8_t &) {
assert(false);
}
};
-template<class _Variant, typename _Type, typename... _Types>
-struct ApplyVoidIndexVisitor<_Variant, _Type, _Types...> {
+template<class Variant_, typename Type_, typename... Types_>
+struct ApplyVoidIndexVisitor<Variant_, Type_, Types_...> {
static const uint8_t index
- = ApplyVoidIndexVisitor<_Variant, _Types...>::index + 1;
+ = ApplyVoidIndexVisitor<Variant_, Types_...>::index + 1;
- static void visit(_Variant &_variant, uint8_t &_index) {
+ static void visit(Variant_ &_variant, uint8_t &_index) {
if (index == _index) {
- new (&_variant.valueStorage_) _Type();
+ new (&_variant.valueStorage_) Type_();
_variant.valueType_ = index;
} else {
ApplyVoidIndexVisitor<
- _Variant, _Types...
+ Variant_, Types_...
>::visit(_variant, _index);
}
}
};
-template<class _Visitor, class _Variant, typename... _Types>
+template<class Visitor_, class Variant_, typename... Types_>
struct ApplyVoidVisitor;
-template<class _Visitor, class _Variant>
-struct ApplyVoidVisitor<_Visitor, _Variant> {
+template<class Visitor_, class Variant_>
+struct ApplyVoidVisitor<Visitor_, Variant_> {
static const uint8_t index = 0;
static
- void visit(_Visitor &, _Variant &) {
+ void visit(Visitor_ &, Variant_ &) {
assert(false);
}
static
- void visit(_Visitor &, const _Variant &) {
+ void visit(Visitor_ &, const Variant_ &) {
assert(false);
}
};
-template<class _Visitor, class _Variant, typename _Type, typename ... _Types>
-struct ApplyVoidVisitor<_Visitor, _Variant, _Type, _Types...> {
+template<class Visitor_, class Variant_, typename Type_, typename ... Types_>
+struct ApplyVoidVisitor<Visitor_, Variant_, Type_, Types_...> {
static const uint8_t index
- = ApplyVoidVisitor<_Visitor, _Variant, _Types...>::index + 1;
+ = ApplyVoidVisitor<Visitor_, Variant_, Types_...>::index + 1;
- static void visit(_Visitor &_visitor, _Variant &_variant) {
+ static void visit(Visitor_ &_visitor, Variant_ &_variant) {
if (_variant.getValueType() == index) {
- _visitor(_variant.template get<_Type>());
+ _visitor(_variant.template get<Type_>());
} else {
ApplyVoidVisitor<
- _Visitor, _Variant, _Types...
+ Visitor_, Variant_, Types_...
>::visit(_visitor, _variant);
}
}
- static void visit(_Visitor &_visitor, const _Variant &_variant) {
+ static void visit(Visitor_ &_visitor, const Variant_ &_variant) {
if (_variant.getValueType() == index) {
- _visitor(_variant.template get<_Type>());
+ _visitor(_variant.template get<Type_>());
} else {
ApplyVoidVisitor<
- _Visitor, _Variant, _Types...
+ Visitor_, Variant_, Types_...
>::visit(_visitor, _variant);
}
}
};
-template<class _Visitor, class _Variant, typename ... _Types>
+template<class Visitor_, class Variant_, typename ... Types_>
struct ApplyBoolVisitor;
-template<class _Visitor, class _Variant>
-struct ApplyBoolVisitor<_Visitor, _Variant> {
+template<class Visitor_, class Variant_>
+struct ApplyBoolVisitor<Visitor_, Variant_> {
static const uint8_t index = 0;
- static bool visit(_Visitor &, _Variant &) {
+ static bool visit(Visitor_ &, Variant_ &) {
assert(false);
return false;
}
};
-template<class _Visitor, class _Variant, typename _Type, typename ... _Types>
-struct ApplyBoolVisitor<_Visitor, _Variant, _Type, _Types...> {
+template<class Visitor_, class Variant_, typename Type_, typename ... Types_>
+struct ApplyBoolVisitor<Visitor_, Variant_, Type_, Types_...> {
static const uint8_t index
- = ApplyBoolVisitor<_Visitor, _Variant, _Types...>::index + 1;
+ = ApplyBoolVisitor<Visitor_, Variant_, Types_...>::index + 1;
- static bool visit(_Visitor &_visitor, _Variant &_variant) {
+ static bool visit(Visitor_ &_visitor, Variant_ &_variant) {
if (_variant.getValueType() == index) {
- return _visitor(_variant.template get<_Type>());
+ return _visitor(_variant.template get<Type_>());
} else {
return ApplyBoolVisitor<
- _Visitor, _Variant, _Types...
- >::visit(_visitor, _variant);
+ Visitor_, Variant_, Types_...
+ >::visit(_visitor, _variant);
}
}
};
-template<class _Visitor, class _Variant, class _Deployment, typename ... _Types>
+template<class Visitor_, class Variant_, class Deployment_, typename ... Types_>
struct ApplyStreamVisitor;
-template<class _Visitor, class _Variant, class _Deployment>
-struct ApplyStreamVisitor<_Visitor, _Variant, _Deployment> {
+template<class Visitor_, class Variant_, class Deployment_>
+struct ApplyStreamVisitor<Visitor_, Variant_, Deployment_> {
static const uint8_t index = 0;
static
- void visit(_Visitor &, _Variant &, const _Deployment *) {
+ void visit(Visitor_ &, Variant_ &, const Deployment_ *) {
assert(false);
}
static
- void visit(_Visitor &, const _Variant &, const _Deployment *) {
+ void visit(Visitor_ &, const Variant_ &, const Deployment_ *) {
assert(false);
}
};
-template<class _Visitor, class _Variant, class _Deployment, typename _Type, typename ... _Types>
-struct ApplyStreamVisitor<_Visitor, _Variant, _Deployment, _Type, _Types...> {
+template<class Visitor_, class Variant_, class Deployment_, typename Type_, typename ... Types_>
+struct ApplyStreamVisitor<Visitor_, Variant_, Deployment_, Type_, Types_...> {
static const uint8_t index
- = ApplyStreamVisitor<_Visitor, _Variant, _Deployment, _Types...>::index + 1;
+ = ApplyStreamVisitor<Visitor_, Variant_, Deployment_, Types_...>::index + 1;
- static void visit(_Visitor &_visitor, _Variant &_variant, const _Deployment *_depl) {
+ static void visit(Visitor_ &_visitor, Variant_ &_variant, const Deployment_ *_depl) {
if (_variant.getValueType() == index) {
- _visitor(_variant.template get<_Type>(),
- (_depl ? std::get<std::tuple_size<decltype(_depl->values_)>::value-index>(_depl->values_)
- : nullptr));
+ _visitor(_variant.template get<Type_>(),
+ (_depl ? std::get<std::tuple_size<decltype(_depl->values_)>::value-index>(_depl->values_)
+ : nullptr));
} else {
ApplyStreamVisitor<
- _Visitor, _Variant, _Deployment, _Types...
+ Visitor_, Variant_, Deployment_, Types_...
>::visit(_visitor, _variant, _depl);
}
}
- static void visit(_Visitor &_visitor, const _Variant &_variant, const _Deployment *_depl) {
+ static void visit(Visitor_ &_visitor, const Variant_ &_variant, const Deployment_ *_depl) {
if (_variant.getValueType() == index) {
- _visitor(_variant.template get<_Type>(),
- (_depl ? std::get<std::tuple_size<decltype(_depl->values_)>::value-index>(_depl->values_)
- : nullptr));
+ _visitor(_variant.template get<Type_>(),
+ (_depl ? std::get<std::tuple_size<decltype(_depl->values_)>::value-index>(_depl->values_)
+ : nullptr));
} else {
ApplyStreamVisitor<
- _Visitor, _Variant, _Deployment, _Types...
+ Visitor_, Variant_, Deployment_, Types_...
>::visit(_visitor, _variant, _depl);
}
}
};
-template<uint32_t _Size>
+template<uint32_t Size_>
struct DeleteVisitor {
public:
- DeleteVisitor(typename std::aligned_storage<_Size>::type &_storage)
- : storage_(_storage) {
+ DeleteVisitor(typename std::aligned_storage<Size_>::type &_storage)
+ : storage_(_storage) {
}
- template<typename _Type>
- void operator()(const _Type &) const {
- (reinterpret_cast<const _Type *>(&storage_))->~_Type();
+ template<typename Type_>
+ void operator()(const Type_ &) const {
+ (reinterpret_cast<const Type_ *>(&storage_))->~Type_();
}
private:
- typename std::aligned_storage<_Size>::type &storage_;
+ typename std::aligned_storage<Size_>::type &storage_;
};
-template<class _Derived>
+template<class Derived_>
struct OutputStreamWriteVisitor {
public:
- OutputStreamWriteVisitor(OutputStream<_Derived> &_output)
- : output_(_output) {
+ OutputStreamWriteVisitor(OutputStream<Derived_> &_output)
+ : output_(_output) {
}
- template<typename _Type, typename _Deployment = EmptyDeployment>
- void operator()(const _Type &_value, const _Deployment *_depl = nullptr) const {
- Deployable<_Type, _Deployment> itsValue(_value, _depl);
+ template<typename Type_, typename Deployment_ = EmptyDeployment>
+ void operator()(const Type_ &_value, const Deployment_ *_depl = nullptr) const {
+ Deployable<Type_, Deployment_> itsValue(_value, _depl);
output_ << itsValue;
}
private:
- OutputStream<_Derived> &output_;
+ OutputStream<Derived_> &output_;
};
-template<class _Derived, typename ... _Types>
+template<class Derived_, typename ... Types_>
struct InputStreamReadVisitor {
public:
- InputStreamReadVisitor(InputStream<_Derived> &_input, Variant<_Types...> &_target)
- : input_(_input), target_(_target) {
+ InputStreamReadVisitor(InputStream<Derived_> &_input, Variant<Types_...> &_target)
+ : input_(_input), target_(_target) {
}
- template<typename _Type, typename _Deployment = EmptyDeployment>
- void operator()(const _Type &_value, const _Deployment *_depl = nullptr) {
- Deployable<_Type, _Deployment> itsValue(_depl);
+ template<typename Type_, typename Deployment_ = EmptyDeployment>
+ void operator()(const Type_ &_value, const Deployment_ *_depl = nullptr) {
+ (void)_value;
+ Deployable<Type_, Deployment_> itsValue(_depl);
input_ >> itsValue;
- target_.Variant<_Types...>::template set<_Type>(std::move(itsValue.getValue()), false);
+ target_.Variant<Types_...>::template set<Type_>(std::move(itsValue.getValue()), false);
}
private:
- InputStream<_Derived> &input_;
- Variant<_Types...> &target_;
+ InputStream<Derived_> &input_;
+ Variant<Types_...> &target_;
};
-template<class _Derived>
+template<class Derived_>
struct TypeOutputStreamWriteVisitor {
public:
- TypeOutputStreamWriteVisitor(_Derived &_output)
- : output_(_output) {
+ TypeOutputStreamWriteVisitor(Derived_ &_output)
+ : output_(_output) {
}
- template<typename _Type>
- void operator()(const _Type &_value) const {
- output_ << _value;
+ template<typename Type_, typename Deployment_ = EmptyDeployment>
+ void operator()(const Type_ &_value, const Deployment_ *_depl = nullptr) const {
+ Deployable<Type_, Deployment_> _itsValue(_value, _depl);
+ output_ << _itsValue;
}
private:
- _Derived &output_;
+ Derived_ &output_;
};
-template<typename _Type>
+template<typename Type_>
struct TypeEqualsVisitor
{
public:
- TypeEqualsVisitor(const _Type &_me)
- : me_(_me) {
+ TypeEqualsVisitor(const Type_ &_me)
+ : me_(_me) {
}
- bool operator()(const _Type &_other) const {
+ bool operator()(const Type_ &_other) const {
return (me_ == _other);
}
- template<typename _OtherType>
- bool operator()(const _OtherType &) const {
+ template<typename OtherType_>
+ bool operator()(const OtherType_ &) const {
return false;
}
private:
- const _Type& me_;
+ const Type_& me_;
};
-template<typename ... _Types>
+template<typename ... Types_>
struct PartialEqualsVisitor
{
public:
- PartialEqualsVisitor(const Variant<_Types...> &_me)
- : me_(_me) {
+ PartialEqualsVisitor(const Variant<Types_...> &_me)
+ : me_(_me) {
}
- template<typename _Type>
- bool operator()(const _Type &_other) const {
- TypeEqualsVisitor<_Type> visitor(_other);
+ template<typename Type_>
+ bool operator()(const Type_ &_other) const {
+ TypeEqualsVisitor<Type_> visitor(_other);
return ApplyBoolVisitor<
- TypeEqualsVisitor<_Type>, const Variant<_Types...>, _Types...
- >::visit(visitor, me_);
+ TypeEqualsVisitor<Type_>, const Variant<Types_...>, Types_...
+ >::visit(visitor, me_);
}
private:
- const Variant<_Types...> &me_;
+ const Variant<Types_...> &me_;
};
-template<typename ... _Types>
+template<typename ... Types_>
struct AssignmentVisitor {
public:
- AssignmentVisitor(Variant<_Types...> &_me, const bool _clear = true)
- : me_(_me), clear_(_clear) {
+ AssignmentVisitor(Variant<Types_...> &_me, const bool _clear = true)
+ : me_(_me), clear_(_clear) {
}
- template<typename _Type>
- void operator()(const _Type &_value) const {
- me_.Variant<_Types...>::template set<_Type>(_value, clear_);
+ template<typename Type_>
+ void operator()(const Type_ &_value) const {
+ me_.Variant<Types_...>::template set<Type_>(_value, clear_);
}
- template<typename _Type>
- void operator()(_Type &_value) const {
- me_.Variant<_Types...>::template set<_Type>(_value, clear_);
+ template<typename Type_>
+ void operator()(Type_ &_value) const {
+ me_.Variant<Types_...>::template set<Type_>(_value, clear_);
}
private:
- Variant<_Types...> &me_;
+ Variant<Types_...> &me_;
const bool clear_;
};
-template<typename... _Types>
+template<typename... Types_>
struct TypeSelector;
-template<typename _Type>
-struct TypeSelector<_Type> {
+template<typename Type_>
+struct TypeSelector<Type_> {
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<typename _Type::Literal, _Type, _Types...> {
- typedef _Type type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<typename Type_::Literal, Type_, Types_...> {
+ typedef Type_ type;
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<typename _Type::Literal &, _Type, _Types...> {
- typedef _Type type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<typename Type_::Literal &, Type_, Types_...> {
+ typedef Type_ type;
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<typename _Type::Literal, const _Type&, _Types...> {
- typedef _Type type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<typename Type_::Literal, const Type_&, Types_...> {
+ typedef Type_ type;
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<const typename _Type::Literal &, _Type, _Types...> {
- typedef _Type type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<const typename Type_::Literal &, Type_, Types_...> {
+ typedef Type_ type;
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<_Type, _Type, _Types...> {
- typedef _Type type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<Type_, Type_, Types_...> {
+ typedef Type_ type;
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<_Type, _Type &, _Types...> {
- typedef _Type& type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<Type_, Type_ &, Types_...> {
+ typedef Type_& type;
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<_Type &, _Type, _Types...> {
- typedef _Type type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<Type_ &, Type_, Types_...> {
+ typedef Type_ type;
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<_Type, const _Type &, _Types...> {
- typedef const _Type &type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<Type_, const Type_ &, Types_...> {
+ typedef const Type_ &type;
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<const _Type&, _Type, _Types...> {
- typedef _Type type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<const Type_&, Type_, Types_...> {
+ typedef Type_ type;
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<_Type*, const _Type*, _Types...> {
- typedef const _Type *type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<Type_*, const Type_*, Types_...> {
+ typedef const Type_ *type;
};
-template<typename _Type, typename... _Types>
-struct TypeSelector<_Type &, const _Type &, _Types...> {
- typedef const _Type &type;
+template<typename Type_, typename... Types_>
+struct TypeSelector<Type_ &, const Type_ &, Types_...> {
+ typedef const Type_ &type;
};
-template<typename _U, typename _Type, typename... _Types>
-struct TypeSelector<_U, _Type, _Types...> {
- typedef typename TypeSelector<_U, _Types...>::type type;
+template<typename U_, typename Type_, typename... Types_>
+struct TypeSelector<U_, Type_, Types_...> {
+ typedef typename TypeSelector<U_, Types_...>::type type;
};
-template<typename... _Types>
+template<typename... Types_>
struct TypeIndex;
template<>
struct TypeIndex<> {
static const uint8_t index = 0;
- template<typename _U>
+ template<typename U_>
static uint8_t get() {
return 0;
}
};
-template<typename _Type, typename ... _Types>
-struct TypeIndex<_Type, _Types...> {
- static const uint8_t index = TypeIndex<_Types...>::index + 1;
+template<typename Type_, typename ... Types_>
+struct TypeIndex<Type_, Types_...> {
+ static const uint8_t index = TypeIndex<Types_...>::index + 1;
- template<typename _U>
- static uint8_t get(typename std::enable_if<std::is_same<_Type, _U>::value>::type* = 0) {
+ template<typename U_>
+ static uint8_t get(typename std::enable_if<std::is_same<Type_, U_>::value>::type* = 0) {
return index;
}
- template<typename _U>
- static uint8_t get(typename std::enable_if<!std::is_same<_Type, _U>::value>::type* = 0) {
- return TypeIndex<_Types...>::template get<_U>();
+ template<typename U_>
+ static uint8_t get(typename std::enable_if<!std::is_same<Type_, U_>::value>::type* = 0) {
+ return TypeIndex<Types_...>::template get<U_>();
}
};
-template<typename... _Types>
-Variant<_Types...>::Variant()
- : valueType_(TypesTupleSize::value) {
- ApplyVoidIndexVisitor<Variant<_Types...>, _Types...>::visit(*this, valueType_);
+template<typename... Types_>
+Variant<Types_...>::Variant()
+ : valueType_(TypesTupleSize::value) {
+ ApplyVoidIndexVisitor<Variant<Types_...>, Types_...>::visit(*this, valueType_);
}
-template<typename... _Types>
-Variant<_Types...>::Variant(const Variant &_source) {
- AssignmentVisitor<_Types...> visitor(*this, false);
+template<typename... Types_>
+Variant<Types_...>::Variant(const Variant &_source) {
+ AssignmentVisitor<Types_...> visitor(*this, false);
ApplyVoidVisitor<
- AssignmentVisitor<_Types...> , Variant<_Types...>, _Types...
+ AssignmentVisitor<Types_...> , Variant<Types_...>, Types_...
>::visit(visitor, _source);
}
-template<typename... _Types>
-Variant<_Types...>::Variant(Variant &&_source)
+template<typename... Types_>
+Variant<Types_...>::Variant(Variant &&_source)
{
- AssignmentVisitor<_Types...> visitor(*this, false);
+ AssignmentVisitor<Types_...> visitor(*this, false);
ApplyVoidVisitor<
- AssignmentVisitor<_Types...> , Variant<_Types...>, _Types...
+ AssignmentVisitor<Types_...> , Variant<Types_...>, Types_...
>::visit(visitor, _source);
}
-template<typename... _Types>
-Variant<_Types...>::~Variant() {
+template<typename... Types_>
+Variant<Types_...>::~Variant() {
if (hasValue()) {
DeleteVisitor<maxSize> visitor(valueStorage_);
ApplyVoidVisitor<
- DeleteVisitor<maxSize>, Variant<_Types...>, _Types...
+ DeleteVisitor<maxSize>, Variant<Types_...>, Types_...
>::visit(visitor, *this);
}
}
-template<typename... _Types>
-Variant<_Types...>& Variant<_Types...>::operator=(const Variant<_Types...> &_source) {
- AssignmentVisitor<_Types...> visitor(*this, hasValue());
+template<typename... Types_>
+Variant<Types_...>& Variant<Types_...>::operator=(const Variant<Types_...> &_source) {
+ AssignmentVisitor<Types_...> visitor(*this, hasValue());
ApplyVoidVisitor<
- AssignmentVisitor<_Types...>, Variant<_Types...>, _Types...
+ AssignmentVisitor<Types_...>, Variant<Types_...>, Types_...
>::visit(visitor, _source);
return *this;
}
-template<typename... _Types>
-Variant<_Types...>& Variant<_Types...>::operator=(Variant<_Types...> &&_source) {
- AssignmentVisitor<_Types...> visitor(*this, hasValue());
+template<typename... Types_>
+Variant<Types_...>& Variant<Types_...>::operator=(Variant<Types_...> &&_source) {
+ AssignmentVisitor<Types_...> visitor(*this, hasValue());
ApplyVoidVisitor<
- AssignmentVisitor<_Types...>, Variant<_Types...>, _Types...
+ AssignmentVisitor<Types_...>, Variant<Types_...>, Types_...
>::visit(visitor, _source);
return *this;
}
-template<typename ... _Types>
-template<typename _Type>
-typename std::enable_if<!std::is_same<_Type, Variant<_Types...>>::value, Variant<_Types...>&>::type
-Variant<_Types...>::operator=(const _Type &_value) {
- set<typename TypeSelector<_Type, _Types...>::type>(_value, hasValue());
+template<typename ... Types_>
+template<typename Type_>
+typename std::enable_if<!std::is_same<Type_, Variant<Types_...>>::value, Variant<Types_...>&>::type
+Variant<Types_...>::operator=(const Type_ &_value) {
+ set<typename TypeSelector<Type_, Types_...>::type>(_value, hasValue());
return *this;
}
-template<typename ... _Types>
-template<typename _Type>
-const bool Variant<_Types...>::isType() const {
- typedef typename TypeSelector<_Type, _Types...>::type selected_type_t;
- uint8_t itsType = TypeIndex<_Types...>::template get<selected_type_t>();
+template<typename ... Types_>
+template<typename Type_>
+bool Variant<Types_...>::isType() const {
+ typedef typename TypeSelector<Type_, Types_...>::type selected_type_t;
+ uint8_t itsType = TypeIndex<Types_...>::template get<selected_type_t>();
if (itsType == valueType_) {
return true;
} else {
@@ -675,32 +677,32 @@ const bool Variant<_Types...>::isType() const {
}
}
-template<typename ... _Types>
-template<typename _Type>
-Variant<_Types...>::Variant(const _Type &_value,
- typename std::enable_if<!std::is_const<_Type>::value>::type*,
- typename std::enable_if<!std::is_reference<_Type>::value>::type*,
- typename std::enable_if<!std::is_same<_Type, Variant<_Types...>>::value>::type*) {
- set<typename TypeSelector<_Type, _Types...>::type>(_value, false);
+template<typename ... Types_>
+template<typename Type_>
+Variant<Types_...>::Variant(const Type_ &_value,
+ typename std::enable_if<!std::is_const<Type_>::value>::type*,
+ typename std::enable_if<!std::is_reference<Type_>::value>::type*,
+ typename std::enable_if<!std::is_same<Type_, Variant<Types_...>>::value>::type*) {
+ set<typename TypeSelector<Type_, Types_...>::type>(_value, false);
}
-template<typename ... _Types>
-template<typename _Type>
-Variant<_Types...>::Variant(_Type &&_value,
-typename std::enable_if<!std::is_const<_Type>::value>::type*,
-typename std::enable_if<!std::is_reference<_Type>::value>::type*,
-typename std::enable_if<!std::is_same<_Type, Variant<_Types...>>::value>::type*) {
- set<typename TypeSelector<_Type, _Types...>::type>(std::move(_value), false);
+template<typename ... Types_>
+template<typename Type_>
+Variant<Types_...>::Variant(Type_ &&_value,
+typename std::enable_if<!std::is_const<Type_>::value>::type*,
+typename std::enable_if<!std::is_reference<Type_>::value>::type*,
+typename std::enable_if<!std::is_same<Type_, Variant<Types_...>>::value>::type*) {
+ set<typename TypeSelector<Type_, Types_...>::type>(std::move(_value), false);
}
-template<typename ... _Types>
-template<typename _Type>
-const _Type & Variant<_Types...>::get() const {
- typedef typename TypeSelector<_Type, _Types...>::type selected_type_t;
- uint8_t itsType = TypeIndex<_Types...>::template get<selected_type_t>();
+template<typename ... Types_>
+template<typename Type_>
+const Type_ & Variant<Types_...>::get() const {
+ typedef typename TypeSelector<Type_, Types_...>::type selected_type_t;
+ uint8_t itsType = TypeIndex<Types_...>::template get<selected_type_t>();
if (itsType == valueType_) {
- return *(reinterpret_cast<const _Type *>(&valueStorage_));
+ return *(reinterpret_cast<const Type_ *>(&valueStorage_));
} else {
#ifdef __EXCEPTIONS
std::bad_cast toThrow;
@@ -713,51 +715,51 @@ const _Type & Variant<_Types...>::get() const {
}
-template<typename ... _Types>
-template<typename _U>
-void Variant<_Types...>::set(const _U &_value, const bool _clear) {
- typedef typename TypeSelector<_U, _Types...>::type selected_type_t;
+template<typename ... Types_>
+template<typename U_>
+void Variant<Types_...>::set(const U_ &_value, const bool _clear) {
+ typedef typename TypeSelector<U_, Types_...>::type selected_type_t;
if (_clear) {
- DeleteVisitor<maxSize> visitor(valueStorage_);
+ DeleteVisitor<maxSize> visitor(valueStorage_);
ApplyVoidVisitor<
- DeleteVisitor<maxSize>, Variant<_Types...>, _Types...
+ DeleteVisitor<maxSize>, Variant<Types_...>, Types_...
>::visit(visitor, *this);
}
new (&valueStorage_) selected_type_t(std::move(_value));
- valueType_ = TypeIndex<_Types...>::template get<selected_type_t>();
+ valueType_ = TypeIndex<Types_...>::template get<selected_type_t>();
}
-template<typename ... _Types>
-template<typename _U>
-void Variant<_Types...>::set(_U &&_value, const bool _clear) {
- typedef typename TypeSelector<_U, _Types...>::type selected_type_t;
+template<typename ... Types_>
+template<typename U_>
+void Variant<Types_...>::set(U_ &&_value, const bool _clear) {
+ typedef typename TypeSelector<U_, Types_...>::type selected_type_t;
selected_type_t&& any_container_value = std::move(_value);
if(_clear)
{
- DeleteVisitor<maxSize> visitor(valueStorage_);
+ DeleteVisitor<maxSize> visitor(valueStorage_);
ApplyVoidVisitor<
- DeleteVisitor<maxSize>, Variant<_Types...>, _Types...
+ DeleteVisitor<maxSize>, Variant<Types_...>, Types_...
>::visit(visitor, *this);
} else {
new (&valueStorage_) selected_type_t(std::move(any_container_value));
}
- valueType_ = TypeIndex<_Types...>::template get<selected_type_t>();
+ valueType_ = TypeIndex<Types_...>::template get<selected_type_t>();
}
-template<typename ... _Types>
-bool Variant<_Types...>::operator==(const Variant<_Types...> &_other) const
+template<typename ... Types_>
+bool Variant<Types_...>::operator==(const Variant<Types_...> &_other) const
{
- PartialEqualsVisitor<_Types...> visitor(*this);
+ PartialEqualsVisitor<Types_...> visitor(*this);
return ApplyBoolVisitor<
- PartialEqualsVisitor<_Types...>, const Variant<_Types...>, _Types...
- >::visit(visitor, _other);
+ PartialEqualsVisitor<Types_...>, const Variant<Types_...>, Types_...
+ >::visit(visitor, _other);
}
-template<typename ... _Types>
-bool Variant<_Types...>::operator!=(const Variant<_Types...> &_other) const
+template<typename ... Types_>
+bool Variant<Types_...>::operator!=(const Variant<Types_...> &_other) const
{
return !(*this == _other);
}
diff --git a/include/CommonAPI/Version.hpp b/include/CommonAPI/Version.hpp
index 97534b0..997006a 100644
--- a/include/CommonAPI/Version.hpp
+++ b/include/CommonAPI/Version.hpp
@@ -17,7 +17,7 @@ namespace CommonAPI {
struct Version {
Version() = default;
Version(const uint32_t &majorValue, const uint32_t &minorValue)
- : Major(majorValue), Minor(minorValue) {
+ : Major(majorValue), Minor(minorValue) {
}
uint32_t Major;
diff --git a/src/CommonAPI/Address.cpp b/src/CommonAPI/Address.cpp
index 2315a9c..0a7344a 100644
--- a/src/CommonAPI/Address.cpp
+++ b/src/CommonAPI/Address.cpp
@@ -10,22 +10,22 @@
namespace CommonAPI {
Address::Address(const std::string &_address) {
- // TODO: handle error situation (_address is no valid CommonAPI address)
- setAddress(_address);
+ // TODO: handle error situation (_address is no valid CommonAPI address)
+ setAddress(_address);
}
Address::Address(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance)
- : domain_(_domain),
- interface_(_interface),
- instance_(_instance) {
+ const std::string &_interface,
+ const std::string &_instance)
+ : domain_(_domain),
+ interface_(_interface),
+ instance_(_instance) {
}
Address::Address(const Address &_source)
- : domain_(_source.domain_),
- interface_(_source.interface_),
- instance_(_source.instance_) {
+ : domain_(_source.domain_),
+ interface_(_source.interface_),
+ instance_(_source.instance_) {
}
Address::~Address() {
@@ -33,90 +33,90 @@ Address::~Address() {
bool
Address::operator ==(const Address &_other) const {
- return (domain_ == _other.domain_ &&
- interface_ == _other.interface_ &&
- instance_ == _other.instance_);
+ return (domain_ == _other.domain_ &&
+ interface_ == _other.interface_ &&
+ instance_ == _other.instance_);
}
bool
Address::operator !=(const Address &_other) const {
- return (domain_ != _other.domain_ ||
- interface_ != _other.interface_ ||
- instance_ != _other.instance_);
+ return (domain_ != _other.domain_ ||
+ interface_ != _other.interface_ ||
+ instance_ != _other.instance_);
}
bool
Address::operator<(const Address &_other) const {
- if (domain_ < _other.domain_)
- return true;
+ if (domain_ < _other.domain_)
+ return true;
- if (domain_ == _other.domain_) {
- if (interface_ < _other.interface_)
- return true;
+ if (domain_ == _other.domain_) {
+ if (interface_ < _other.interface_)
+ return true;
- if (interface_ == _other.interface_) {
- if (instance_ < _other.instance_)
- return true;
- }
- }
+ if (interface_ == _other.interface_) {
+ if (instance_ < _other.instance_)
+ return true;
+ }
+ }
- return false;
+ return false;
}
std::string
Address::getAddress() const {
- return (domain_ + ":" + interface_ + ":" + instance_);
+ return (domain_ + ":" + interface_ + ":" + instance_);
}
void
Address::setAddress(const std::string &_address) {
- std::istringstream addressStream(_address);
+ std::istringstream addressStream(_address);
if (std::getline(addressStream, domain_, ':')) {
- if (std::getline(addressStream, interface_, ':')) {
- if(!std::getline(addressStream, instance_, ':')) {
- if(std::getline(addressStream, instance_)) {
- }
- }
- }
+ if (std::getline(addressStream, interface_, ':')) {
+ if(!std::getline(addressStream, instance_, ':')) {
+ if(std::getline(addressStream, instance_)) {
+ }
+ }
+ }
}
}
const std::string &
Address::getDomain() const {
- return domain_;
+ return domain_;
}
void
Address::setDomain(const std::string &_domain) {
- domain_ = _domain;
+ domain_ = _domain;
}
const std::string &
Address::getInterface() const {
- return interface_;
+ return interface_;
}
void
Address::setInterface(const std::string &_interface) {
- interface_ = _interface;
+ interface_ = _interface;
}
const std::string &
Address::getInstance() const {
- return instance_;
+ return instance_;
}
void
Address::setInstance(const std::string &_instance) {
- instance_ = _instance;
+ instance_ = _instance;
}
std::ostream &
operator<<(std::ostream &_out, const Address &_address) {
- _out << _address.domain_
- << ":" << _address.interface_
- << ":" << _address.instance_;
- return _out;
+ _out << _address.domain_
+ << ":" << _address.interface_
+ << ":" << _address.instance_;
+ return _out;
}
} // namespace CommonAPI
diff --git a/src/CommonAPI/IniFileReader.cpp b/src/CommonAPI/IniFileReader.cpp
index 1637591..b1c96f1 100644
--- a/src/CommonAPI/IniFileReader.cpp
+++ b/src/CommonAPI/IniFileReader.cpp
@@ -14,101 +14,101 @@ namespace CommonAPI {
const std::map<std::string, std::string> &
IniFileReader::Section::getMappings() const {
- return mappings_;
+ return mappings_;
}
std::string
IniFileReader::Section::getValue(const std::string &_key) const {
- auto it = mappings_.find(_key);
- if (it != mappings_.end()) {
- return it->second;
- }
- return ("");
+ auto it = mappings_.find(_key);
+ if (it != mappings_.end()) {
+ return it->second;
+ }
+ return ("");
}
bool
IniFileReader::load(const std::string &_path) {
- std::ifstream configStream(_path);
- if (configStream.is_open()) {
- COMMONAPI_INFO("Loading ini file from ", _path);
+ std::ifstream configStream(_path);
+ if (configStream.is_open()) {
+ COMMONAPI_INFO("Loading ini file from ", _path);
- int lineCounter(0);
- std::string currentSectionName;
- std::shared_ptr<Section> currentSection;
+ int lineCounter(0);
+ std::string currentSectionName;
+ std::shared_ptr<Section> currentSection;
- while (!configStream.eof()) {
- std::string line;
- std::getline(configStream, line);
- lineCounter++;
+ while (!configStream.eof()) {
+ std::string line;
+ std::getline(configStream, line);
+ lineCounter++;
- trim(line);
+ trim(line);
- std::size_t start = line.find('[');
- if (start == 0) {
- std::size_t end = line.find(']');
- if (end != line.npos) {
- currentSectionName = line.substr(++start, --end);
- if (sections_.end() == sections_.find(currentSectionName)) {
- currentSection = std::make_shared<Section>();
- if (currentSection) {
- sections_[currentSectionName] = currentSection;
- }
- } else {
- COMMONAPI_ERROR("Double definition of section \'",
- currentSectionName,
- "\' ignoring definition (line ",
- lineCounter,
- ")");
- currentSection = nullptr;
- }
- } else {
- COMMONAPI_ERROR("Missing \']\' in section definition (line ",
- lineCounter, ")");
- }
- } else if (currentSection) {
- std::size_t pos = line.find('=');
- if (pos != line.npos) {
- std::string key = line.substr(0, pos);
- trim(key);
- if (currentSection->mappings_.end()
- != currentSection->mappings_.find(key)) {
- COMMONAPI_ERROR("Double definition for key \'",
- key,
- "'\' in section \'",
- currentSectionName,
- "\' (line ",
- lineCounter,
- ")");
- } else {
- std::string value = line.substr(pos+1);
- trim(value);
- currentSection->mappings_[key] = value;
- }
- } else if (line.size() > 0) {
- COMMONAPI_ERROR("Missing \'=\' in key=value definition (line ",
- lineCounter, ")");
- }
- }
- }
- }
- return true;
+ std::size_t start = line.find('[');
+ if (start == 0) {
+ std::size_t end = line.find(']');
+ if (end != line.npos) {
+ currentSectionName = line.substr(++start, --end);
+ if (sections_.end() == sections_.find(currentSectionName)) {
+ currentSection = std::make_shared<Section>();
+ if (currentSection) {
+ sections_[currentSectionName] = currentSection;
+ }
+ } else {
+ COMMONAPI_ERROR("Double definition of section \'",
+ currentSectionName,
+ "\' ignoring definition (line ",
+ lineCounter,
+ ")");
+ currentSection = nullptr;
+ }
+ } else {
+ COMMONAPI_ERROR("Missing \']\' in section definition (line ",
+ lineCounter, ")");
+ }
+ } else if (currentSection) {
+ std::size_t pos = line.find('=');
+ if (pos != line.npos) {
+ std::string key = line.substr(0, pos);
+ trim(key);
+ if (currentSection->mappings_.end()
+ != currentSection->mappings_.find(key)) {
+ COMMONAPI_ERROR("Double definition for key \'",
+ key,
+ "'\' in section \'",
+ currentSectionName,
+ "\' (line ",
+ lineCounter,
+ ")");
+ } else {
+ std::string value = line.substr(pos+1);
+ trim(value);
+ currentSection->mappings_[key] = value;
+ }
+ } else if (line.size() > 0) {
+ COMMONAPI_ERROR("Missing \'=\' in key=value definition (line ",
+ lineCounter, ")");
+ }
+ }
+ }
+ }
+ return true;
}
const std::map<std::string, std::shared_ptr<IniFileReader::Section>> &
IniFileReader::getSections() const {
- return sections_;
+ return sections_;
}
std::shared_ptr<IniFileReader::Section>
IniFileReader::getSection(const std::string &_name) const {
- std::shared_ptr<IniFileReader::Section> section;
+ std::shared_ptr<IniFileReader::Section> section;
- auto sectionIterator = sections_.find(_name);
- if (sectionIterator != sections_.end()) {
- section = sectionIterator->second;
- }
+ auto sectionIterator = sections_.find(_name);
+ if (sectionIterator != sections_.end()) {
+ section = sectionIterator->second;
+ }
- return section;
+ return section;
}
} // namespace CommonAPI
diff --git a/src/CommonAPI/Logger.cpp b/src/CommonAPI/Logger.cpp
index f7e2de3..9527431 100644
--- a/src/CommonAPI/Logger.cpp
+++ b/src/CommonAPI/Logger.cpp
@@ -32,10 +32,10 @@ Logger::Level Logger::maximumLogLevel_(Logger::Level::LL_INFO);
Logger::Logger() {
#ifdef USE_DLT
- DLT_REGISTER_APP("CAPI", "CAPI");
- std::string context = Runtime::getProperty("LogContext");
- if (context == "") context = "CAPI";
- DLT_REGISTER_CONTEXT(dlt_, context.c_str(), "CAPI");
+ DLT_REGISTER_APP("CAPI", "CAPI");
+ std::string context = Runtime::getProperty("LogContext");
+ if (context == "") context = "CAPI";
+ DLT_REGISTER_CONTEXT(dlt_, context.c_str(), "CAPI");
#endif
}
@@ -49,110 +49,116 @@ Logger::~Logger() {
void
Logger::init(bool _useConsole, const std::string &_fileName, bool _useDlt, const std::string &_level) {
#ifdef USE_CONSOLE
- useConsole_ = _useConsole;
+ useConsole_ = _useConsole;
+#else
+ (void)_useConsole;
#endif
#ifdef USE_FILE
- if (_fileName != "") {
- file_ = std::make_shared<std::ofstream>();
- if (file_)
- file_->open(_fileName.c_str(), std::ofstream::out | std::ofstream::app);
- }
+ if (_fileName != "") {
+ file_ = std::make_shared<std::ofstream>();
+ if (file_)
+ file_->open(_fileName.c_str(), std::ofstream::out | std::ofstream::app);
+ }
+#else
+ (void)_fileName;
#endif
#ifdef USE_DLT
- useDlt_ = _useDlt;
+ useDlt_ = _useDlt;
+#else
+ (void)_useDlt;
#endif
#if defined(USE_CONSOLE) || defined(USE_FILE) || defined(USE_DLT)
- maximumLogLevel_ = stringAsLevel(_level);
+ maximumLogLevel_ = stringAsLevel(_level);
#endif
}
void
Logger::doLog(Level _level, const std::string &_message) {
#ifdef USE_CONSOLE
- if (useConsole_) {
+ if (useConsole_) {
std::lock_guard<std::mutex> itsLock(mutex_);
- std::cout << "[CAPI][" << levelAsString(_level) << "] " << _message << std::endl;
- }
+ std::cout << "[CAPI][" << levelAsString(_level) << "] " << _message << std::endl;
+ }
#endif
#ifdef USE_FILE
- if (file_ && file_->is_open()) {
+ if (file_ && file_->is_open()) {
std::lock_guard<std::mutex> itsLock(mutex_);
- (*(file_.get())) << "[CAPI][" << levelAsString(_level) << "] " << _message << std::endl;
- }
+ (*(file_.get())) << "[CAPI][" << levelAsString(_level) << "] " << _message << std::endl;
+ }
#endif
#ifdef USE_DLT
- if (useDlt_) {
- DLT_LOG_STRING(dlt_, levelAsDlt(_level), _message.c_str());
- }
+ if (useDlt_) {
+ DLT_LOG_STRING(dlt_, levelAsDlt(_level), _message.c_str());
+ }
#endif
}
#if defined(USE_CONSOLE) || defined(USE_FILE) || defined(USE_DLT)
Logger::Level
Logger::stringAsLevel(const std::string &_level) {
- if (_level == "fatal")
- return Level::LL_FATAL;
+ if (_level == "fatal")
+ return Level::LL_FATAL;
- if (_level == "error")
- return Level::LL_ERROR;
+ if (_level == "error")
+ return Level::LL_ERROR;
- if (_level == "warning")
- return Level::LL_WARNING;
+ if (_level == "warning")
+ return Level::LL_WARNING;
- if (_level == "info")
- return Level::LL_INFO;
+ if (_level == "info")
+ return Level::LL_INFO;
- if (_level == "debug")
- return Level::LL_DEBUG;
+ if (_level == "debug")
+ return Level::LL_DEBUG;
- if (_level == "verbose")
- return Level::LL_VERBOSE;
+ if (_level == "verbose")
+ return Level::LL_VERBOSE;
- return Level::LL_INFO;
+ return Level::LL_INFO;
}
#endif
#if defined(USE_CONSOLE) || defined(USE_FILE)
std::string
Logger::levelAsString(Logger::Level _level) {
- switch (_level) {
- case Level::LL_FATAL:
- return "FATAL";
- case Level::LL_ERROR:
- return "ERROR";
- case Level::LL_WARNING:
- return "WARNING";
- case Level::LL_INFO:
- return "INFO";
- case Level::LL_DEBUG:
- return "DEBUG";
- case Level::LL_VERBOSE:
- return "VERBOSE";
- default:
- return "";
- }
+ switch (_level) {
+ case Level::LL_FATAL:
+ return "FATAL";
+ case Level::LL_ERROR:
+ return "ERROR";
+ case Level::LL_WARNING:
+ return "WARNING";
+ case Level::LL_INFO:
+ return "INFO";
+ case Level::LL_DEBUG:
+ return "DEBUG";
+ case Level::LL_VERBOSE:
+ return "VERBOSE";
+ default:
+ return "";
+ }
}
#endif
#ifdef USE_DLT
DltLogLevelType
Logger::levelAsDlt(Logger::Level _level) {
- switch (_level) {
- case Level::LL_FATAL:
- return DLT_LOG_FATAL;
- case Level::LL_ERROR:
- return DLT_LOG_ERROR;
- case Level::LL_WARNING:
- return DLT_LOG_WARN;
- case Level::LL_INFO:
- return DLT_LOG_INFO;
- case Level::LL_DEBUG:
- return DLT_LOG_DEBUG;
- case Level::LL_VERBOSE:
- return DLT_LOG_VERBOSE;
- default:
- return DLT_LOG_DEFAULT;
- }
+ switch (_level) {
+ case Level::LL_FATAL:
+ return DLT_LOG_FATAL;
+ case Level::LL_ERROR:
+ return DLT_LOG_ERROR;
+ case Level::LL_WARNING:
+ return DLT_LOG_WARN;
+ case Level::LL_INFO:
+ return DLT_LOG_INFO;
+ case Level::LL_DEBUG:
+ return DLT_LOG_DEBUG;
+ case Level::LL_VERBOSE:
+ return DLT_LOG_VERBOSE;
+ default:
+ return DLT_LOG_DEFAULT;
+ }
}
#endif
diff --git a/src/CommonAPI/MainLoopContext.cpp b/src/CommonAPI/MainLoopContext.cpp
index c8bcb41..65346a6 100644
--- a/src/CommonAPI/MainLoopContext.cpp
+++ b/src/CommonAPI/MainLoopContext.cpp
@@ -12,7 +12,7 @@ int64_t getCurrentTimeInMs() {
}
const std::string &MainLoopContext::getName() const {
- return name_;
+ return name_;
}
DispatchSourceListenerSubscription MainLoopContext::subscribeForDispatchSources(DispatchSourceAddedCallback dispatchAddedCallback, DispatchSourceRemovedCallback dispatchRemovedCallback) {
diff --git a/src/CommonAPI/Proxy.cpp b/src/CommonAPI/Proxy.cpp
index 072fc30..8f672d2 100644
--- a/src/CommonAPI/Proxy.cpp
+++ b/src/CommonAPI/Proxy.cpp
@@ -9,7 +9,7 @@ namespace CommonAPI {
const Address &
Proxy::getAddress() const {
- return address_;
+ return address_;
}
} // namespace CommonAPI
diff --git a/src/CommonAPI/ProxyManager.cpp b/src/CommonAPI/ProxyManager.cpp
index ac3b263..3d55ff9 100644
--- a/src/CommonAPI/ProxyManager.cpp
+++ b/src/CommonAPI/ProxyManager.cpp
@@ -10,9 +10,9 @@ namespace CommonAPI {
std::shared_ptr<Proxy>
ProxyManager::createProxy(
- const std::string &_domain, const std::string &_interface, const std::string &_instance,
- const ConnectionId_t &_connection) const {
- return Runtime::get()->createProxy(_domain, _interface, _instance, _connection);
+ const std::string &_domain, const std::string &_interface, const std::string &_instance,
+ const ConnectionId_t &_connection) const {
+ return Runtime::get()->createProxy(_domain, _interface, _instance, _connection);
}
} // namespace CommonAPI
diff --git a/src/CommonAPI/Runtime.cpp b/src/CommonAPI/Runtime.cpp
index 9cd73eb..b226e52 100644
--- a/src/CommonAPI/Runtime.cpp
+++ b/src/CommonAPI/Runtime.cpp
@@ -161,10 +161,10 @@ Runtime::readConfiguration() {
std::shared_ptr<IniFileReader::Section> section
= reader.getSection("logging");
if (section) {
- std::string itsConsole = section->getValue("console");
- std::string itsFile = section->getValue("file");
- std::string itsDlt = section->getValue("dlt");
- std::string itsLevel = section->getValue("level");
+ itsConsole = section->getValue("console");
+ itsFile = section->getValue("file");
+ itsDlt = section->getValue("dlt");
+ itsLevel = section->getValue("level");
}
Logger::init((itsConsole == "true"),
@@ -208,13 +208,13 @@ Runtime::createProxy(
const ConnectionId_t &_connectionId) {
// Check whether we already know how to create such proxies...
- std::shared_ptr<Proxy> proxy = createProxyHelper(_domain, _interface, _instance, _connectionId);
+ std::shared_ptr<Proxy> proxy = createProxyHelper(_domain, _interface, _instance, _connectionId, false);
if (!proxy) {
// ...it seems do not, lets try to load a library that does...
std::lock_guard<std::mutex> itsGuard(loadMutex_);
std::string library = getLibrary(_domain, _interface, _instance, true);
if (loadLibrary(library)) {
- proxy = createProxyHelper(_domain, _interface, _instance, _connectionId);
+ proxy = createProxyHelper(_domain, _interface, _instance, _connectionId, true);
}
}
return proxy;
@@ -226,13 +226,13 @@ Runtime::createProxy(
std::shared_ptr<MainLoopContext> _context) {
// Check whether we already know how to create such proxies...
- std::shared_ptr<Proxy> proxy = createProxyHelper(_domain, _interface, _instance, _context);
+ std::shared_ptr<Proxy> proxy = createProxyHelper(_domain, _interface, _instance, _context, false);
if (!proxy) {
// ...it seems do not, lets try to load a library that does...
std::lock_guard<std::mutex> itsGuard(loadMutex_);
std::string library = getLibrary(_domain, _interface, _instance, true);
if (loadLibrary(library)) {
- proxy = createProxyHelper(_domain, _interface, _instance, _context);
+ proxy = createProxyHelper(_domain, _interface, _instance, _context, true);
}
}
return proxy;
@@ -243,12 +243,12 @@ bool
Runtime::registerStub(const std::string &_domain, const std::string &_interface, const std::string &_instance,
std::shared_ptr<StubBase> _stub, const ConnectionId_t &_connectionId) {
- bool isRegistered = registerStubHelper(_domain, _interface, _instance, _stub, _connectionId);
+ bool isRegistered = registerStubHelper(_domain, _interface, _instance, _stub, _connectionId, false);
if (!isRegistered) {
std::string library = getLibrary(_domain, _interface, _instance, false);
std::lock_guard<std::mutex> itsGuard(loadMutex_);
if (loadLibrary(library)) {
- isRegistered = registerStubHelper(_domain, _interface, _instance, _stub, _connectionId);
+ isRegistered = registerStubHelper(_domain, _interface, _instance, _stub, _connectionId, true);
}
}
return isRegistered;
@@ -258,12 +258,12 @@ bool
Runtime::registerStub(const std::string &_domain, const std::string &_interface, const std::string &_instance,
std::shared_ptr<StubBase> _stub, std::shared_ptr<MainLoopContext> _context) {
- bool isRegistered = registerStubHelper(_domain, _interface, _instance, _stub, _context);
+ bool isRegistered = registerStubHelper(_domain, _interface, _instance, _stub, _context, false);
if (!isRegistered) {
std::string library = getLibrary(_domain, _interface, _instance, false);
std::lock_guard<std::mutex> itsGuard(loadMutex_);
if (loadLibrary(library)) {
- isRegistered = registerStubHelper(_domain, _interface, _instance, _stub, _context);
+ isRegistered = registerStubHelper(_domain, _interface, _instance, _stub, _context, true);
}
}
return isRegistered;
@@ -304,7 +304,7 @@ Runtime::getLibrary(
library = getProperty("LibraryBase");
if (library != "") {
#ifdef WIN32
- library = library + "-" + defaultBinding_;
+ library = library + "-" + defaultBinding_;
#else
library = "lib" + library + "-" + defaultBinding_;
#endif
@@ -357,7 +357,7 @@ Runtime::loadLibrary(const std::string &_library) {
std::shared_ptr<Proxy>
Runtime::createProxyHelper(const std::string &_domain, const std::string &_interface, const std::string &_instance,
- const std::string &_connectionId) {
+ const std::string &_connectionId, bool _useDefault) {
std::lock_guard<std::mutex> itsLock(factoriesMutex_);
for (auto factory : factories_) {
std::shared_ptr<Proxy> proxy
@@ -365,14 +365,14 @@ Runtime::createProxyHelper(const std::string &_domain, const std::string &_inter
if (proxy)
return proxy;
}
- return (defaultFactory_ ?
+ return (_useDefault && defaultFactory_ ?
defaultFactory_->createProxy(_domain, _interface, _instance, _connectionId)
: nullptr);
}
std::shared_ptr<Proxy>
Runtime::createProxyHelper(const std::string &_domain, const std::string &_interface, const std::string &_instance,
- std::shared_ptr<MainLoopContext> _context ) {
+ std::shared_ptr<MainLoopContext> _context, bool _useDefault) {
std::lock_guard<std::mutex> itsLock(factoriesMutex_);
for (auto factory : factories_) {
std::shared_ptr<Proxy> proxy
@@ -380,14 +380,14 @@ Runtime::createProxyHelper(const std::string &_domain, const std::string &_inter
if (proxy)
return proxy;
}
- return (defaultFactory_ ?
+ return (_useDefault && defaultFactory_ ?
defaultFactory_->createProxy(_domain, _interface, _instance, _context) :
nullptr);
}
bool
Runtime::registerStubHelper(const std::string &_domain, const std::string &_interface, const std::string &_instance,
- std::shared_ptr<StubBase> _stub, const std::string &_connectionId) {
+ std::shared_ptr<StubBase> _stub, const std::string &_connectionId, bool _useDefault) {
bool isRegistered(false);
std::lock_guard<std::mutex> itsLock(factoriesMutex_);
for (auto factory : factories_) {
@@ -395,14 +395,14 @@ Runtime::registerStubHelper(const std::string &_domain, const std::string &_inte
if (isRegistered)
return isRegistered;
}
- return (defaultFactory_ ?
+ return (_useDefault && defaultFactory_ ?
defaultFactory_->registerStub(_domain, _interface, _instance, _stub, _connectionId) :
false);
}
bool
Runtime::registerStubHelper(const std::string &_domain, const std::string &_interface, const std::string &_instance,
- std::shared_ptr<StubBase> _stub, std::shared_ptr<MainLoopContext> _context) {
+ std::shared_ptr<StubBase> _stub, std::shared_ptr<MainLoopContext> _context, bool _useDefault) {
bool isRegistered(false);
std::lock_guard<std::mutex> itsLock(factoriesMutex_);
for (auto factory : factories_) {
@@ -410,7 +410,7 @@ Runtime::registerStubHelper(const std::string &_domain, const std::string &_inte
if (isRegistered)
return isRegistered;
}
- return (defaultFactory_ ?
+ return (_useDefault && defaultFactory_ ?
defaultFactory_->registerStub(_domain, _interface, _instance, _stub, _context) :
false);
}
diff --git a/src/CommonAPI/Utils.cpp b/src/CommonAPI/Utils.cpp
index 2540a86..31d9986 100644
--- a/src/CommonAPI/Utils.cpp
+++ b/src/CommonAPI/Utils.cpp
@@ -27,17 +27,17 @@ std::vector<std::string> split(const std::string& s, char delim) {
void trim(std::string& toTrim) {
toTrim.erase(
- toTrim.begin(),
- std::find_if(
- toTrim.begin(),
- toTrim.end(),
- std::not1(std::ptr_fun(isspace))
- )
- );
+ toTrim.begin(),
+ std::find_if(
+ toTrim.begin(),
+ toTrim.end(),
+ std::not1(std::ptr_fun(isspace))
+ )
+ );
toTrim.erase(
- std::find_if(
- toTrim.rbegin(),
+ std::find_if(
+ toTrim.rbegin(),
toTrim.rend(),
std::not1(std::ptr_fun(isspace))).base(),
toTrim.end()