Merge "sh_binary for 'updateRoutageDomains.sh'."
diff --git a/Android.bp b/Android.bp
index 9d6940f..2b09740 100644
--- a/Android.bp
+++ b/Android.bp
@@ -29,6 +29,7 @@
cc_defaults {
name: "pfw_defaults",
host_supported: true,
+ vendor_available: true,
cflags: [
"-frtti",
@@ -44,6 +45,7 @@
name: "libpfw_utility",
defaults: ["pfw_defaults"],
host_supported: true,
+ vendor_available: true,
export_include_dirs: ["upstream/utility"],
@@ -55,12 +57,11 @@
],
}
-cc_library_shared {
- name: "libremote-processor",
+cc_defaults {
+ name: "libremote-processor-defaults",
defaults: ["pfw_defaults"],
cflags: ["-Wno-implicit-fallthrough"],
- local_include_dirs: ["upstream/asio/stub"],
export_include_dirs: [
"upstream/remote-processor",
"support/android/remote-processor",
@@ -77,8 +78,20 @@
}
cc_library_shared {
- name: "libparameter",
+ name: "libremote-processor",
+ defaults: ["libremote-processor-defaults"],
+
+ local_include_dirs: [
+ "asio/include",
+ "support/android/asio",
+ ],
+ cflags: ["-Wno-unused-local-typedef"],
+}
+
+cc_defaults {
+ name: "libparameter-defaults",
defaults: ["pfw_defaults"],
+ vendor_available: true,
cppflags: [
"-Wno-instantiation-after-specialization",
@@ -93,11 +106,10 @@
"support/android/parameter",
],
shared_libs: [
- "libremote-processor",
+ "libxml2",
],
static_libs: [
"libpfw_utility",
- "libxml2",
],
srcs: [
@@ -166,7 +178,7 @@
"upstream/parameter/ParameterMgr.cpp",
"upstream/parameter/SelectionCriterionType.cpp",
"upstream/parameter/Subsystem.cpp",
- "upstream/parameter/IntegerParameterType.cpp",
+ "upstream/parameter/BaseIntegerParameterType.cpp",
"upstream/parameter/BitParameterType.cpp",
"upstream/parameter/SelectionCriterion.cpp",
"upstream/parameter/XmlElementSerializingContext.cpp",
@@ -182,33 +194,34 @@
"upstream/xmlserializer/XmlStreamDocSink.cpp",
"upstream/parameter/CommandHandlerWrapper.cpp",
],
- target: {
- android: {
- shared_libs: ["libandroidicu"],
- },
- host: {
- shared_libs: [
- "libicui18n",
- "libicuuc",
- ],
- },
- },
}
+cc_library_shared {
+ name: "libparameter",
+ defaults: ["libparameter-defaults"],
+ shared_libs: [
+ "libremote-processor",
+ ],
+}
+
+// Userdebug only, should not be used in a user build device image.
cc_binary {
name: "test-platform",
defaults: ["pfw_defaults"],
- cflags: ["-Wno-implicit-fallthrough"],
local_include_dirs: [
"upstream/test/test-platform",
- "upstream/asio/stub",
+ "support/android/asio",
+ "asio/include",
],
-
srcs: [
"upstream/test/test-platform/main.cpp",
"upstream/test/test-platform/TestPlatform.cpp",
],
+ cflags: [
+ "-Wno-unused-local-typedef",
+ "-Wno-implicit-fallthrough"
+ ],
static_libs: ["libpfw_utility"],
shared_libs: [
"libparameter",
@@ -466,3 +479,17 @@
}
//////////////////////////////////////////////////
+
+cc_binary {
+ name: "remote-process",
+ defaults: ["pfw_defaults"],
+
+ srcs: ["upstream/remote-process/main.cpp"],
+ local_include_dirs: [
+ "upstream/utility",
+ "support/android/asio",
+ "asio/include",
+ ],
+ cflags: ["-Wno-unused-local-typedef"],
+ shared_libs: ["libremote-processor"],
+}
diff --git a/OWNERS b/OWNERS
index 6c55773..cbe2a76 100644
--- a/OWNERS
+++ b/OWNERS
@@ -2,4 +2,5 @@
# Please update this list if you find better candidates.
jeffbailey@google.com
rtenneti@google.com
-francois.gaffie@intel.com # most recent significant change?
+krocard@google.com
+elaurent@google.com
diff --git a/asio-1.10.6/include/asio/detail/config.hpp b/asio-1.10.6/include/asio/detail/config.hpp
index 15797ee..89f3a47 100644
--- a/asio-1.10.6/include/asio/detail/config.hpp
+++ b/asio-1.10.6/include/asio/detail/config.hpp
@@ -50,7 +50,7 @@
// If ASIO_MOVE_CAST isn't defined, and move support is available, define
// ASIO_MOVE_ARG and ASIO_MOVE_CAST to take advantage of rvalue
// references and perfect forwarding.
-#if defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST)
+#if !defined(ASIO_MOVE_CAST)
# define ASIO_MOVE_ARG(type) type&&
# define ASIO_MOVE_CAST(type) static_cast<type&&>
# define ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
diff --git a/asio-1.10.6/include/asio/generic/basic_endpoint.hpp b/asio-1.10.6/include/asio/generic/basic_endpoint.hpp
new file mode 100644
index 0000000..cf9ffdb
--- /dev/null
+++ b/asio-1.10.6/include/asio/generic/basic_endpoint.hpp
@@ -0,0 +1,182 @@
+//
+// generic/basic_endpoint.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef ASIO_GENERIC_BASIC_ENDPOINT_HPP
+#define ASIO_GENERIC_BASIC_ENDPOINT_HPP
+
+
+#include "asio/detail/config.hpp"
+#include "asio/generic/detail/endpoint.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace generic {
+
+/// Describes an endpoint for any socket type.
+/**
+ * The asio::generic::basic_endpoint class template describes an endpoint
+ * that may be associated with any socket type.
+ *
+ * @note The socket types sockaddr type must be able to fit into a
+ * @c sockaddr_storage structure.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe.@n
+ * @e Shared @e objects: Unsafe.
+ *
+ * @par Concepts:
+ * Endpoint.
+ */
+template <typename Protocol>
+class basic_endpoint
+{
+public:
+ /// The protocol type associated with the endpoint.
+ typedef Protocol protocol_type;
+
+ /// The type of the endpoint structure. This type is dependent on the
+ /// underlying implementation of the socket layer.
+ typedef asio::detail::socket_addr_type data_type;
+
+ /// Default constructor.
+ basic_endpoint()
+ {
+ }
+
+ /// Construct an endpoint from the specified socket address.
+ basic_endpoint(const void* socket_address,
+ std::size_t socket_address_size, int socket_protocol = 0)
+ : impl_(socket_address, socket_address_size, socket_protocol)
+ {
+ }
+
+ /// Construct an endpoint from the specific endpoint type.
+ template <typename Endpoint>
+ basic_endpoint(const Endpoint& endpoint)
+ : impl_(endpoint.data(), endpoint.size(), endpoint.protocol().protocol())
+ {
+ }
+
+ /// Copy constructor.
+ basic_endpoint(const basic_endpoint& other)
+ : impl_(other.impl_)
+ {
+ }
+
+ /// Move constructor.
+ basic_endpoint(basic_endpoint&& other)
+ : impl_(other.impl_)
+ {
+ }
+
+ /// Assign from another endpoint.
+ basic_endpoint& operator=(const basic_endpoint& other)
+ {
+ impl_ = other.impl_;
+ return *this;
+ }
+
+ /// Move-assign from another endpoint.
+ basic_endpoint& operator=(basic_endpoint&& other)
+ {
+ impl_ = other.impl_;
+ return *this;
+ }
+
+ /// The protocol associated with the endpoint.
+ protocol_type protocol() const
+ {
+ return protocol_type(impl_.family(), impl_.protocol());
+ }
+
+ /// Get the underlying endpoint in the native type.
+ data_type* data()
+ {
+ return impl_.data();
+ }
+
+ /// Get the underlying endpoint in the native type.
+ const data_type* data() const
+ {
+ return impl_.data();
+ }
+
+ /// Get the underlying size of the endpoint in the native type.
+ std::size_t size() const
+ {
+ return impl_.size();
+ }
+
+ /// Set the underlying size of the endpoint in the native type.
+ void resize(std::size_t new_size)
+ {
+ impl_.resize(new_size);
+ }
+
+ /// Get the capacity of the endpoint in the native type.
+ std::size_t capacity() const
+ {
+ return impl_.capacity();
+ }
+
+ /// Compare two endpoints for equality.
+ friend bool operator==(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return e1.impl_ == e2.impl_;
+ }
+
+ /// Compare two endpoints for inequality.
+ friend bool operator!=(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return !(e1.impl_ == e2.impl_);
+ }
+
+ /// Compare endpoints for ordering.
+ friend bool operator<(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return e1.impl_ < e2.impl_;
+ }
+
+ /// Compare endpoints for ordering.
+ friend bool operator>(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return e2.impl_ < e1.impl_;
+ }
+
+ /// Compare endpoints for ordering.
+ friend bool operator<=(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return !(e2 < e1);
+ }
+
+ /// Compare endpoints for ordering.
+ friend bool operator>=(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return !(e1 < e2);
+ }
+
+private:
+ // The underlying generic endpoint.
+ asio::generic::detail::endpoint impl_;
+};
+
+} // namespace generic
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_GENERIC_BASIC_ENDPOINT_HPP
diff --git a/asio-1.10.6/include/asio/generic/detail/endpoint.hpp b/asio-1.10.6/include/asio/generic/detail/endpoint.hpp
new file mode 100644
index 0000000..fd1513e
--- /dev/null
+++ b/asio-1.10.6/include/asio/generic/detail/endpoint.hpp
@@ -0,0 +1,128 @@
+//
+// generic/detail/endpoint.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef ASIO_GENERIC_DETAIL_ENDPOINT_HPP
+#define ASIO_GENERIC_DETAIL_ENDPOINT_HPP
+
+
+#include "asio/detail/config.hpp"
+
+#include <cstddef>
+#include "asio/detail/socket_types.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace generic {
+namespace detail {
+
+// Helper class for implementing a generic socket endpoint.
+class endpoint
+{
+public:
+ // Default constructor.
+ ASIO_DECL endpoint();
+
+ // Construct an endpoint from the specified raw bytes.
+ ASIO_DECL endpoint(const void* sock_addr,
+ std::size_t sock_addr_size, int sock_protocol);
+
+ // Copy constructor.
+ endpoint(const endpoint& other)
+ : data_(other.data_),
+ size_(other.size_),
+ protocol_(other.protocol_)
+ {
+ }
+
+ // Assign from another endpoint.
+ endpoint& operator=(const endpoint& other)
+ {
+ data_ = other.data_;
+ size_ = other.size_;
+ protocol_ = other.protocol_;
+ return *this;
+ }
+
+ // Get the address family associated with the endpoint.
+ int family() const
+ {
+ return data_.base.sa_family;
+ }
+
+ // Get the socket protocol associated with the endpoint.
+ int protocol() const
+ {
+ return protocol_;
+ }
+
+ // Get the underlying endpoint in the native type.
+ asio::detail::socket_addr_type* data()
+ {
+ return &data_.base;
+ }
+
+ // Get the underlying endpoint in the native type.
+ const asio::detail::socket_addr_type* data() const
+ {
+ return &data_.base;
+ }
+
+ // Get the underlying size of the endpoint in the native type.
+ std::size_t size() const
+ {
+ return size_;
+ }
+
+ // Set the underlying size of the endpoint in the native type.
+ ASIO_DECL void resize(std::size_t size);
+
+ // Get the capacity of the endpoint in the native type.
+ std::size_t capacity() const
+ {
+ return sizeof(asio::detail::sockaddr_storage_type);
+ }
+
+ // Compare two endpoints for equality.
+ ASIO_DECL friend bool operator==(
+ const endpoint& e1, const endpoint& e2);
+
+ // Compare endpoints for ordering.
+ ASIO_DECL friend bool operator<(
+ const endpoint& e1, const endpoint& e2);
+
+private:
+ // The underlying socket address.
+ union data_union
+ {
+ asio::detail::socket_addr_type base;
+ asio::detail::sockaddr_storage_type generic;
+ } data_;
+
+ // The length of the socket address stored in the endpoint.
+ std::size_t size_;
+
+ // The socket protocol associated with the endpoint.
+ int protocol_;
+
+ // Initialise with a specified memory.
+ ASIO_DECL void init(const void* sock_addr,
+ std::size_t sock_addr_size, int sock_protocol);
+};
+
+} // namespace detail
+} // namespace generic
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+# include "asio/generic/detail/impl/endpoint.ipp"
+
+#endif // ASIO_GENERIC_DETAIL_ENDPOINT_HPP
diff --git a/asio-1.10.6/include/asio/generic/detail/impl/endpoint.ipp b/asio-1.10.6/include/asio/generic/detail/impl/endpoint.ipp
new file mode 100644
index 0000000..c33f1db
--- /dev/null
+++ b/asio-1.10.6/include/asio/generic/detail/impl/endpoint.ipp
@@ -0,0 +1,106 @@
+//
+// generic/detail/impl/endpoint.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef ASIO_GENERIC_DETAIL_IMPL_ENDPOINT_IPP
+#define ASIO_GENERIC_DETAIL_IMPL_ENDPOINT_IPP
+
+
+#include "asio/detail/config.hpp"
+
+#include <cstring>
+#include <typeinfo>
+#include "asio/detail/socket_ops.hpp"
+#include "asio/detail/throw_error.hpp"
+#include "asio/detail/throw_exception.hpp"
+#include "asio/error.hpp"
+#include "asio/generic/detail/endpoint.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace generic {
+namespace detail {
+
+endpoint::endpoint()
+{
+ init(0, 0, 0);
+}
+
+endpoint::endpoint(const void* sock_addr,
+ std::size_t sock_addr_size, int sock_protocol)
+{
+ init(sock_addr, sock_addr_size, sock_protocol);
+}
+
+void endpoint::resize(std::size_t new_size)
+{
+ if (new_size > sizeof(asio::detail::sockaddr_storage_type))
+ {
+ asio::error_code ec(asio::error::invalid_argument);
+ asio::detail::throw_error(ec);
+ }
+ else
+ {
+ size_ = new_size;
+ protocol_ = 0;
+ }
+}
+
+bool operator==(const endpoint& e1, const endpoint& e2)
+{
+ using namespace std; // For memcmp.
+ return e1.size() == e2.size() && memcmp(e1.data(), e2.data(), e1.size()) == 0;
+}
+
+bool operator<(const endpoint& e1, const endpoint& e2)
+{
+ if (e1.protocol() < e2.protocol())
+ return true;
+
+ if (e1.protocol() > e2.protocol())
+ return false;
+
+ using namespace std; // For memcmp.
+ std::size_t compare_size = e1.size() < e2.size() ? e1.size() : e2.size();
+ int compare_result = memcmp(e1.data(), e2.data(), compare_size);
+
+ if (compare_result < 0)
+ return true;
+
+ if (compare_result > 0)
+ return false;
+
+ return e1.size() < e2.size();
+}
+
+void endpoint::init(const void* sock_addr,
+ std::size_t sock_addr_size, int sock_protocol)
+{
+ if (sock_addr_size > sizeof(asio::detail::sockaddr_storage_type))
+ {
+ asio::error_code ec(asio::error::invalid_argument);
+ asio::detail::throw_error(ec);
+ }
+
+ using namespace std; // For memset and memcpy.
+ memset(&data_.generic, 0, sizeof(asio::detail::sockaddr_storage_type));
+ memcpy(&data_.generic, sock_addr, sock_addr_size);
+
+ size_ = sock_addr_size;
+ protocol_ = sock_protocol;
+}
+
+} // namespace detail
+} // namespace generic
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_GENERIC_DETAIL_IMPL_ENDPOINT_IPP
diff --git a/asio-1.10.6/include/asio/generic/stream_protocol.hpp b/asio-1.10.6/include/asio/generic/stream_protocol.hpp
new file mode 100644
index 0000000..5fb13d4
--- /dev/null
+++ b/asio-1.10.6/include/asio/generic/stream_protocol.hpp
@@ -0,0 +1,120 @@
+//
+// generic/stream_protocol.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef ASIO_GENERIC_STREAM_PROTOCOL_HPP
+#define ASIO_GENERIC_STREAM_PROTOCOL_HPP
+
+
+#include "asio/detail/config.hpp"
+
+#include <typeinfo>
+#include "asio/basic_socket_iostream.hpp"
+#include "asio/basic_stream_socket.hpp"
+#include "asio/detail/socket_types.hpp"
+#include "asio/detail/throw_exception.hpp"
+#include "asio/generic/basic_endpoint.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace generic {
+
+/// Encapsulates the flags needed for a generic stream-oriented socket.
+/**
+ * The asio::generic::stream_protocol class contains flags necessary for
+ * stream-oriented sockets of any address family and protocol.
+ *
+ * @par Examples
+ * Constructing using a native address family and socket protocol:
+ * @code stream_protocol p(AF_INET, IPPROTO_TCP); @endcode
+ * Constructing from a specific protocol type:
+ * @code stream_protocol p(asio::ip::tcp::v4()); @endcode
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe.@n
+ * @e Shared @e objects: Safe.
+ *
+ * @par Concepts:
+ * Protocol.
+ */
+class stream_protocol
+{
+public:
+ /// Construct a protocol object for a specific address family and protocol.
+ stream_protocol(int address_family, int socket_protocol)
+ : family_(address_family),
+ protocol_(socket_protocol)
+ {
+ }
+
+ /// Construct a generic protocol object from a specific protocol.
+ /**
+ * @throws @c bad_cast Thrown if the source protocol is not stream-oriented.
+ */
+ template <typename Protocol>
+ stream_protocol(const Protocol& source_protocol)
+ : family_(source_protocol.family()),
+ protocol_(source_protocol.protocol())
+ {
+ if (source_protocol.type() != type())
+ {
+ std::bad_cast ex;
+ asio::detail::throw_exception(ex);
+ }
+ }
+
+ /// Obtain an identifier for the type of the protocol.
+ int type() const
+ {
+ return ASIO_OS_DEF(SOCK_STREAM);
+ }
+
+ /// Obtain an identifier for the protocol.
+ int protocol() const
+ {
+ return protocol_;
+ }
+
+ /// Obtain an identifier for the protocol family.
+ int family() const
+ {
+ return family_;
+ }
+
+ /// Compare two protocols for equality.
+ friend bool operator==(const stream_protocol& p1, const stream_protocol& p2)
+ {
+ return p1.family_ == p2.family_ && p1.protocol_ == p2.protocol_;
+ }
+
+ /// Compare two protocols for inequality.
+ friend bool operator!=(const stream_protocol& p1, const stream_protocol& p2)
+ {
+ return !(p1 == p2);
+ }
+
+ /// The type of an endpoint.
+ typedef basic_endpoint<stream_protocol> endpoint;
+
+ /// The generic socket type.
+ typedef basic_stream_socket<stream_protocol> socket;
+
+
+private:
+ int family_;
+ int protocol_;
+};
+
+} // namespace generic
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_GENERIC_STREAM_PROTOCOL_HPP
diff --git a/asio-1.10.6/include/asio/local/basic_endpoint.hpp b/asio-1.10.6/include/asio/local/basic_endpoint.hpp
new file mode 100644
index 0000000..0728f61
--- /dev/null
+++ b/asio-1.10.6/include/asio/local/basic_endpoint.hpp
@@ -0,0 +1,222 @@
+//
+// local/basic_endpoint.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Derived from a public domain implementation written by Daniel Casimiro.
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef ASIO_LOCAL_BASIC_ENDPOINT_HPP
+#define ASIO_LOCAL_BASIC_ENDPOINT_HPP
+
+
+#include "asio/detail/config.hpp"
+
+
+#include "asio/local/detail/endpoint.hpp"
+
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace local {
+
+/// Describes an endpoint for a UNIX socket.
+/**
+ * The asio::local::basic_endpoint class template describes an endpoint
+ * that may be associated with a particular UNIX socket.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe.@n
+ * @e Shared @e objects: Unsafe.
+ *
+ * @par Concepts:
+ * Endpoint.
+ */
+template <typename Protocol>
+class basic_endpoint
+{
+public:
+ /// The protocol type associated with the endpoint.
+ typedef Protocol protocol_type;
+
+ /// The type of the endpoint structure. This type is dependent on the
+ /// underlying implementation of the socket layer.
+ typedef asio::detail::socket_addr_type data_type;
+
+ /// Default constructor.
+ basic_endpoint()
+ {
+ }
+
+ /// Construct an endpoint using the specified path name.
+ basic_endpoint(const char* path_name)
+ : impl_(path_name)
+ {
+ }
+
+ /// Construct an endpoint using the specified path name.
+ basic_endpoint(const std::string& path_name)
+ : impl_(path_name)
+ {
+ }
+
+ /// Copy constructor.
+ basic_endpoint(const basic_endpoint& other)
+ : impl_(other.impl_)
+ {
+ }
+
+ /// Move constructor.
+ basic_endpoint(basic_endpoint&& other)
+ : impl_(other.impl_)
+ {
+ }
+
+ /// Assign from another endpoint.
+ basic_endpoint& operator=(const basic_endpoint& other)
+ {
+ impl_ = other.impl_;
+ return *this;
+ }
+
+ /// Move-assign from another endpoint.
+ basic_endpoint& operator=(basic_endpoint&& other)
+ {
+ impl_ = other.impl_;
+ return *this;
+ }
+
+ /// The protocol associated with the endpoint.
+ protocol_type protocol() const
+ {
+ return protocol_type();
+ }
+
+ /// Get the underlying endpoint in the native type.
+ data_type* data()
+ {
+ return impl_.data();
+ }
+
+ /// Get the underlying endpoint in the native type.
+ const data_type* data() const
+ {
+ return impl_.data();
+ }
+
+ /// Get the underlying size of the endpoint in the native type.
+ std::size_t size() const
+ {
+ return impl_.size();
+ }
+
+ /// Set the underlying size of the endpoint in the native type.
+ void resize(std::size_t new_size)
+ {
+ impl_.resize(new_size);
+ }
+
+ /// Get the capacity of the endpoint in the native type.
+ std::size_t capacity() const
+ {
+ return impl_.capacity();
+ }
+
+ /// Get the path associated with the endpoint.
+ std::string path() const
+ {
+ return impl_.path();
+ }
+
+ /// Set the path associated with the endpoint.
+ void path(const char* p)
+ {
+ impl_.path(p);
+ }
+
+ /// Set the path associated with the endpoint.
+ void path(const std::string& p)
+ {
+ impl_.path(p);
+ }
+
+ /// Compare two endpoints for equality.
+ friend bool operator==(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return e1.impl_ == e2.impl_;
+ }
+
+ /// Compare two endpoints for inequality.
+ friend bool operator!=(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return !(e1.impl_ == e2.impl_);
+ }
+
+ /// Compare endpoints for ordering.
+ friend bool operator<(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return e1.impl_ < e2.impl_;
+ }
+
+ /// Compare endpoints for ordering.
+ friend bool operator>(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return e2.impl_ < e1.impl_;
+ }
+
+ /// Compare endpoints for ordering.
+ friend bool operator<=(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return !(e2 < e1);
+ }
+
+ /// Compare endpoints for ordering.
+ friend bool operator>=(const basic_endpoint<Protocol>& e1,
+ const basic_endpoint<Protocol>& e2)
+ {
+ return !(e1 < e2);
+ }
+
+private:
+ // The underlying UNIX domain endpoint.
+ asio::local::detail::endpoint impl_;
+};
+
+/// Output an endpoint as a string.
+/**
+ * Used to output a human-readable string for a specified endpoint.
+ *
+ * @param os The output stream to which the string will be written.
+ *
+ * @param endpoint The endpoint to be written.
+ *
+ * @return The output stream.
+ *
+ * @relates asio::local::basic_endpoint
+ */
+template <typename Elem, typename Traits, typename Protocol>
+std::basic_ostream<Elem, Traits>& operator<<(
+ std::basic_ostream<Elem, Traits>& os,
+ const basic_endpoint<Protocol>& endpoint)
+{
+ os << endpoint.path();
+ return os;
+}
+
+} // namespace local
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+ // || defined(GENERATING_DOCUMENTATION)
+
+#endif // ASIO_LOCAL_BASIC_ENDPOINT_HPP
diff --git a/asio-1.10.6/include/asio/local/detail/endpoint.hpp b/asio-1.10.6/include/asio/local/detail/endpoint.hpp
new file mode 100644
index 0000000..343f0a9
--- /dev/null
+++ b/asio-1.10.6/include/asio/local/detail/endpoint.hpp
@@ -0,0 +1,126 @@
+//
+// local/detail/endpoint.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Derived from a public domain implementation written by Daniel Casimiro.
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef ASIO_LOCAL_DETAIL_ENDPOINT_HPP
+#define ASIO_LOCAL_DETAIL_ENDPOINT_HPP
+
+
+#include "asio/detail/config.hpp"
+
+
+#include <cstddef>
+#include <string>
+#include "asio/detail/socket_types.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace local {
+namespace detail {
+
+// Helper class for implementing a UNIX domain endpoint.
+class endpoint
+{
+public:
+ // Default constructor.
+ ASIO_DECL endpoint();
+
+ // Construct an endpoint using the specified path name.
+ ASIO_DECL endpoint(const char* path_name);
+
+ // Construct an endpoint using the specified path name.
+ ASIO_DECL endpoint(const std::string& path_name);
+
+ // Copy constructor.
+ endpoint(const endpoint& other)
+ : data_(other.data_),
+ path_length_(other.path_length_)
+ {
+ }
+
+ // Assign from another endpoint.
+ endpoint& operator=(const endpoint& other)
+ {
+ data_ = other.data_;
+ path_length_ = other.path_length_;
+ return *this;
+ }
+
+ // Get the underlying endpoint in the native type.
+ asio::detail::socket_addr_type* data()
+ {
+ return &data_.base;
+ }
+
+ // Get the underlying endpoint in the native type.
+ const asio::detail::socket_addr_type* data() const
+ {
+ return &data_.base;
+ }
+
+ // Get the underlying size of the endpoint in the native type.
+ std::size_t size() const
+ {
+ return path_length_
+ + offsetof(asio::detail::sockaddr_un_type, sun_path);
+ }
+
+ // Set the underlying size of the endpoint in the native type.
+ ASIO_DECL void resize(std::size_t size);
+
+ // Get the capacity of the endpoint in the native type.
+ std::size_t capacity() const
+ {
+ return sizeof(asio::detail::sockaddr_un_type);
+ }
+
+ // Get the path associated with the endpoint.
+ ASIO_DECL std::string path() const;
+
+ // Set the path associated with the endpoint.
+ ASIO_DECL void path(const char* p);
+
+ // Set the path associated with the endpoint.
+ ASIO_DECL void path(const std::string& p);
+
+ // Compare two endpoints for equality.
+ ASIO_DECL friend bool operator==(
+ const endpoint& e1, const endpoint& e2);
+
+ // Compare endpoints for ordering.
+ ASIO_DECL friend bool operator<(
+ const endpoint& e1, const endpoint& e2);
+
+private:
+ // The underlying UNIX socket address.
+ union data_union
+ {
+ asio::detail::socket_addr_type base;
+ asio::detail::sockaddr_un_type local;
+ } data_;
+
+ // The length of the path associated with the endpoint.
+ std::size_t path_length_;
+
+ // Initialise with a specified path.
+ ASIO_DECL void init(const char* path, std::size_t path_length);
+};
+
+} // namespace detail
+} // namespace local
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+# include "asio/local/detail/impl/endpoint.ipp"
+
+
+#endif // ASIO_LOCAL_DETAIL_ENDPOINT_HPP
diff --git a/asio-1.10.6/include/asio/local/detail/impl/endpoint.ipp b/asio-1.10.6/include/asio/local/detail/impl/endpoint.ipp
new file mode 100644
index 0000000..5379398
--- /dev/null
+++ b/asio-1.10.6/include/asio/local/detail/impl/endpoint.ipp
@@ -0,0 +1,123 @@
+//
+// local/detail/impl/endpoint.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Derived from a public domain implementation written by Daniel Casimiro.
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef ASIO_LOCAL_DETAIL_IMPL_ENDPOINT_IPP
+#define ASIO_LOCAL_DETAIL_IMPL_ENDPOINT_IPP
+
+
+#include "asio/detail/config.hpp"
+
+
+#include <cstring>
+#include "asio/detail/socket_ops.hpp"
+#include "asio/detail/throw_error.hpp"
+#include "asio/error.hpp"
+#include "asio/local/detail/endpoint.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace local {
+namespace detail {
+
+endpoint::endpoint()
+{
+ init("", 0);
+}
+
+endpoint::endpoint(const char* path_name)
+{
+ using namespace std; // For strlen.
+ init(path_name, strlen(path_name));
+}
+
+endpoint::endpoint(const std::string& path_name)
+{
+ init(path_name.data(), path_name.length());
+}
+
+void endpoint::resize(std::size_t new_size)
+{
+ if (new_size > sizeof(asio::detail::sockaddr_un_type))
+ {
+ asio::error_code ec(asio::error::invalid_argument);
+ asio::detail::throw_error(ec);
+ }
+ else if (new_size == 0)
+ {
+ path_length_ = 0;
+ }
+ else
+ {
+ path_length_ = new_size
+ - offsetof(asio::detail::sockaddr_un_type, sun_path);
+
+ // The path returned by the operating system may be NUL-terminated.
+ if (path_length_ > 0 && data_.local.sun_path[path_length_ - 1] == 0)
+ --path_length_;
+ }
+}
+
+std::string endpoint::path() const
+{
+ return std::string(data_.local.sun_path, path_length_);
+}
+
+void endpoint::path(const char* p)
+{
+ using namespace std; // For strlen.
+ init(p, strlen(p));
+}
+
+void endpoint::path(const std::string& p)
+{
+ init(p.data(), p.length());
+}
+
+bool operator==(const endpoint& e1, const endpoint& e2)
+{
+ return e1.path() == e2.path();
+}
+
+bool operator<(const endpoint& e1, const endpoint& e2)
+{
+ return e1.path() < e2.path();
+}
+
+void endpoint::init(const char* path_name, std::size_t path_length)
+{
+ if (path_length > sizeof(data_.local.sun_path) - 1)
+ {
+ // The buffer is not large enough to store this address.
+ asio::error_code ec(asio::error::name_too_long);
+ asio::detail::throw_error(ec);
+ }
+
+ using namespace std; // For memcpy.
+ data_.local = asio::detail::sockaddr_un_type();
+ data_.local.sun_family = AF_UNIX;
+ memcpy(data_.local.sun_path, path_name, path_length);
+ path_length_ = path_length;
+
+ // NUL-terminate normal path names. Names that start with a NUL are in the
+ // UNIX domain protocol's "abstract namespace" and are not NUL-terminated.
+ if (path_length > 0 && data_.local.sun_path[0] == 0)
+ data_.local.sun_path[path_length] = 0;
+}
+
+} // namespace detail
+} // namespace local
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+
+#endif // ASIO_LOCAL_DETAIL_IMPL_ENDPOINT_IPP
diff --git a/asio-1.10.6/include/asio/local/stream_protocol.hpp b/asio-1.10.6/include/asio/local/stream_protocol.hpp
new file mode 100644
index 0000000..142a80d
--- /dev/null
+++ b/asio-1.10.6/include/asio/local/stream_protocol.hpp
@@ -0,0 +1,80 @@
+//
+// local/stream_protocol.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef ASIO_LOCAL_STREAM_PROTOCOL_HPP
+#define ASIO_LOCAL_STREAM_PROTOCOL_HPP
+
+
+#include "asio/detail/config.hpp"
+
+
+#include "asio/basic_socket_acceptor.hpp"
+#include "asio/basic_socket_iostream.hpp"
+#include "asio/basic_stream_socket.hpp"
+#include "asio/detail/socket_types.hpp"
+#include "asio/local/basic_endpoint.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace local {
+
+/// Encapsulates the flags needed for stream-oriented UNIX sockets.
+/**
+ * The asio::local::stream_protocol class contains flags necessary for
+ * stream-oriented UNIX domain sockets.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe.@n
+ * @e Shared @e objects: Safe.
+ *
+ * @par Concepts:
+ * Protocol.
+ */
+class stream_protocol
+{
+public:
+ /// Obtain an identifier for the type of the protocol.
+ int type() const
+ {
+ return SOCK_STREAM;
+ }
+
+ /// Obtain an identifier for the protocol.
+ int protocol() const
+ {
+ return 0;
+ }
+
+ /// Obtain an identifier for the protocol family.
+ int family() const
+ {
+ return AF_UNIX;
+ }
+
+ /// The type of a UNIX domain endpoint.
+ typedef basic_endpoint<stream_protocol> endpoint;
+
+ /// The UNIX domain socket type.
+ typedef basic_stream_socket<stream_protocol> socket;
+
+ /// The UNIX domain acceptor type.
+ typedef basic_socket_acceptor<stream_protocol> acceptor;
+
+};
+
+} // namespace local
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+ // || defined(GENERATING_DOCUMENTATION)
+
+#endif // ASIO_LOCAL_STREAM_PROTOCOL_HPP
diff --git a/support/android/asio/asio.hpp b/support/android/asio/asio.hpp
index ca7cd2f..6698fd7 100644
--- a/support/android/asio/asio.hpp
+++ b/support/android/asio/asio.hpp
@@ -42,6 +42,8 @@
#include "asio/error_code.hpp"
#include "asio/io_service.hpp"
#include "asio/ip/tcp.hpp"
+#include "asio/generic/stream_protocol.hpp"
+#include "asio/local/stream_protocol.hpp"
#include "asio/read.hpp"
#include "asio/socket_base.hpp"
#include "asio/system_error.hpp"
diff --git a/support/android/asio/asio_defines.txt b/support/android/asio/asio_defines.txt
index e00ca1e..6218ff5 100644
--- a/support/android/asio/asio_defines.txt
+++ b/support/android/asio/asio_defines.txt
@@ -67,14 +67,14 @@
#undef ASIO_HAS_TIMERFD
#define ASIO_HAS_THREADS
// We are not using asio for iostream, nor serial ports, nor posix file
-// descriptiors, nor with unix sockets
+// descriptiors
#define ASIO_NO_IOSTREAM
#define ASIO_DISABLE_SERIAL_PORT
#undef ASIO_HAS_SERIAL_PORT
#undef ASIO_HAS_POSIX_STREAM_DESCRIPTOR
#define ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR
-#undef ASIO_HAS_LOCAL_SOCKETS
-#define ASIO_DISABLE_LOCAL_SOCKETS
+#define ASIO_HAS_LOCAL_SOCKETS
+#undef ASIO_DISABLE_LOCAL_SOCKETS
// windows-only features
#undef ASIO_HAS_IOCP
#undef ASIO_HAS_WINDOWS_OBJECT_HANDLE
diff --git a/support/android/parameter/version.h b/support/android/parameter/version.h
index 7b0a43e..15d9a7d 100644
--- a/support/android/parameter/version.h
+++ b/support/android/parameter/version.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Intel Corporation
+ * Copyright (c) 2016-2017, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -27,4 +27,4 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define PARAMETER_FRAMEWORK_VERSION "v3.2.4"
+#define PARAMETER_FRAMEWORK_VERSION "v3.2.8"
diff --git a/upstream/.gitattributes b/upstream/.gitattributes
deleted file mode 100644
index b977122..0000000
--- a/upstream/.gitattributes
+++ /dev/null
@@ -1,3 +0,0 @@
-.version export-subst
-.gitattributes export-ignore
-.gitignore export-ignore
diff --git a/upstream/.gitignore b/upstream/.gitignore
deleted file mode 100644
index b3e751b..0000000
--- a/upstream/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-*.pyc
-*.pyo
-*.win
-*.layout
-*.user
-*.user.*
diff --git a/upstream/.travis.yml b/upstream/.travis.yml
index db18b6f..89a0fae 100644
--- a/upstream/.travis.yml
+++ b/upstream/.travis.yml
@@ -1,15 +1,33 @@
+os:
+ - linux
+ - osx
# Use travis docker infrastructure
sudo: false
+# Use a recent OSX image
+# cf.
+# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
+osx_image: xcode7.2
language: cpp
+cache: ccache
env:
global:
- PREFIX=$HOME/prefix
+ - MY_CMAKE_OPTIONS="-DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$HOME/install"
+ - OSX_CMAKE_OPTIONS="-DBUILD_TESTING=OFF -DPYTHON_BINDINGS=OFF -DCLIENT_SIMULATOR=OFF"
+ - CTEST_OUTPUT_ON_FAILURE=1
+ - LINUX=false
+ - OSX=false
compiler:
- gcc
- clang
+matrix:
+ exclude:
+ - os: osx
+ compiler: gcc
+
# Install a recent gcc and gcov,
# it will not be necessary once travis worker is based on ubuntu > 12.04.
# Install SWIG for bindings generation
@@ -23,7 +41,7 @@
sources:
- ubuntu-toolchain-r-test
- george-edison55-precise-backports
- - llvm-toolchain-precise
+ - llvm-toolchain-precise-3.8
# Travis white list of dpkg packages
# https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
packages:
@@ -35,57 +53,83 @@
- python3-dev
- clang-format-3.8
+before_install:
+ # OS detection
+ # TODO: an explicit build matrix may be better but it has limitation, e.g.
+ # each matrix entry may only define a single env variable.
+ - if [ $TRAVIS_OS_NAME = linux ]; then export LINUX=true; fi
+ - if [ $TRAVIS_OS_NAME = osx ]; then export OSX=true; fi
install:
- wget https://codecov.io/bash -O $HOME/codecov; chmod +x $HOME/codecov
# This version of catch is known to work.
- wget --directory-prefix $PREFIX/include
https://raw.github.com/philsquared/Catch/v1.2.1/single_include/catch.hpp
- - wget 'https://01.org/sites/default/files/asio-1.10.6.tar.gz'
- - tar xf asio-1.10.6.tar.gz -C $PREFIX --strip-components=1
+ - wget -O asio-1.10.6.tar.gz https://github.com/chriskohlhoff/asio/archive/asio-1-10-6.tar.gz
+ - tar xf asio-1.10.6.tar.gz -C $PREFIX --strip-components=2 asio-asio-1-10-6/asio
+ # Current limitations on OSX builds: no testing, no client-simulator
+ # (because we haven't found a straightforward way to have CMake find the
+ # python libraries (find_package(PythonLibs)).
+ - if $OSX; then
+ brew update;
+ for package in cmake; do
+ if brew list $package; then
+ brew outdated $package || brew upgrade $package;
+ else
+ brew install $package;
+ fi;
+ done;
+ fi
before_script:
- coverage=OFF
# Force the manualy installed 4.8 version as it is not the default
# Only enable coverage on gcc as clang segfault on coverage file write
+ # Workaround a bug with the ccache/g++-4.8.1 combination
- if [ "$CC" = "gcc" ]; then
export CC=gcc-4.8 CXX=g++-4.8;
coverage=ON;
+ export CCACHE_CPP2=1;
fi
+ - if $OSX; then export MY_CMAKE_OPTIONS+=" -DBUILD_TESTING=OFF -DPYTHON_BINDINGS=OFF"; fi
# how to build
script:
# Check coding style
- - git ls-files | grep -E '\.[ch](pp)?$' | xargs clang-format-3.8 -i &&
- git diff --exit-code || { git reset --hard; false; }
+ - if $LINUX; then (git ls-files | grep -E '\.[ch](pp)?$' | xargs clang-format-3.8 -i &&
+ git diff --exit-code || { git reset --hard; false; }); fi
- ( mkdir build_debug && cd build_debug &&
- cmake -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=${coverage} .. &&
- make -j &&
- CTEST_OUTPUT_ON_FAILURE=1 make ExperimentalTest ExperimentalMemCheck )
+ cmake $MY_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=${coverage} .. &&
+ make -j$(nproc) &&
+ (if $LINUX; then make ExperimentalTest ExperimentalMemCheck; fi) )
- ( mkdir build && cd build &&
- cmake -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=Release .. &&
- make -j &&
- CTEST_OUTPUT_ON_FAILURE=1 make test &&
+ cmake $MY_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=Release .. &&
+ make -j$(nproc) &&
+ (if $LINUX; then make test; fi) &&
make install &&
- cpack --verbose -G DEB && dpkg --info *.deb)
+ (if $LINUX; then cpack --verbose -G DEB && dpkg --info *.deb; fi) )
- ( cd skeleton-subsystem &&
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install . &&
- make &&
- CTEST_OUTPUT_ON_FAILURE=1 make ExperimentalTest ExperimentalMemCheck &&
+ cmake $MY_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=Release . &&
+ make -j$(nproc) &&
+ (if $LINUX; then make ExperimentalTest ExperimentalMemCheck; fi) &&
make install )
- - ( cd tools/clientSimulator &&
- echo "TODO - install the generated .deb instead of using ../install."
+ - if $LINUX; then ( cd tools/clientSimulator &&
+ echo "TODO - install the generated .deb instead of using \$HOME/install."
"This would permit to test the packaging" &&
- cmake -DCMAKE_INSTALL_PREFIX=../install . &&
+ cmake $MY_CMAKE_OPTIONS . &&
make &&
- make install )
+ make install ); fi
+ # Check that all installed files are in a component (no "unspecified
+ # component" archive created)
+ - (cd build && cpack -G TGZ -D CPACK_ARCHIVE_COMPONENT_INSTALL=ON &&
+ [ ! -e "*-Unspecified.tar.gz" ])
# Keep this last
- ( mkdir build_less_features && cd build_less_features &&
rm -rf $PREFIX/asio-1.10.6 &&
- cmake -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_BUILD_TYPE=Debug
+ cmake $MY_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=Debug
-DNETWORKING=OFF -DPYTHON_BINDINGS=OFF -DC_BINDINGS=OFF .. &&
- make -j &&
- CTEST_OUTPUT_ON_FAILURE=1 make test )
+ make -j$(nproc) &&
+ (if $LINUX; then make test; fi) )
after_success:
# Push coverage info on codecov.io.
diff --git a/upstream/.version b/upstream/.version
index dd5b792..f7b0e75 100644
--- a/upstream/.version
+++ b/upstream/.version
@@ -1 +1 @@
-$Format:%D$
+tag: v3.2.8
diff --git a/upstream/CMakeLists.txt b/upstream/CMakeLists.txt
index 8bf7941..3130016 100644
--- a/upstream/CMakeLists.txt
+++ b/upstream/CMakeLists.txt
@@ -50,6 +50,7 @@
option(C_BINDINGS "Library to use the Parameter Framework using a C API" ON)
option(FATAL_WARNINGS "Turn warnings into errors (-Werror flag)" ON)
option(NETWORKING "Set to OFF in order to stub networking code" ON)
+option(CLIENT_SIMULATOR "Set to OFF to disable client simulator" ON)
include(SetVersion.cmake)
@@ -57,6 +58,10 @@
# call the wrapper
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}/cmake")
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_EXTENSIONS NO)
+set(CMAKE_CXX_STANDARD_REQUIRED YES)
+
if(WIN32)
# By default cmake adds a warning level.
# Nevertheless a different level is wanted for this project.
@@ -76,15 +81,13 @@
# and thus are not to be used by the client. A better fix would be to export
# only public methods instead of the whole class, but they are too many to
# do that. A separated plugin interface would fix that.
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /FIiso646.h -wd4127 -wd4251")
+ add_compile_options(/W4 /FIiso646.h -wd4127 -wd4251)
# FIXME: Once we have removed all warnings on windows, add the /WX flags if
# FATAL_WARNINGS is enabled
else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wconversion -Wno-sign-conversion")
- if(FATAL_WARNINGS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
- endif()
+ add_compile_options(-Wall -Wextra -Wconversion -Wno-sign-conversion
+ $<$<BOOL:FATAL_WARNINGS>:-Werror>)
endif()
# Hide symbols by default, then exposed symbols are the same in linux and windows
@@ -94,12 +97,18 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
+# Automatically add the current source and build dirs to the private and
+# interface include directories.
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
include(ctest/CMakeLists.txt)
+# Since there is no directory-wide property for linker flags, we can't use
+# set_property for the link-time coverage flags.
if(COVERAGE)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
add_subdirectory(xmlserializer)
@@ -118,6 +127,9 @@
add_subdirectory(tools/xmlGenerator)
add_subdirectory(tools/xmlValidator)
+if (CLIENT_SIMULATOR)
+ add_subdirectory(tools/clientSimulator)
+endif()
add_subdirectory(bindings)
@@ -126,3 +138,4 @@
add_subdirectory(schemas)
add_subdirectory(cpack)
+add_subdirectory(cmake)
diff --git a/upstream/SetVersion.cmake b/upstream/SetVersion.cmake
index 3adeec1..eb95f9d 100644
--- a/upstream/SetVersion.cmake
+++ b/upstream/SetVersion.cmake
@@ -37,24 +37,25 @@
# Find and set the Parameter Framework's version
# First, let's see if the user forced a version (i.e. "vX.Y.Z-N")
if(NOT DEFINED PF_VERSION)
- # Else, try to get it from git
- execute_process(COMMAND git describe --tags --long --dirty --abbrev=12
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
- OUTPUT_VARIABLE PF_VERSION
- RESULT_VARIABLE GIT_DESCRIBE_RESULT
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_QUIET)
- if(GIT_DESCRIBE_RESULT GREATER 0)
- # Or fall back to reading it from .version (this will happen when
- # building from an archive)
- file(READ "${PROJECT_SOURCE_DIR}/.version" PF_VERSION_FILE_CONTENT)
+ # Else, try to get it from .version (this will happen when
+ # building from an archive)
+ file(READ "${PROJECT_SOURCE_DIR}/.version" PF_VERSION_FILE_CONTENT)
- set(REGEX "tag: (v[0-9.]+)")
- if(PF_VERSION_FILE_CONTENT MATCHES ${REGEX})
- set(PF_VERSION "${CMAKE_MATCH_1}-0")
- endif()
+ set(REGEX "tag: (v[0-9.]+)")
+ if(PF_VERSION_FILE_CONTENT MATCHES ${REGEX})
+ set(PF_VERSION "${CMAKE_MATCH_1}-0")
+
+ else()
+ # Or fall back from git
+ execute_process(COMMAND git describe --tags --long --dirty --abbrev=12
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ OUTPUT_VARIABLE PF_VERSION
+ RESULT_VARIABLE GIT_DESCRIBE_RESULT
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_QUIET)
endif()
+
else()
# Set the "nice version string" to the one forced by the user
set(NICE_PF_VERSION "${PF_VERSION}")
@@ -73,6 +74,11 @@
# If we are precisely on a tag, make a nicer version string (unless otherwise
# forced by the user - see above)
-if((NOT DEFINED NICE_PF_VERSION) AND (PF_VERSION_TWEAK EQUAL 0) AND (NOT PF_VERSION_DIRTY))
- set(NICE_PF_VERSION "v${PF_VERSION_MAJOR}.${PF_VERSION_MINOR}.${PF_VERSION_PATCH}")
+if((NOT DEFINED NICE_PF_VERSION))
+ if((PF_VERSION_TWEAK EQUAL 0) AND (NOT PF_VERSION_DIRTY))
+ set(NICE_PF_VERSION "v${PF_VERSION_MAJOR}.${PF_VERSION_MINOR}.${PF_VERSION_PATCH}")
+ else()
+ # Fallback
+ set(NICE_PF_VERSION "${PF_VERSION}")
+ endif()
endif()
diff --git a/upstream/appveyor.yml b/upstream/appveyor.yml
index f1e38dc..eecba68 100644
--- a/upstream/appveyor.yml
+++ b/upstream/appveyor.yml
@@ -30,9 +30,13 @@
install:
- cinst cmake.portable wget 7zip.commandline
# Install Windows Installer XML (WiX) to create installer with cpack
+ # This package is currently broken because of a missing checksum. Since we
+ # are not distributing the packages, we don't care about that and can
+ # override the checksum:
+ - choco feature enable -n allowEmptyChecksums
- cinst wixtoolset
- # Download and install external dependancy if they are not in the cache
+ # Download and install external dependency if they are not in the cache
- if not exist libxml2-x86_64 (
wget --no-check-certificate https://01.org/sites/default/files/libxml2-x86_64-3eaedba1b64180668fdab7ad2eba549586017bf3.zip &&
7z x libxml2-x86_64-3eaedba1b64180668fdab7ad2eba549586017bf3.zip)
@@ -66,7 +70,7 @@
- mkdir 64bits-debug && cd 64bits-debug
# Add debug libxml2.dll in the path so that tests can find it
- set TEST_PATH=%DEBUG_LIBXML2_PATH%\bin
- - cmake -G "NMake Makefiles" -DPYTHON_BINDINGS=OFF -DCMAKE_PREFIX_PATH="%PREFIX_PATH%;%DEBUG_LIBXML2_PATH%" ..\..
+ - cmake -G "NMake Makefiles" -DPYTHON_BINDINGS=OFF -DCLIENT_SIMULATOR=OFF -DCMAKE_PREFIX_PATH="%PREFIX_PATH%;%DEBUG_LIBXML2_PATH%" ..\..
- cmake --build . --config debug
- ctest --build-config debug %CTEST_PARAMS%
- cd ..
@@ -74,7 +78,7 @@
- mkdir 64bits-release & cd 64bits-release
# Add debug libxml2.dll in the path so that tests can find it
- set TEST_PATH=%RELEASE_LIBXML2_PATH%\bin
- - cmake -G "Visual Studio 14 2015 Win64" -DPYTHON_BINDINGS=OFF -DCMAKE_PREFIX_PATH="%PREFIX_PATH%;%RELEASE_LIBXML2_PATH%" -DCMAKE_INSTALL_PREFIX=%INSTALL% ..\..
+ - cmake -G "Visual Studio 14 2015 Win64" -DPYTHON_BINDINGS=OFF -DCLIENT_SIMULATOR=OFF -DCMAKE_PREFIX_PATH="%PREFIX_PATH%;%RELEASE_LIBXML2_PATH%" -DCMAKE_INSTALL_PREFIX=%INSTALL% ..\..
# Build, test and install
- cmake --build . --config release
- ctest --build-config release %CTEST_PARAMS%
@@ -88,7 +92,7 @@
# %INSTALL%\bin is where parameter.dll is installed
# Also add the path where the release libxml2.dll has been extracted
- set TEST_PATH=%RELEASE_LIBXML2_PATH%\bin;%INSTALL%\lib;%INSTALL%\bin
- - cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=%INSTALL% -DCMAKE_PREFIX_PATH=%INSTALL% %APPVEYOR_BUILD_FOLDER%\skeleton-subsystem
+ - cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=%INSTALL% -DCMAKE_PREFIX_PATH="%INSTALL%;%RELEASE_LIBXML2_PATH%" %APPVEYOR_BUILD_FOLDER%\skeleton-subsystem
# Unfortunately, the skeleton test currently doesn't work on
# multi-configuration build systems (Visual Studio is one of those) without
# installing the plugin
diff --git a/upstream/asio/CMakeLists.txt b/upstream/asio/CMakeLists.txt
index 9c0ef11..1270e05 100644
--- a/upstream/asio/CMakeLists.txt
+++ b/upstream/asio/CMakeLists.txt
@@ -44,7 +44,7 @@
# Ubuntu 14.04 packages asio 1.10.1 and clang 3.4.1.
# In this environment, asio stand alone (set ASIO_STANDALONE)
- # does not correcly detect that the stl has CHRONO support (c++11).
+ # does not correctly detect that the stl has CHRONO support (c++11).
# Force the use of std::chrono by setting ASIO_HAS_STD_CHRONO
target_include_directories(asio SYSTEM INTERFACE "${ASIO_DIR}")
target_link_libraries(asio INTERFACE "${CMAKE_THREAD_LIBS_INIT}")
diff --git a/upstream/asio/stub/asio.hpp b/upstream/asio/stub/asio.hpp
index 84a0ea4..1fd3b0c 100644
--- a/upstream/asio/stub/asio.hpp
+++ b/upstream/asio/stub/asio.hpp
@@ -37,6 +37,10 @@
#include <system_error>
+#include <netinet/in.h>
+
+#define ASIO_OS_DEF(x) (x)
+
namespace asio
{
struct dummy_base
@@ -46,7 +50,27 @@
{
}
void set_option(const dummy_base &) const {};
+ int protocol() const { return 0; }
};
+struct endpoint_base : dummy_base
+{
+ using dummy_base::dummy_base;
+
+ dummy_base protocol() const { return {}; };
+};
+
+template <typename T>
+struct basic_socket_acceptor : dummy_base
+{
+ using dummy_base::dummy_base;
+
+ using reuse_address = dummy_base;
+ void open(const dummy_base &) const {};
+ void bind(const dummy_base &) const {};
+ void listen() const {};
+ void async_accept(const dummy_base &, const dummy_base &) const {};
+};
+
inline bool write(const dummy_base &, const dummy_base &, const dummy_base &)
{
return true;
@@ -76,6 +100,10 @@
using linger = dummy_base;
using enable_connection_aborted = dummy_base;
void close() const {};
+
+ const endpoint_base &local_endpoint() const { return base; }
+
+ endpoint_base base;
};
bool write(const dummy_base &, const dummy_base &, const dummy_base &);
@@ -95,23 +123,23 @@
{
using v6 = dummy_base;
using no_delay = dummy_base;
+using endpoint = endpoint_base;
using socket = socket_base;
-struct endpoint : dummy_base
-{
- using dummy_base::dummy_base;
-
- dummy_base protocol() const { return {}; };
-};
-struct acceptor : dummy_base
-{
- using dummy_base::dummy_base;
-
- using reuse_address = dummy_base;
- void open(const dummy_base &) const {};
- void bind(const dummy_base &) const {};
- void listen() const {};
- void async_accept(const dummy_base &, const dummy_base &) const {};
-};
+using acceptor = basic_socket_acceptor<void>;
}
}
+
+namespace generic
+{
+struct stream_protocol
+{
+ using endpoint = endpoint_base;
+ using socket = socket_base;
+};
+};
+
+namespace local
+{
+using stream_protocol = generic::stream_protocol;
+}
}
diff --git a/upstream/bindings/c/CMakeLists.txt b/upstream/bindings/c/CMakeLists.txt
index 0c88412..f9dd3d0 100644
--- a/upstream/bindings/c/CMakeLists.txt
+++ b/upstream/bindings/c/CMakeLists.txt
@@ -33,17 +33,15 @@
install(FILES ParameterFramework.h
"${CMAKE_CURRENT_BINARY_DIR}/cparameter_export.h"
- DESTINATION "include/parameter/c")
+ DESTINATION "include/parameter/c"
+ COMPONENT c_dev)
target_link_libraries(cparameter PRIVATE parameter pfw_utility)
-target_include_directories(cparameter
- # Fixme use an include folder
- PUBLIC .
- # Export symbol macro header
- PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
-
-install(TARGETS cparameter LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
+install(TARGETS cparameter
+ LIBRARY DESTINATION lib COMPONENT c
+ RUNTIME DESTINATION bin COMPONENT c
+ ARCHIVE DESTINATION lib COMPONENT c_dev)
if(BUILD_TESTING)
# Add unit test
diff --git a/upstream/bindings/c/ParameterFramework.cpp b/upstream/bindings/c/ParameterFramework.cpp
index 53f7a66..858994b 100644
--- a/upstream/bindings/c/ParameterFramework.cpp
+++ b/upstream/bindings/c/ParameterFramework.cpp
@@ -50,7 +50,7 @@
typedef ISelectionCriterionInterface Criterion;
typedef std::map<string, Criterion *> Criteria;
typedef CParameterMgrPlatformConnector Pfw;
-}
+} // namespace pfw
/** Class to abstract the boolean+string status api. */
class Status
@@ -110,7 +110,7 @@
};
}
-static PfwLogger defaultLogger = {NULL, &defaultLogCb};
+static PfwLogger defaultLogger = {nullptr, &defaultLogCb};
class LogWrapper : public CParameterMgrPlatformConnector::ILogger
{
@@ -127,7 +127,7 @@
{
// A LogWrapper should NOT be register to the pfw (thus log called)
// if logCb is NULL.
- assert(mLogger.logCb != NULL);
+ assert(mLogger.logCb != nullptr);
mLogger.logCb(mLogger.userCtx, level, strLog.c_str());
}
@@ -167,10 +167,10 @@
void PfwHandler::setLogger(const PfwLogger *logger)
{
- if (logger != NULL and logger->logCb == NULL) {
+ if (logger != nullptr and logger->logCb == nullptr) {
return; // There is no callback, do not log => do not add a logger
}
- mLogger = logger != NULL ? *logger : defaultLogger;
+ mLogger = logger != nullptr ? *logger : defaultLogger;
pfw->setLogger(&mLogger);
}
@@ -180,10 +180,10 @@
// Add criteria
for (size_t criterionIndex = 0; criterionIndex < criterionNb; ++criterionIndex) {
const PfwCriterion &criterion = criteriaArray[criterionIndex];
- if (criterion.name == NULL) {
+ if (criterion.name == nullptr) {
return status.failure("Criterion name is NULL");
}
- if (criterion.values == NULL) {
+ if (criterion.values == nullptr) {
return status.failure("Criterion values is NULL");
}
// Check that the criterion does not exist
@@ -194,9 +194,9 @@
// Create criterion type
ISelectionCriterionTypeInterface *type =
pfw->createSelectionCriterionType(criterion.inclusive);
- assert(type != NULL);
+ assert(type != nullptr);
// Add criterion values
- for (size_t valueIndex = 0; criterion.values[valueIndex] != NULL; ++valueIndex) {
+ for (size_t valueIndex = 0; criterion.values[valueIndex] != nullptr; ++valueIndex) {
int value;
if (criterion.inclusive) {
// Check that (int)1 << valueIndex would not overflow (UB)
@@ -227,7 +227,7 @@
// Check that the api is correctly used
Status &status = handle->lastStatus;
- if (handle->pfw != NULL) {
+ if (handle->pfw != nullptr) {
return status.failure("Can not start an already started parameter framework");
}
// Create a pfw
@@ -249,19 +249,19 @@
static pfw::Criterion *getCriterion(const pfw::Criteria &criteria, const string &name)
{
- pfw::Criteria::const_iterator it = criteria.find(name);
- return it == criteria.end() ? NULL : it->second;
+ auto it = criteria.find(name);
+ return it == criteria.end() ? nullptr : it->second;
}
bool pfwSetCriterion(PfwHandler *handle, const char name[], int value)
{
Status &status = handle->lastStatus;
- if (handle->pfw == NULL) {
+ if (handle->pfw == nullptr) {
return status.failure("Can not set criterion \"" + string(name) +
"\" as the parameter framework is not started.");
}
pfw::Criterion *criterion = getCriterion(handle->criteria, name);
- if (criterion == NULL) {
+ if (criterion == nullptr) {
return status.failure("Can not set criterion " + string(name) + " as does not exist");
}
criterion->setCriterionState(value);
@@ -270,12 +270,12 @@
bool pfwGetCriterion(const PfwHandler *handle, const char name[], int *value)
{
Status &status = handle->lastStatus;
- if (handle->pfw == NULL) {
+ if (handle->pfw == nullptr) {
return status.failure("Can not get criterion \"" + string(name) +
"\" as the parameter framework is not started.");
}
pfw::Criterion *criterion = getCriterion(handle->criteria, name);
- if (criterion == NULL) {
+ if (criterion == nullptr) {
return status.failure("Can not get criterion " + string(name) + " as it does not exist");
}
*value = criterion->getCriterionState();
@@ -285,7 +285,7 @@
bool pfwApplyConfigurations(const PfwHandler *handle)
{
Status &status = handle->lastStatus;
- if (handle->pfw == NULL) {
+ if (handle->pfw == nullptr) {
return status.failure("Can not commit criteria "
"as the parameter framework is not started.");
}
@@ -306,17 +306,17 @@
PfwParameterHandler *pfwBindParameter(PfwHandler *handle, const char path[])
{
Status &status = handle->lastStatus;
- if (handle->pfw == NULL) {
+ if (handle->pfw == nullptr) {
status.failure("The parameter framework is not started, "
"while trying to bind parameter \"" +
string(path) + "\")");
- return NULL;
+ return nullptr;
}
CParameterHandle *paramHandle;
paramHandle = handle->pfw->createParameterHandle(path, status.msg());
- if (paramHandle == NULL) {
- return NULL;
+ if (paramHandle == nullptr) {
+ return nullptr;
}
status.success();
@@ -344,7 +344,7 @@
bool pfwGetStringParameter(const PfwParameterHandler *handle, char *value[])
{
Status &status = handle->pfw.lastStatus;
- *value = NULL;
+ *value = nullptr;
string retValue;
bool success = handle->parameter.getAsString(retValue, status.msg());
if (not success) {
diff --git a/upstream/bindings/c/Test.cpp b/upstream/bindings/c/Test.cpp
index 39f5df6..9d3b038 100644
--- a/upstream/bindings/c/Test.cpp
+++ b/upstream/bindings/c/Test.cpp
@@ -114,8 +114,8 @@
TEST_CASE_METHOD(Test, "Parameter-framework c api use")
{
// Create criteria
- const char *letterList[] = {"a", "b", "c", NULL};
- const char *numberList[] = {"1", "2", "3", NULL};
+ const char *letterList[] = {"a", "b", "c", nullptr};
+ const char *numberList[] = {"1", "2", "3", nullptr};
const PfwCriterion criteria[] = {
{"inclusiveCrit", true, letterList}, {"exclusiveCrit", false, numberList},
};
@@ -165,7 +165,7 @@
REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 2, &logger));
}
WHEN ("The pfw is started with duplicated criterion value state") {
- const char *values[] = {"a", "a", NULL};
+ const char *values[] = {"a", "a", nullptr};
const PfwCriterion duplicatedCriteria[] = {{"name", true, values}};
WHEN ("Using test logger") {
@@ -173,15 +173,15 @@
}
WHEN ("Using default logger") {
// Test coverage of default logger warning
- REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 1, NULL));
+ REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 1, nullptr));
}
}
WHEN ("The pfw is started with NULL name criterion") {
- const PfwCriterion duplicatedCriteria[] = {{NULL, true, letterList}};
+ const PfwCriterion duplicatedCriteria[] = {{nullptr, true, letterList}};
REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 1, &logger));
}
WHEN ("The pfw is started with NULL criterion state list") {
- const PfwCriterion duplicatedCriteria[] = {{"name", true, NULL}};
+ const PfwCriterion duplicatedCriteria[] = {{"name", true, nullptr}};
REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 1, &logger));
}
GIVEN ("A criteria with lots of values") {
@@ -192,7 +192,7 @@
for (size_t i = 0; i < values.size(); ++i) {
values[i] = &names[i];
}
- values.back() = NULL;
+ values.back() = nullptr;
/* The pfw c api requires criterion values to be a NULL terminated
* array of string. Each string is a pointer to a NULL terminated
* array of char. The pfw requires each string to be different
@@ -225,7 +225,7 @@
REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 1, &logger));
}
WHEN ("The pfw is started with max length criterion state list") {
- values[values.size() - 2] = NULL; // Hide last value
+ values[values.size() - 2] = nullptr; // Hide last value
REQUIRE_SUCCESS(pfwStart(pfw, config, duplicatedCriteria, 1, &logger));
}
}
@@ -240,11 +240,11 @@
}
WHEN ("The pfw is started without a logger callback") {
- PfwLogger noLog = {NULL, NULL};
+ PfwLogger noLog = {nullptr, nullptr};
REQUIRE_SUCCESS(pfwStart(pfw, config, criteria, criterionNb, &noLog));
}
WHEN ("The pfw is started with default logger") {
- REQUIRE_SUCCESS(pfwStart(pfw, config, criteria, criterionNb, NULL));
+ REQUIRE_SUCCESS(pfwStart(pfw, config, criteria, criterionNb, nullptr));
}
WHEN ("Get criterion of a stopped pfw") {
@@ -311,12 +311,12 @@
REQUIRE_SUCCESS(pfwApplyConfigurations(pfw));
}
WHEN ("Bind a non existing parameter") {
- REQUIRE_FAILURE(pfwBindParameter(pfw, "do/not/exist") != NULL);
+ REQUIRE_FAILURE(pfwBindParameter(pfw, "do/not/exist") != nullptr);
}
GIVEN ("An integer parameter handle") {
PfwParameterHandler *param = pfwBindParameter(pfw, intParameterPath);
- REQUIRE_SUCCESS(param != NULL);
+ REQUIRE_SUCCESS(param != nullptr);
WHEN ("Set parameter out of range") {
REQUIRE_FAILURE(pfwSetIntParameter(param, 101));
@@ -335,7 +335,7 @@
GIVEN ("An string parameter handle") {
PfwParameterHandler *param = pfwBindParameter(pfw, stringParameterPath);
- REQUIRE_SUCCESS(param != NULL);
+ REQUIRE_SUCCESS(param != nullptr);
WHEN ("Set parameter out of range") {
REQUIRE_FAILURE(pfwSetStringParameter(param, "ko_1234567"));
diff --git a/upstream/bindings/python/CMakeLists.txt b/upstream/bindings/python/CMakeLists.txt
index 5807633..23e08c1 100644
--- a/upstream/bindings/python/CMakeLists.txt
+++ b/upstream/bindings/python/CMakeLists.txt
@@ -76,7 +76,7 @@
# generated by swig generates warnings. We don't apply the FATAL_WARNING policy
# here, since we consider this generated code as external.
target_compile_definitions(_PyPfw PRIVATE SWIG_PYTHON_SILENT_MEMLEAK)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error")
+target_compile_options(_PyPfw PRIVATE -Wno-error)
# Find the python modules install path.
@@ -89,7 +89,8 @@
print(sysconfig.get_python_lib(plat_specific=True, prefix=''))"
OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
-install(TARGETS _PyPfw LIBRARY DESTINATION ${PYTHON_MODULE_PATH})
+install(TARGETS _PyPfw LIBRARY DESTINATION ${PYTHON_MODULE_PATH} COMPONENT python)
# install the generated Python file as well
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PyPfw.py DESTINATION ${PYTHON_MODULE_PATH})
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PyPfw.py DESTINATION ${PYTHON_MODULE_PATH}
+ COMPONENT python)
diff --git a/upstream/cmake/CMakeLists.txt b/upstream/cmake/CMakeLists.txt
new file mode 100644
index 0000000..319616b
--- /dev/null
+++ b/upstream/cmake/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Copyright (c) 2016, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+configure_file(ParameterFrameworkConfig.cmake
+ "${CMAKE_CURRENT_BINARY_DIR}/ParameterFrameworkConfig.cmake"
+ COPYONLY
+)
+
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/ParameterFrameworkConfigVersion.cmake"
+ VERSION ${PF_VERSION_MAJOR}.${PF_VERSION_MINOR}.${PF_VERSION_PATCH}
+ COMPATIBILITY SameMajorVersion)
+
+export(EXPORT ParameterTargets
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/ParameterFrameworkTargets.cmake"
+ NAMESPACE ParameterFramework::)
+
+install(EXPORT ParameterTargets DESTINATION lib/cmake/ParameterFramework
+ FILE ParameterFrameworkTargets.cmake
+ NAMESPACE ParameterFramework::
+ COMPONENT dev)
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/ParameterFrameworkConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/ParameterFrameworkConfigVersion.cmake"
+ DESTINATION lib/cmake/ParameterFramework
+ COMPONENT dev)
diff --git a/upstream/cmake/ParameterFrameworkConfig.cmake b/upstream/cmake/ParameterFrameworkConfig.cmake
new file mode 100644
index 0000000..cc14d46
--- /dev/null
+++ b/upstream/cmake/ParameterFrameworkConfig.cmake
@@ -0,0 +1,29 @@
+# Copyright (c) 2016, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include("${CMAKE_CURRENT_LIST_DIR}/ParameterFrameworkTargets.cmake")
diff --git a/upstream/cpack/CMakeLists.txt b/upstream/cpack/CMakeLists.txt
index 516ce4d..25d9298 100644
--- a/upstream/cpack/CMakeLists.txt
+++ b/upstream/cpack/CMakeLists.txt
@@ -47,6 +47,8 @@
if (WIN32)
# On windows, pack compiler provided libraries (MSVC redistributable) with the project
+ # Have cpack make a specific archive for them
+ set(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT runtime_deps)
include(InstallRequiredSystemLibraries)
# TODO: pack libxml2.dll with the project
endif()
diff --git a/upstream/ctest/CMakeLists.txt b/upstream/ctest/CMakeLists.txt
index d56c9a1..e80bc3f 100644
--- a/upstream/ctest/CMakeLists.txt
+++ b/upstream/ctest/CMakeLists.txt
@@ -71,7 +71,7 @@
endif()
- # With nmake and nmake, executables are build in:
+ # With nmake and nmake, executables are built in:
# ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} => `bin/`
#
# Nevertheless Visual studio (and xcode) can build for debug and release
diff --git a/upstream/parameter/ArrayParameter.cpp b/upstream/parameter/ArrayParameter.cpp
index 83ffe04..91ea448 100644
--- a/upstream/parameter/ArrayParameter.cpp
+++ b/upstream/parameter/ArrayParameter.cpp
@@ -171,7 +171,7 @@
string CArrayParameter::logValue(CParameterAccessContext &context) const
{
// Dump values
- return getValues(0, context);
+ return getValues(getOffset() - context.getBaseOffset(), context);
}
// Used for simulation and virtual subsystems
diff --git a/upstream/parameter/ArrayParameter.h b/upstream/parameter/ArrayParameter.h
index b2018c2..6410dbc 100644
--- a/upstream/parameter/ArrayParameter.h
+++ b/upstream/parameter/ArrayParameter.h
@@ -37,30 +37,30 @@
CArrayParameter(const std::string &strName, const CTypeElement *pTypeElement);
// Instantiation, allocation
- virtual size_t getFootPrint() const;
+ size_t getFootPrint() const override;
/// Value access
using CBaseParameter::access;
bool access(std::vector<bool> &abValues, bool bSet,
- CParameterAccessContext ¶meterAccessContext) const override final;
+ CParameterAccessContext ¶meterAccessContext) const final;
bool access(std::vector<uint32_t> &auiValues, bool bSet,
- CParameterAccessContext ¶meterAccessContext) const override final;
+ CParameterAccessContext ¶meterAccessContext) const final;
bool access(std::vector<int32_t> &aiValues, bool bSet,
- CParameterAccessContext ¶meterAccessContext) const override final;
+ CParameterAccessContext ¶meterAccessContext) const final;
bool access(std::vector<double> &adValues, bool bSet,
- CParameterAccessContext ¶meterAccessContext) const override final;
+ CParameterAccessContext ¶meterAccessContext) const final;
bool access(std::vector<std::string> &astrValues, bool bSet,
- CParameterAccessContext ¶meterAccessContext) const override final;
+ CParameterAccessContext ¶meterAccessContext) const final;
protected:
// User set/get
- virtual bool accessValue(CPathNavigator &pathNavigator, std::string &strValue, bool bSet,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool accessValue(CPathNavigator &pathNavigator, std::string &strValue, bool bSet,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Used for simulation and virtual subsystems
- virtual void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const;
+ void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const override;
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
private:
// Array length
diff --git a/upstream/parameter/BaseIntegerParameterType.cpp b/upstream/parameter/BaseIntegerParameterType.cpp
new file mode 100644
index 0000000..16c60bf
--- /dev/null
+++ b/upstream/parameter/BaseIntegerParameterType.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sstream>
+#include <iomanip>
+
+#include "BaseIntegerParameterType.h"
+#include "ParameterAccessContext.h"
+#include "ParameterAdaptation.h"
+
+// Kind
+std::string CBaseIntegerParameterType::getKind() const
+{
+ return "IntegerParameter";
+}
+
+// Deal with adaption node
+bool CBaseIntegerParameterType::childrenAreDynamic() const
+{
+ return true;
+}
+
+bool CBaseIntegerParameterType::fromBlackboard(uint32_t &uiUserValue, uint32_t uiValue,
+ CParameterAccessContext & /*ctx*/) const
+{
+ // Do assign
+ uiUserValue = uiValue;
+
+ return true;
+}
+bool CBaseIntegerParameterType::fromBlackboard(int32_t &iUserValue, uint32_t uiValue,
+ CParameterAccessContext & /*ctx*/) const
+{
+ int32_t iValue = uiValue;
+
+ // Sign extend
+ signExtend(iValue);
+
+ // Do assign
+ iUserValue = iValue;
+
+ return true;
+}
+// Adaptation element retrieval
+const CParameterAdaptation *CBaseIntegerParameterType::getParameterAdaptation() const
+{
+ return static_cast<const CParameterAdaptation *>(findChildOfKind("Adaptation"));
+}
diff --git a/upstream/parameter/BaseIntegerParameterType.h b/upstream/parameter/BaseIntegerParameterType.h
new file mode 100644
index 0000000..b39816c
--- /dev/null
+++ b/upstream/parameter/BaseIntegerParameterType.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#pragma once
+
+#include "ParameterType.h"
+
+#include <string>
+
+class CParameterAdaptation;
+
+/** Base class for CIntegerParameterType
+ *
+ * CIntegerParameterType is template - this class Contains the parts that do
+ * not depend on template arguments in order to make the implementation more
+ * consise.
+ */
+class CBaseIntegerParameterType : public CParameterType
+{
+public:
+ CBaseIntegerParameterType(const std::string &name) : CParameterType(name){};
+
+ // CElement
+ std::string getKind() const override;
+
+ bool fromBlackboard(uint32_t &uiUserValue, uint32_t uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(int32_t &iUserValue, uint32_t uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(double &dUserValue, uint32_t uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override
+ {
+ return CParameterType::fromBlackboard(dUserValue, uiValue, parameterAccessContext);
+ }
+ bool fromBlackboard(std::string &strValue, const uint32_t &value,
+ CParameterAccessContext ¶meterAccessContext) const override = 0;
+
+protected:
+ // Adaptation element retrieval
+ const CParameterAdaptation *getParameterAdaptation() const;
+
+private:
+ // Returns true if children dynamic creation is to be dealt with
+ bool childrenAreDynamic() const override;
+};
diff --git a/upstream/parameter/BaseParameter.h b/upstream/parameter/BaseParameter.h
index 1b80fb8..1efe902 100644
--- a/upstream/parameter/BaseParameter.h
+++ b/upstream/parameter/BaseParameter.h
@@ -43,12 +43,12 @@
CBaseParameter(const std::string &strName, const CTypeElement *pTypeElement);
// XML configuration settings parsing/composing
- virtual bool serializeXmlSettings(
+ bool serializeXmlSettings(
CXmlElement &xmlConfigurationSettingsElementContent,
- CConfigurationAccessContext &configurationAccessContext) const;
+ CConfigurationAccessContext &configurationAccessContext) const override;
// Check element is a parameter
- virtual bool isParameter() const;
+ bool isParameter() const override;
// Boolean access
virtual bool access(bool &bValue, bool bSet,
@@ -85,12 +85,12 @@
CParameterAccessContext ¶meterAccessContext) const;
void structureToXml(CXmlElement &xmlElement,
- CXmlSerializingContext &serializingContext) const override final;
+ CXmlSerializingContext &serializingContext) const final;
protected:
// Parameter Access
- virtual bool accessValue(CPathNavigator &pathNavigator, std::string &strValue, bool bSet,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool accessValue(CPathNavigator &pathNavigator, std::string &strValue, bool bSet,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Actual value access (to be implemented by derived)
virtual bool doSetValue(const std::string &strValue, size_t offset,
diff --git a/upstream/parameter/BitParameter.h b/upstream/parameter/BitParameter.h
index cbe071e..0487cb4 100644
--- a/upstream/parameter/BitParameter.h
+++ b/upstream/parameter/BitParameter.h
@@ -39,22 +39,22 @@
CBitParameter(const std::string &strName, const CTypeElement *pTypeElement);
// Instantiation, allocation
- virtual size_t getFootPrint() const;
+ size_t getFootPrint() const override;
// Type
- virtual Type getType() const;
+ Type getType() const override;
/// Value access
// Boolean access
bool access(bool &bValue, bool bSet,
- CParameterAccessContext ¶meterAccessContext) const override final;
+ CParameterAccessContext ¶meterAccessContext) const final;
// Integer Access
bool access(uint32_t &uiValue, bool bSet,
- CParameterAccessContext ¶meterAccessContext) const override final;
+ CParameterAccessContext ¶meterAccessContext) const final;
// AreaConfiguration creation
- virtual CAreaConfiguration *createAreaConfiguration(const CSyncerSet *pSyncerSet) const;
+ CAreaConfiguration *createAreaConfiguration(const CSyncerSet *pSyncerSet) const override;
// Size
size_t getBelongingBlockSize() const;
@@ -64,10 +64,10 @@
private:
// String Access
- virtual bool doSetValue(const std::string &strValue, size_t offset,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual void doGetValue(std::string &strValue, size_t offset,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool doSetValue(const std::string &strValue, size_t offset,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ void doGetValue(std::string &strValue, size_t offset,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Generic Access
template <typename type>
diff --git a/upstream/parameter/BitParameterBlock.h b/upstream/parameter/BitParameterBlock.h
index f1068f6..e1e965c 100644
--- a/upstream/parameter/BitParameterBlock.h
+++ b/upstream/parameter/BitParameterBlock.h
@@ -37,18 +37,19 @@
CBitParameterBlock(const std::string &strName, const CTypeElement *pTypeElement);
// Instantiation, allocation
- virtual size_t getFootPrint() const;
+ size_t getFootPrint() const override;
// Type
- virtual Type getType() const;
+ Type getType() const override;
// Size
size_t getSize() const;
// Used for simulation and virtual subsystems
- virtual void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const;
+ void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const override;
- void structureToXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const
+ void structureToXml(CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) const override
{
xmlElement.setAttribute("Size", getSize() * 8);
CInstanceConfigurableElement::structureToXml(xmlElement, serializingContext);
diff --git a/upstream/parameter/BitParameterBlockType.h b/upstream/parameter/BitParameterBlockType.h
index 419d7aa..58b42d4 100644
--- a/upstream/parameter/BitParameterBlockType.h
+++ b/upstream/parameter/BitParameterBlockType.h
@@ -42,18 +42,19 @@
size_t getSize() const;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
- virtual bool childrenAreDynamic() const;
+ bool childrenAreDynamic() const override;
// Instantiation
- virtual CInstanceConfigurableElement *doInstantiate() const;
+ CInstanceConfigurableElement *doInstantiate() const override;
// Size in bytes
size_t _size{0};
diff --git a/upstream/parameter/BitParameterType.cpp b/upstream/parameter/BitParameterType.cpp
index 5a5c353..14421f1 100644
--- a/upstream/parameter/BitParameterType.cpp
+++ b/upstream/parameter/BitParameterType.cpp
@@ -123,7 +123,7 @@
CParameterAccessContext ¶meterAccessContext) const
{
// Get value
- uint64_t uiConvertedValue = strtoull(strValue.c_str(), NULL, 0);
+ uint64_t uiConvertedValue = strtoull(strValue.c_str(), nullptr, 0);
if (uiConvertedValue > _uiMax) {
@@ -225,20 +225,6 @@
return getMaxEncodableValue() << _bitPos;
}
-// Check data has no bit set outside available range
-bool CBitParameterType::isEncodable(uint64_t uiData) const
-{
- size_t uiShift = 8 * sizeof(uiData) - _uiBitSize;
-
- if (uiShift) {
-
- // Check high bits are clean
- return !(uiData >> uiShift);
- }
-
- return true;
-}
-
// From IXmlSource
void CBitParameterType::toXml(CXmlElement &xmlElement,
CXmlSerializingContext &serializingContext) const
diff --git a/upstream/parameter/BitParameterType.h b/upstream/parameter/BitParameterType.h
index f8d67ed..a6745c8 100644
--- a/upstream/parameter/BitParameterType.h
+++ b/upstream/parameter/BitParameterType.h
@@ -44,10 +44,11 @@
CBitParameterType(const std::string &strName);
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
/// Conversion
// String
bool toBlackboard(const std::string &strValue, uint64_t &uiValue,
@@ -66,10 +67,10 @@
size_t getBitSize() const;
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
/**
* Get the position of the bit within the bit parameter block.
@@ -80,13 +81,11 @@
size_t getBitPos() const { return _bitPos; }
private:
// Instantiation
- virtual CInstanceConfigurableElement *doInstantiate() const;
+ CInstanceConfigurableElement *doInstantiate() const override;
// Max encodable value
uint64_t getMaxEncodableValue() const;
// Biwise mask
uint64_t getMask() const;
- // Check data has no bit set outside available range
- bool isEncodable(uint64_t uiData) const;
// Pos in bits
size_t _bitPos{0};
diff --git a/upstream/parameter/BitwiseAreaConfiguration.h b/upstream/parameter/BitwiseAreaConfiguration.h
index 4a10c2c..5cb0e1b 100644
--- a/upstream/parameter/BitwiseAreaConfiguration.h
+++ b/upstream/parameter/BitwiseAreaConfiguration.h
@@ -41,6 +41,6 @@
private:
// Blackboard copies
- virtual void copyTo(CParameterBlackboard *pToBlackboard, size_t offset) const;
- virtual void copyFrom(const CParameterBlackboard *pFromBlackboard, size_t offset);
+ void copyTo(CParameterBlackboard *pToBlackboard, size_t offset) const override;
+ void copyFrom(const CParameterBlackboard *pFromBlackboard, size_t offset) override;
};
diff --git a/upstream/parameter/BooleanParameterType.cpp b/upstream/parameter/BooleanParameterType.cpp
index 66556d3..c6a5be4 100644
--- a/upstream/parameter/BooleanParameterType.cpp
+++ b/upstream/parameter/BooleanParameterType.cpp
@@ -108,6 +108,7 @@
if (uiUserValue > 1) {
parameterAccessContext.setError("Value out of range");
+ return false;
}
uiValue = uiUserValue;
diff --git a/upstream/parameter/BooleanParameterType.h b/upstream/parameter/BooleanParameterType.h
index 6a88488..bc6c4c9 100644
--- a/upstream/parameter/BooleanParameterType.h
+++ b/upstream/parameter/BooleanParameterType.h
@@ -37,25 +37,25 @@
{
public:
CBooleanParameterType(const std::string &strName);
- virtual ~CBooleanParameterType() = default;
+ ~CBooleanParameterType() override = default;
// Kind
- virtual std::string getKind() const;
+ std::string getKind() const override;
/// Conversion
// String
- virtual bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(std::string &strValue, const uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(std::string &strValue, const uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Boolean
- virtual bool toBlackboard(bool bUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(bool &bUserValue, uint32_t uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool toBlackboard(bool bUserValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(bool &bUserValue, uint32_t uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Integer
- virtual bool toBlackboard(uint32_t uiUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(uint32_t &uiUserValue, uint32_t uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool toBlackboard(uint32_t uiUserValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(uint32_t &uiUserValue, uint32_t uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
};
diff --git a/upstream/parameter/CMakeLists.txt b/upstream/parameter/CMakeLists.txt
index 230dd5f..545f1e4 100644
--- a/upstream/parameter/CMakeLists.txt
+++ b/upstream/parameter/CMakeLists.txt
@@ -35,6 +35,7 @@
${parameter_OS_SPECIFIC_SRCS}
AreaConfiguration.cpp
ArrayParameter.cpp
+ BaseIntegerParameterType.cpp
BaseParameter.cpp
BitParameterBlock.cpp
BitParameterBlockType.cpp
@@ -66,7 +67,6 @@
HardwareBackSynchronizer.cpp
InstanceConfigurableElement.cpp
InstanceDefinition.cpp
- IntegerParameterType.cpp
LinearParameterAdaptation.cpp
LogarithmicParameterAdaptation.cpp
LoggingElementBuilderTemplate.cpp
@@ -127,19 +127,37 @@
configure_file(version.h.in "${CMAKE_CURRENT_BINARY_DIR}/version.h")
target_link_libraries(parameter
- # Unfortunatly xmlSink and xmlSource need to be exposed to the plugins
- PUBLIC xmlserializer
- PRIVATE pfw_utility remote-processor
+ PRIVATE xmlserializer pfw_utility remote-processor
PRIVATE ${CMAKE_DL_LIBS})
target_include_directories(parameter
- PUBLIC include log/include
- # Export symbol macro header
- PUBLIC "${CMAKE_CURRENT_BINARY_DIR}"
- # FIXE: define . as an PUBLIC include directory only for plugins
- PUBLIC .)
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/log/include>
+ INTERFACE $<INSTALL_INTERFACE:include/parameter/client>
+ INTERFACE $<INSTALL_INTERFACE:include/parameter/plugin>)
-install(TARGETS parameter LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib)
+install(TARGETS parameter EXPORT ParameterTargets
+ LIBRARY DESTINATION lib COMPONENT runtime
+ RUNTIME DESTINATION bin COMPONENT runtime
+ ARCHIVE DESTINATION lib COMPONENT dev)
+
+# Export an interface library for plugins to use (after the ParameterFramework
+# project is built and installed). It makes them link against libparameter and
+# use xmlserializer's and pfw_utilify's include directories.
+add_library(plugin INTERFACE)
+target_link_libraries(plugin INTERFACE parameter)
+target_include_directories(plugin
+ INTERFACE $<INSTALL_INTERFACE:include/parameter/xmlserializer>
+ INTERFACE $<INSTALL_INTERFACE:include/parameter/utility>)
+install(TARGETS plugin EXPORT ParameterTargets COMPONENT dev)
+# Unfortunately, while the "plugin" interface library is suitable for external
+# plugins (built using the installed Parameter Framework) we want to build some
+# plugins before the whole project is installed. Therefore, they need to get
+# xmlserializer's and pfw_utility's headers from the build tree. This
+# "plugin-internal-hack" is for them.
+add_library(plugin-internal-hack INTERFACE)
+target_link_libraries(plugin-internal-hack INTERFACE parameter xmlserializer)
+
# Client headers
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/parameter_export.h"
@@ -151,7 +169,8 @@
include/ParameterMgrPlatformConnector.h
include/SelectionCriterionInterface.h
include/SelectionCriterionTypeInterface.h
- DESTINATION "include/parameter/client")
+ DESTINATION "include/parameter/client"
+ COMPONENT dev)
# Core (plugin) headers
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/parameter_export.h"
@@ -161,7 +180,6 @@
Element.h
ElementBuilder.h
ElementLibrary.h
- FileIncluderElementBuilder.h
FormattedSubsystemObject.h
InstanceConfigurableElement.h
LoggingElementBuilderTemplate.h
@@ -179,6 +197,8 @@
Syncer.h
TypeElement.h
VirtualSubsystem.h
- DESTINATION "include/parameter/plugin")
+ DESTINATION "include/parameter/plugin"
+ COMPONENT dev)
install(DIRECTORY log/include/log/
- DESTINATION "include/parameter/plugin/log")
+ DESTINATION "include/parameter/plugin/log"
+ COMPONENT dev)
diff --git a/upstream/parameter/Component.h b/upstream/parameter/Component.h
index b89ea0b..e200b46 100644
--- a/upstream/parameter/Component.h
+++ b/upstream/parameter/Component.h
@@ -42,5 +42,5 @@
}
// Type
- virtual Type getType() const { return EComponent; }
+ Type getType() const override { return EComponent; }
};
diff --git a/upstream/parameter/ComponentInstance.h b/upstream/parameter/ComponentInstance.h
index 27af963..3f71a54 100644
--- a/upstream/parameter/ComponentInstance.h
+++ b/upstream/parameter/ComponentInstance.h
@@ -41,26 +41,27 @@
CComponentInstance(const std::string &strName);
// Mapping info
- virtual bool getMappingData(const std::string &strKey, const std::string *&pStrValue) const;
- virtual bool hasMappingData() const;
+ bool getMappingData(const std::string &strKey, const std::string *&pStrValue) const override;
+ bool hasMappingData() const override;
/**
* Returns the mapping associated to the current TypeElement instance
*
* @return A std::string containing the mapping as a comma separated key value pairs
*/
- virtual std::string getFormattedMapping() const;
+ std::string getFormattedMapping() const override;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
std::string getXmlElementName() const override;
private:
- virtual bool childrenAreDynamic() const;
- virtual CInstanceConfigurableElement *doInstantiate() const;
- virtual void populate(CElement *pElement) const;
+ bool childrenAreDynamic() const override;
+ CInstanceConfigurableElement *doInstantiate() const override;
+ void populate(CElement *pElement) const override;
// Related component type
const CComponentType *_pComponentType{nullptr};
diff --git a/upstream/parameter/ComponentLibrary.h b/upstream/parameter/ComponentLibrary.h
index 572b062..a58a509 100644
--- a/upstream/parameter/ComponentLibrary.h
+++ b/upstream/parameter/ComponentLibrary.h
@@ -42,11 +42,12 @@
public:
const CComponentType *getComponentType(const std::string &strName) const;
- virtual std::string getKind() const;
+ std::string getKind() const override;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
private:
- virtual bool childrenAreDynamic() const;
+ bool childrenAreDynamic() const override;
};
diff --git a/upstream/parameter/ComponentType.cpp b/upstream/parameter/ComponentType.cpp
index 76fb211..55cd96e 100644
--- a/upstream/parameter/ComponentType.cpp
+++ b/upstream/parameter/ComponentType.cpp
@@ -129,5 +129,5 @@
// Not supposed to be called directly (instantiation made through CComponentInstance object)
assert(0);
- return NULL;
+ return nullptr;
}
diff --git a/upstream/parameter/ComponentType.h b/upstream/parameter/ComponentType.h
index e8c7fff..4e621e8 100644
--- a/upstream/parameter/ComponentType.h
+++ b/upstream/parameter/ComponentType.h
@@ -41,28 +41,29 @@
CComponentType(const std::string &strName);
// Object creation
- virtual void populate(CElement *pElement) const;
+ void populate(CElement *pElement) const override;
// Mapping info
- virtual bool getMappingData(const std::string &strKey, const std::string *&pStrValue) const;
- virtual bool hasMappingData() const;
+ bool getMappingData(const std::string &strKey, const std::string *&pStrValue) const override;
+ bool hasMappingData() const override;
/**
* Returns the mapping associated to the current TypeElement instance
*
* @return A std::string containing the mapping as a comma separated key value pairs
*/
- virtual std::string getFormattedMapping() const;
+ std::string getFormattedMapping() const override;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
// CElement
- virtual bool childrenAreDynamic() const;
+ bool childrenAreDynamic() const override;
// Component creation
- virtual CInstanceConfigurableElement *doInstantiate() const;
+ CInstanceConfigurableElement *doInstantiate() const override;
// Ref
const CComponentType *_pExtendsComponentType{nullptr};
diff --git a/upstream/parameter/CompoundRule.h b/upstream/parameter/CompoundRule.h
index 712ff70..bc3ef35 100644
--- a/upstream/parameter/CompoundRule.h
+++ b/upstream/parameter/CompoundRule.h
@@ -37,29 +37,30 @@
{
public:
// Parse
- virtual bool parse(CRuleParser &ruleParser, std::string &strError);
+ bool parse(CRuleParser &ruleParser, std::string &strError) override;
// Dump
std::string dump() const override;
// Rule check
- virtual bool matches() const;
+ bool matches() const override;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
// Class kind
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
// Content dumping
std::string logValue(utility::ErrorContext &errorContext) const override;
// Returns true if children dynamic creation is to be dealt with
- virtual bool childrenAreDynamic() const;
+ bool childrenAreDynamic() const override;
// Type
bool _bTypeAll{false};
diff --git a/upstream/parameter/ConfigurableDomain.cpp b/upstream/parameter/ConfigurableDomain.cpp
index 2a74307..71bb3e8 100644
--- a/upstream/parameter/ConfigurableDomain.cpp
+++ b/upstream/parameter/ConfigurableDomain.cpp
@@ -301,7 +301,7 @@
}
// Add found element to domain
core::Results infos;
- if (!addConfigurableElement(pConfigurableElement, NULL, infos)) {
+ if (!addConfigurableElement(pConfigurableElement, nullptr, infos)) {
strError = utility::asString(infos);
serializingContext.setError(strError);
@@ -439,7 +439,7 @@
strError = "Domain configuration " + strConfiguration + " not found";
- return NULL;
+ return nullptr;
}
// Parse all configurable elements
@@ -463,7 +463,7 @@
strError = "Element not associated to the Domain";
- return NULL;
+ return nullptr;
}
// Domain splitting
@@ -535,7 +535,7 @@
}
}
- return NULL;
+ return nullptr;
}
// Configuration application if required
@@ -551,7 +551,7 @@
if (bForce) {
// Force a configuration restore by forgetting about last applied configuration
- _pLastAppliedConfiguration = NULL;
+ _pLastAppliedConfiguration = nullptr;
}
const CDomainConfiguration *pApplicableDomainConfiguration =
findApplicableDomainConfiguration();
@@ -569,7 +569,7 @@
bool bSync = !pSyncerSet && _bSequenceAware;
// Do the restore
- pApplicableDomainConfiguration->restore(pParameterBlackboard, bSync, NULL);
+ pApplicableDomainConfiguration->restore(pParameterBlackboard, bSync, nullptr);
// Record last applied configuration
_pLastAppliedConfiguration = pApplicableDomainConfiguration;
@@ -627,7 +627,7 @@
}
// Creation
- CDomainConfiguration *pDomainConfiguration = new CDomainConfiguration(strName);
+ auto pDomainConfiguration = new CDomainConfiguration(strName);
// Configurable elements association
ConfigurableElementListIterator it;
@@ -672,7 +672,7 @@
if (pDomainConfiguration == _pLastAppliedConfiguration) {
// Forget about it
- _pLastAppliedConfiguration = NULL;
+ _pLastAppliedConfiguration = nullptr;
}
// Hierarchy
@@ -719,7 +719,7 @@
const CDomainConfiguration *configuration = findConfiguration(configurationName, error);
- if (configuration == NULL) {
+ if (configuration == nullptr) {
errors.push_back(error);
return false;
@@ -994,7 +994,7 @@
return pDomainConfiguration;
}
}
- return NULL;
+ return nullptr;
}
// Search for an applicable configuration
@@ -1012,7 +1012,7 @@
return pDomainConfiguration;
}
}
- return NULL;
+ return nullptr;
}
// Gather set of configurable elements
@@ -1106,7 +1106,7 @@
pConfigurableElement->addAttachedConfigurableDomain(this);
// Create associated syncer set
- CSyncerSet *pSyncerSet = new CSyncerSet;
+ auto pSyncerSet = new CSyncerSet;
// Add to sync set the configurable element one
pConfigurableElement->fillSyncerSet(*pSyncerSet);
@@ -1182,8 +1182,7 @@
CSyncerSet *CConfigurableDomain::getSyncerSet(
const CConfigurableElement *pConfigurableElement) const
{
- ConfigurableElementToSyncerSetMapIterator mapIt =
- _configurableElementToSyncerSetMap.find(pConfigurableElement);
+ auto mapIt = _configurableElementToSyncerSetMap.find(pConfigurableElement);
ALWAYS_ASSERT(mapIt != _configurableElementToSyncerSetMap.end(),
"Could not find syncer set for " << getName() << " configurable domain");
@@ -1202,7 +1201,7 @@
strError = "Domain configuration " + strConfiguration + " not found";
- return NULL;
+ return nullptr;
}
return pDomainConfiguration;
}
@@ -1217,7 +1216,7 @@
strError = "Domain configuration " + strConfiguration + " not found";
- return NULL;
+ return nullptr;
}
return pDomainConfiguration;
}
diff --git a/upstream/parameter/ConfigurableDomain.h b/upstream/parameter/ConfigurableDomain.h
index 256e602..736ed8f 100644
--- a/upstream/parameter/ConfigurableDomain.h
+++ b/upstream/parameter/ConfigurableDomain.h
@@ -53,7 +53,7 @@
public:
CConfigurableDomain() = default;
CConfigurableDomain(const std::string &strName);
- virtual ~CConfigurableDomain();
+ ~CConfigurableDomain() override;
// Sequence awareness
void setSequenceAwareness(bool bSequenceAware);
@@ -146,15 +146,16 @@
bool isApplicableConfigurationValid(const CConfigurableElement *pConfigurableElement) const;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
- virtual void childrenToXml(CXmlElement &xmlElement,
- CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
+ void childrenToXml(CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) const override;
// Class kind
- virtual std::string getKind() const;
+ std::string getKind() const override;
protected:
// Content dumping
@@ -169,7 +170,7 @@
// Returns true if children dynamic creation is to be dealt with (here, will allow child
// deletion upon clean)
- virtual bool childrenAreDynamic() const;
+ bool childrenAreDynamic() const override;
// Ensure validity on areas related to configurable element
void validateAreas(const CConfigurableElement *pConfigurableElement,
@@ -218,7 +219,7 @@
* element are validated.
*/
void doAddConfigurableElement(CConfigurableElement *pConfigurableElement, core::Results &infos,
- const CParameterBlackboard *pMainBlackboard = NULL);
+ const CParameterBlackboard *pMainBlackboard = nullptr);
void doRemoveConfigurableElement(CConfigurableElement *pConfigurableElement,
bool bRecomputeSyncSet);
diff --git a/upstream/parameter/ConfigurableDomains.cpp b/upstream/parameter/ConfigurableDomains.cpp
index 7c51083..35674fd 100644
--- a/upstream/parameter/ConfigurableDomains.cpp
+++ b/upstream/parameter/ConfigurableDomains.cpp
@@ -84,7 +84,7 @@
}
}
// Synchronize those collected syncers
- syncerSet.sync(*pParameterBlackboard, false, NULL);
+ syncerSet.sync(*pParameterBlackboard, false, nullptr);
// Then deal with domains that need to synchronize along apply
for (size_t child = 0; child < uiNbConfigurableDomains; child++) {
@@ -94,7 +94,7 @@
std::string info;
// Apply and synchronize when relevant
- pChildConfigurableDomain->apply(pParameterBlackboard, NULL, bForce, info);
+ pChildConfigurableDomain->apply(pParameterBlackboard, nullptr, bForce, info);
if (!info.empty()) {
infos.push_back(info);
}
@@ -304,7 +304,7 @@
std::string error;
CConfigurableDomain *domain = findConfigurableDomain(domainName, error);
- if (domain == NULL) {
+ if (domain == nullptr) {
infos.push_back(error);
return false;
@@ -411,7 +411,7 @@
// Find domain
const CConfigurableDomain *domain = findConfigurableDomain(domainName, error);
- if (domain == NULL) {
+ if (domain == nullptr) {
errors.push_back(error);
return false;
@@ -541,7 +541,7 @@
std::string error;
CConfigurableDomain *domain = findConfigurableDomain(domainName, error);
- if (domain == NULL) {
+ if (domain == nullptr) {
infos.push_back(error);
return false;
@@ -574,7 +574,7 @@
if (!pConfigurableDomain) {
- return NULL;
+ return nullptr;
}
// Check that element belongs to the domain
@@ -583,7 +583,7 @@
strError = "Element \"" + pConfigurableElement->getPath() +
"\" does not belong to domain \"" + strDomain + "\"";
- return NULL;
+ return nullptr;
}
// Find Configuration Blackboard and Base Offset
@@ -612,7 +612,7 @@
strError = "Configurable domain " + strDomain + " not found";
- return NULL;
+ return nullptr;
}
return pConfigurableDomain;
diff --git a/upstream/parameter/ConfigurableDomains.h b/upstream/parameter/ConfigurableDomains.h
index 70e943b..5a096a5 100644
--- a/upstream/parameter/ConfigurableDomains.h
+++ b/upstream/parameter/ConfigurableDomains.h
@@ -161,7 +161,7 @@
std::string &strError) const;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
// Ensure validity on whole domains from main blackboard
void validate(const CParameterBlackboard *pMainBlackboard);
@@ -177,7 +177,7 @@
core::Results &infos) const;
// Class kind
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
/** Delete a domain
@@ -189,7 +189,7 @@
*/
void deleteDomain(CConfigurableDomain &configurableDomain);
// Returns true if children dynamic creation is to be dealt with
- virtual bool childrenAreDynamic() const;
+ bool childrenAreDynamic() const override;
// Gather owned configurable elements owned by any domain
void gatherAllOwnedConfigurableElements(
std::set<const CConfigurableElement *> &configurableElementSet) const;
diff --git a/upstream/parameter/ConfigurableElement.cpp b/upstream/parameter/ConfigurableElement.cpp
index 615d72b..1aecf11 100644
--- a/upstream/parameter/ConfigurableElement.cpp
+++ b/upstream/parameter/ConfigurableElement.cpp
@@ -378,7 +378,7 @@
return static_cast<const CConfigurableElement *>(pParent)->getSyncer();
}
- return NULL;
+ return nullptr;
}
// Syncer set (me, ascendant or descendant ones)
@@ -630,7 +630,7 @@
// Stop at system class
if (!pParent->getParent()) {
- return NULL;
+ return nullptr;
}
return static_cast<const CConfigurableElement *>(pParent)->getBelongingSubsystem();
diff --git a/upstream/parameter/ConfigurableElement.h b/upstream/parameter/ConfigurableElement.h
index e511447..b17521d 100644
--- a/upstream/parameter/ConfigurableElement.h
+++ b/upstream/parameter/ConfigurableElement.h
@@ -53,7 +53,7 @@
public:
CConfigurableElement(const std::string &strName = "");
- virtual ~CConfigurableElement() = default;
+ ~CConfigurableElement() override = default;
// Offset in main blackboard
void setOffset(size_t offset);
@@ -143,7 +143,7 @@
virtual void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const;
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
/**
* Get the value associated to a mapping key in the object's mapping
@@ -165,11 +165,9 @@
CXmlElement &xmlConfigurationSettingsElementContent,
CConfigurationAccessContext &configurationAccessContext) const;
- bool fromXml(const CXmlElement &xmlElement,
- CXmlSerializingContext &serializingContext) override final;
+ bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) final;
- void toXml(CXmlElement &xmlElement,
- CXmlSerializingContext &serializingContext) const override final;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const final;
/** Deserialize the structure from xml. */
virtual bool structureFromXml(const CXmlElement &xmlElement,
@@ -210,7 +208,7 @@
// Elements should be called with the overloaded version taking a
// "Parameter Access Context" (The name is misleading as it is actually
// used to access any Configurable Element).
- std::string logValue(utility::ErrorContext &errorContext) const override final;
+ std::string logValue(utility::ErrorContext &errorContext) const final;
virtual std::string logValue(CParameterAccessContext &context) const;
// Configurable domain association
diff --git a/upstream/parameter/ConfigurationAccessContext.h b/upstream/parameter/ConfigurationAccessContext.h
index 10ffd4f..d433cc4 100644
--- a/upstream/parameter/ConfigurationAccessContext.h
+++ b/upstream/parameter/ConfigurationAccessContext.h
@@ -45,7 +45,7 @@
// Serialization direction
bool serializeOut() const;
- bool serializeSettings() const override final { return true; }
+ bool serializeSettings() const final { return true; }
private:
// Serialization direction
diff --git a/upstream/parameter/DefaultElementLibrary.h b/upstream/parameter/DefaultElementLibrary.h
index 9223021..dcc4dbf 100644
--- a/upstream/parameter/DefaultElementLibrary.h
+++ b/upstream/parameter/DefaultElementLibrary.h
@@ -47,7 +47,7 @@
class CDefaultElementLibrary : public CElementLibrary
{
public:
- virtual ~CDefaultElementLibrary() = default;
+ ~CDefaultElementLibrary() override = default;
/** Set the default builder used in fallback mechanism.
* @see createElement() for more detail on this mechanism.
@@ -81,14 +81,14 @@
{
CElement *builtElement = CElementLibrary::createElement(xmlElement);
- if (builtElement != NULL) {
+ if (builtElement != nullptr) {
// The element was created, return it
return builtElement;
}
if (_defaultBuilder == nullptr) {
// The default builder mechanism is not enabled
- return NULL;
+ return nullptr;
}
// Use the default builder
diff --git a/upstream/parameter/DomainConfiguration.cpp b/upstream/parameter/DomainConfiguration.cpp
index a272c14..f5d7182 100644
--- a/upstream/parameter/DomainConfiguration.cpp
+++ b/upstream/parameter/DomainConfiguration.cpp
@@ -275,7 +275,7 @@
CRuleParser ruleParser(strApplicationRule, pSelectionCriteriaDefinition);
// Attempt to parse it
- if (!ruleParser.parse(NULL, strError)) {
+ if (!ruleParser.parse(nullptr, strError)) {
return false;
}
@@ -288,7 +288,7 @@
void CDomainConfiguration::clearApplicationRule()
{
// Replace compound rule
- setRule(NULL);
+ setRule(nullptr);
}
string CDomainConfiguration::getApplicationRule() const
@@ -478,7 +478,7 @@
// Rule created
return static_cast<const CCompoundRule *>(getChild(ECompoundRule));
}
- return NULL;
+ return nullptr;
}
CCompoundRule *CDomainConfiguration::getRule()
@@ -487,7 +487,7 @@
// Rule created
return static_cast<CCompoundRule *>(getChild(ECompoundRule));
}
- return NULL;
+ return nullptr;
}
void CDomainConfiguration::setRule(CCompoundRule *pRule)
diff --git a/upstream/parameter/DomainConfiguration.h b/upstream/parameter/DomainConfiguration.h
index f45c155..5160369 100644
--- a/upstream/parameter/DomainConfiguration.h
+++ b/upstream/parameter/DomainConfiguration.h
@@ -92,7 +92,7 @@
* @return true if success false otherwise
*/
bool restore(CParameterBlackboard *pMainBlackboard, bool bSync,
- core::Results *errors = NULL) const;
+ core::Results *errors = nullptr) const;
// Ensure validity for configurable element area configuration
void validate(const CConfigurableElement *pConfigurableElement,
@@ -122,7 +122,7 @@
CXmlDomainExportContext &context) const;
// Class kind
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
using AreaConfiguration = std::unique_ptr<CAreaConfiguration>;
@@ -130,7 +130,7 @@
// Returns true if children dynamic creation is to be dealt with (here, will allow child
// deletion upon clean)
- virtual bool childrenAreDynamic() const;
+ bool childrenAreDynamic() const override;
// XML configuration settings serializing
bool importOneConfigurableElementSettings(CAreaConfiguration *areaConfiguration,
CXmlElement &xmlConfigurableElementSettingsElement,
diff --git a/upstream/parameter/Element.cpp b/upstream/parameter/Element.cpp
index 77dfd9d..611951c 100644
--- a/upstream/parameter/Element.cpp
+++ b/upstream/parameter/Element.cpp
@@ -31,6 +31,7 @@
#include "XmlElementSerializingContext.h"
#include "ElementLibrary.h"
#include "ErrorContext.hpp"
+#include "PfError.hpp"
#include <algorithm>
#include <assert.h>
#include <stdio.h>
@@ -140,8 +141,8 @@
}
// From IXmlSink
-bool CElement::fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext)
-{
+bool CElement::fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) try {
xmlElement.getAttribute(gDescriptionPropertyName, _strDescription);
// Propagate through children
@@ -183,6 +184,9 @@
}
return true;
+} catch (const PfError &e) {
+ serializingContext.appendLineToError(e.what());
+ return false;
}
void CElement::childrenToXml(CXmlElement &xmlElement,
@@ -308,7 +312,7 @@
elementSerializingContext.setError("Unable to create XML element " +
childElement.getPath());
- return NULL;
+ return nullptr;
}
// Store created child!
addChild(pChild);
@@ -419,7 +423,7 @@
if (!pChild) {
- return NULL;
+ return nullptr;
}
return pChild->findDescendant(pathNavigator);
@@ -438,7 +442,7 @@
if (!pChild) {
- return NULL;
+ return nullptr;
}
return pChild->findDescendant(pathNavigator);
@@ -467,7 +471,7 @@
}
}
- return NULL;
+ return nullptr;
}
const CElement *CElement::findChild(const string &strName) const
@@ -480,7 +484,7 @@
}
}
- return NULL;
+ return nullptr;
}
CElement *CElement::findChildOfKind(const string &strKind)
@@ -493,7 +497,7 @@
}
}
- return NULL;
+ return nullptr;
}
const CElement *CElement::findChildOfKind(const string &strKind) const
@@ -506,7 +510,7 @@
}
}
- return NULL;
+ return nullptr;
}
string CElement::getPath() const
diff --git a/upstream/parameter/Element.h b/upstream/parameter/Element.h
index 11d41b5..b7cdc6d 100644
--- a/upstream/parameter/Element.h
+++ b/upstream/parameter/Element.h
@@ -43,13 +43,13 @@
namespace utility
{
class ErrorContext;
-}
+} // namespace utility
class PARAMETER_EXPORT CElement : public IXmlSink, public IXmlSource
{
public:
CElement(const std::string &strName = "");
- virtual ~CElement();
+ ~CElement() override;
// Description
void setDescription(const std::string &strDescription);
@@ -106,10 +106,11 @@
bool isDescendantOf(const CElement *pCandidateAscendant) const;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
/**
* Serialize the children to XML
diff --git a/upstream/parameter/ElementBuilderTemplate.h b/upstream/parameter/ElementBuilderTemplate.h
index 8f7c44f..86f8b03 100644
--- a/upstream/parameter/ElementBuilderTemplate.h
+++ b/upstream/parameter/ElementBuilderTemplate.h
@@ -35,5 +35,5 @@
class TElementBuilderTemplate : public CElementBuilder
{
public:
- virtual CElement *createElement(const CXmlElement & /*elem*/) const { return new ElementType; }
+ CElement *createElement(const CXmlElement & /*elem*/) const override { return new ElementType; }
};
diff --git a/upstream/parameter/ElementLibrary.cpp b/upstream/parameter/ElementLibrary.cpp
index bde9b91..aaeaa08 100644
--- a/upstream/parameter/ElementLibrary.cpp
+++ b/upstream/parameter/ElementLibrary.cpp
@@ -48,13 +48,13 @@
CElement *CElementLibrary::createElement(const CXmlElement &xmlElement) const
{
- ElementBuilderMapConstIterator it = _elementBuilderMap.find(getBuilderType(xmlElement));
+ auto it = _elementBuilderMap.find(getBuilderType(xmlElement));
if (it != _elementBuilderMap.end()) {
return it->second->createElement(xmlElement);
}
- return NULL;
+ return nullptr;
}
void CElementLibrary::addElementBuilder(const std::string &type,
diff --git a/upstream/parameter/EnumParameterType.cpp b/upstream/parameter/EnumParameterType.cpp
index 6eea694..468b6c6 100644
--- a/upstream/parameter/EnumParameterType.cpp
+++ b/upstream/parameter/EnumParameterType.cpp
@@ -32,6 +32,8 @@
#include "ParameterAccessContext.h"
#include "convert.hpp"
+#include <iomanip>
+
#define base CParameterType
using std::string;
@@ -129,20 +131,46 @@
}
bool CEnumParameterType::fromBlackboard(string &userValue, const uint32_t &value,
- CParameterAccessContext & /*ctx*/) const
+ CParameterAccessContext &ctx) const
{
// Convert the raw value from the blackboard
int32_t signedValue = static_cast<int32_t>(value);
signExtend(signedValue);
- // Convert from numerical space to literal space
- return getLiteral(signedValue, userValue);
+ // Take care of format
+ if (ctx.valueSpaceIsRaw()) {
+
+ // Format
+ std::ostringstream sstream;
+
+ // Numerical format requested
+ if (ctx.outputRawFormatIsHex()) {
+
+ // Hexa display with unecessary bits cleared out
+ sstream << "0x" << std::hex << std::uppercase
+ << std::setw(static_cast<int>(getSize() * 2)) << std::setfill('0')
+ << makeEncodable(value);
+
+ userValue = sstream.str();
+ } else {
+ userValue = std::to_string(value);
+ }
+ } else {
+ // Literal display requested (should succeed)
+ getLiteral(signedValue, userValue);
+ }
+ return true;
}
// Value access
bool CEnumParameterType::toBlackboard(int32_t userValue, uint32_t &value,
CParameterAccessContext ¶meterAccessContext) const
{
+ // Take care of format
+ if (parameterAccessContext.valueSpaceIsRaw()) {
+ signExtend(userValue);
+ }
+
if (!checkValueAgainstSpace(userValue)) {
parameterAccessContext.setError(std::to_string(userValue) +
diff --git a/upstream/parameter/EnumParameterType.h b/upstream/parameter/EnumParameterType.h
index b8f67f4..2103377 100644
--- a/upstream/parameter/EnumParameterType.h
+++ b/upstream/parameter/EnumParameterType.h
@@ -39,31 +39,32 @@
CEnumParameterType(const std::string &strName);
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
/// Conversion
// String
- virtual bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(std::string &strValue, const uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(std::string &strValue, const uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Integer
- virtual bool toBlackboard(int32_t iUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(int32_t &iUserValue, uint32_t uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool toBlackboard(int32_t iUserValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(int32_t &iUserValue, uint32_t uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Default value handling (simulation only)
- virtual uint32_t getDefaultValue() const;
+ uint32_t getDefaultValue() const override;
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
// Specialized version of toBlackboard in case the access context is in raw
@@ -72,7 +73,7 @@
CParameterAccessContext ¶meterAccessContext) const;
// Returns true if children dynamic creation is to be dealt with
- virtual bool childrenAreDynamic() const;
+ bool childrenAreDynamic() const override;
// Literal - numerical conversions
bool getLiteral(int32_t iNumerical, std::string &strLiteral) const;
diff --git a/upstream/parameter/EnumValuePair.h b/upstream/parameter/EnumValuePair.h
index 46d5578..8a7100d 100644
--- a/upstream/parameter/EnumValuePair.h
+++ b/upstream/parameter/EnumValuePair.h
@@ -39,13 +39,14 @@
std::string getNumericalAsString() const;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
protected:
// Content dumping
diff --git a/upstream/parameter/FileIncluderElementBuilder.h b/upstream/parameter/FileIncluderElementBuilder.h
index d66065c..eb71c90 100644
--- a/upstream/parameter/FileIncluderElementBuilder.h
+++ b/upstream/parameter/FileIncluderElementBuilder.h
@@ -47,7 +47,7 @@
{
}
- virtual CElement *createElement(const CXmlElement &xmlElement) const
+ CElement *createElement(const CXmlElement &xmlElement) const override
{
return new CXmlFileIncluderElement(xmlElement.getNameAttribute(), xmlElement.getType(),
_bValidateWithSchemas, _schemaBaseUri);
diff --git a/upstream/parameter/FixedPointParameterType.h b/upstream/parameter/FixedPointParameterType.h
index d4e96b6..943992a 100644
--- a/upstream/parameter/FixedPointParameterType.h
+++ b/upstream/parameter/FixedPointParameterType.h
@@ -39,34 +39,35 @@
CFixedPointParameterType(const std::string &strName);
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
// XML Serialization value space handling
// Value space handling for configuration import
- virtual void handleValueSpaceAttribute(
+ void handleValueSpaceAttribute(
CXmlElement &xmlConfigurableElementSettingsElement,
- CConfigurationAccessContext &configurationAccessContext) const;
+ CConfigurationAccessContext &configurationAccessContext) const override;
/// Conversion
// String
- virtual bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(std::string &strValue, const uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(std::string &strValue, const uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Double
- virtual bool toBlackboard(double dUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(double &dUserValue, uint32_t uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool toBlackboard(double dUserValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(double &dUserValue, uint32_t uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
// Util size
diff --git a/upstream/parameter/FloatingPointParameterType.h b/upstream/parameter/FloatingPointParameterType.h
index aafb5e2..b56c9aa 100644
--- a/upstream/parameter/FloatingPointParameterType.h
+++ b/upstream/parameter/FloatingPointParameterType.h
@@ -37,25 +37,26 @@
public:
CFloatingPointParameterType(const std::string &strName);
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
- virtual void handleValueSpaceAttribute(
+ void handleValueSpaceAttribute(
CXmlElement &xmlConfigurableElementSettingsElement,
- CConfigurationAccessContext &configurationAccessContext) const;
+ CConfigurationAccessContext &configurationAccessContext) const override;
- virtual bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(std::string &strValue, const uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool toBlackboard(double dUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(double &dUserValue, uint32_t uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(std::string &strValue, const uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool toBlackboard(double dUserValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ bool fromBlackboard(double &dUserValue, uint32_t uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override;
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
typedef CParameterType base;
diff --git a/upstream/parameter/FormattedSubsystemObject.h b/upstream/parameter/FormattedSubsystemObject.h
index 4793635..4a4bcea 100644
--- a/upstream/parameter/FormattedSubsystemObject.h
+++ b/upstream/parameter/FormattedSubsystemObject.h
@@ -71,14 +71,14 @@
core::log::Logger &logger, const std::string &strMappingValue,
size_t firstAmendKey, size_t nbAmendKeys,
const CMappingContext &context);
- virtual ~CFormattedSubsystemObject() = default;
+ ~CFormattedSubsystemObject() override = default;
/**
* Returns the formatted mapping value associated to the element.
*
* @return A std::string containing the mapping
*/
- virtual std::string getFormattedMappingValue() const;
+ std::string getFormattedMappingValue() const override;
private:
/**
diff --git a/upstream/parameter/FrameworkConfigurationGroup.h b/upstream/parameter/FrameworkConfigurationGroup.h
index 551cb5e..27fdc18 100644
--- a/upstream/parameter/FrameworkConfigurationGroup.h
+++ b/upstream/parameter/FrameworkConfigurationGroup.h
@@ -42,5 +42,5 @@
}
private:
- virtual bool childrenAreDynamic() const { return true; }
+ bool childrenAreDynamic() const override { return true; }
};
diff --git a/upstream/parameter/FrameworkConfigurationLocation.h b/upstream/parameter/FrameworkConfigurationLocation.h
index 7182db9..bafa2c7 100644
--- a/upstream/parameter/FrameworkConfigurationLocation.h
+++ b/upstream/parameter/FrameworkConfigurationLocation.h
@@ -43,7 +43,8 @@
const std::string &getUri() const;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
private:
std::string _configurationUri;
diff --git a/upstream/parameter/HardwareBackSynchronizer.cpp b/upstream/parameter/HardwareBackSynchronizer.cpp
index dbc23eb..c46e6dd 100644
--- a/upstream/parameter/HardwareBackSynchronizer.cpp
+++ b/upstream/parameter/HardwareBackSynchronizer.cpp
@@ -51,5 +51,5 @@
void CHardwareBackSynchronizer::sync()
{
// Perform back synchronization
- _backSyncerSet.sync(*_pParameterBlackboard, true, NULL);
+ _backSyncerSet.sync(*_pParameterBlackboard, true, nullptr);
}
diff --git a/upstream/parameter/HardwareBackSynchronizer.h b/upstream/parameter/HardwareBackSynchronizer.h
index fd2e70d..03aaa04 100644
--- a/upstream/parameter/HardwareBackSynchronizer.h
+++ b/upstream/parameter/HardwareBackSynchronizer.h
@@ -39,7 +39,7 @@
CParameterBlackboard *pParameterBlackboard);
// Back synchronization
- virtual void sync();
+ void sync() override;
private:
// Back syncer set
diff --git a/upstream/parameter/InstanceConfigurableElement.cpp b/upstream/parameter/InstanceConfigurableElement.cpp
index f9afa20..25a7ec9 100644
--- a/upstream/parameter/InstanceConfigurableElement.cpp
+++ b/upstream/parameter/InstanceConfigurableElement.cpp
@@ -145,7 +145,7 @@
void CInstanceConfigurableElement::unsetSyncer()
{
- _pSyncer = NULL;
+ _pSyncer = nullptr;
}
// Syncer
diff --git a/upstream/parameter/InstanceConfigurableElement.h b/upstream/parameter/InstanceConfigurableElement.h
index 0b4a7f9..d1b52f1 100644
--- a/upstream/parameter/InstanceConfigurableElement.h
+++ b/upstream/parameter/InstanceConfigurableElement.h
@@ -59,7 +59,7 @@
// Instantiated type
const CTypeElement *getTypeElement() const;
- virtual bool getMappingData(const std::string &strKey, const std::string *&pStrValue) const;
+ bool getMappingData(const std::string &strKey, const std::string *&pStrValue) const override;
/**
* Returns the mapping data associated to the type element of the current
@@ -70,7 +70,7 @@
std::string getFormattedMapping() const override;
// From CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
std::string getXmlElementName() const override;
// Syncer to/from HW
@@ -84,7 +84,7 @@
bool map(IMapper &mapper, std::string &strError);
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
// Scalar or Array?
bool isScalar() const;
@@ -92,14 +92,14 @@
// Array Length
size_t getArrayLength() const;
- virtual void structureToXml(CXmlElement &xmlElement,
- CXmlSerializingContext &serializingContext) const;
+ void structureToXml(CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) const override;
protected:
// Syncer
- virtual ISyncer *getSyncer() const;
+ ISyncer *getSyncer() const override;
// Syncer set (descendant)
- virtual void fillSyncerSetFromDescendant(CSyncerSet &syncerSet) const;
+ void fillSyncerSetFromDescendant(CSyncerSet &syncerSet) const override;
/**
* Performs the sync if the AutoSync is enabled.
diff --git a/upstream/parameter/InstanceDefinition.cpp b/upstream/parameter/InstanceDefinition.cpp
index e461fa4..12d5126 100644
--- a/upstream/parameter/InstanceDefinition.cpp
+++ b/upstream/parameter/InstanceDefinition.cpp
@@ -47,7 +47,7 @@
// Element not supposed to be instantiated direcly
assert(0);
- return NULL;
+ return nullptr;
}
void CInstanceDefinition::createInstances(CElement *pFatherElement)
diff --git a/upstream/parameter/InstanceDefinition.h b/upstream/parameter/InstanceDefinition.h
index 212c535..0624c94 100644
--- a/upstream/parameter/InstanceDefinition.h
+++ b/upstream/parameter/InstanceDefinition.h
@@ -38,9 +38,9 @@
public:
void createInstances(CElement *pFatherElement);
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
- virtual bool childrenAreDynamic() const;
- virtual CInstanceConfigurableElement *doInstantiate() const;
+ bool childrenAreDynamic() const override;
+ CInstanceConfigurableElement *doInstantiate() const override;
};
diff --git a/upstream/parameter/IntegerParameterBuilder.h b/upstream/parameter/IntegerParameterBuilder.h
new file mode 100644
index 0000000..d6204ac
--- /dev/null
+++ b/upstream/parameter/IntegerParameterBuilder.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#pragma once
+
+#include "ElementBuilder.h"
+#include "IntegerParameterType.h"
+
+/** Specialized element builder for IntegerParameterType
+ *
+ * Dispatch to the correct template instance according to the signedness and
+ * size.
+ */
+class IntegerParameterBuilder : public CElementBuilder
+{
+public:
+ CElement *createElement(const CXmlElement &xmlElement) const override
+ {
+ size_t sizeInBits;
+ sizeInBits = xmlElement.getAttribute("Size", sizeInBits) ? sizeInBits : 32;
+
+ bool isSigned = false;
+ xmlElement.getAttribute("Signed", isSigned);
+
+ auto name = xmlElement.getNameAttribute();
+
+ switch (sizeInBits) {
+ case 8:
+ if (isSigned) {
+ return new CIntegerParameterType<true, 8>(name);
+ }
+ return new CIntegerParameterType<false, 8>(name);
+ case 16:
+ if (isSigned) {
+ return new CIntegerParameterType<true, 16>(name);
+ }
+ return new CIntegerParameterType<false, 16>(name);
+ case 32:
+ if (isSigned) {
+ return new CIntegerParameterType<true, 32>(name);
+ }
+ return new CIntegerParameterType<false, 32>(name);
+ default:
+ return nullptr;
+ }
+ }
+};
diff --git a/upstream/parameter/IntegerParameterType.cpp b/upstream/parameter/IntegerParameterType.cpp
deleted file mode 100644
index 4899514..0000000
--- a/upstream/parameter/IntegerParameterType.cpp
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Copyright (c) 2011-2015, Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "IntegerParameterType.h"
-#include <stdlib.h>
-#include <sstream>
-#include <iomanip>
-#include "ParameterAccessContext.h"
-#include <assert.h>
-#include "ParameterAdaptation.h"
-#include "Utility.h"
-#include <errno.h>
-
-#define base CParameterType
-
-using std::string;
-using std::ostringstream;
-
-CIntegerParameterType::CIntegerParameterType(const string &strName) : base(strName)
-{
-}
-
-// Kind
-string CIntegerParameterType::getKind() const
-{
- return "IntegerParameter";
-}
-
-// Deal with adaption node
-bool CIntegerParameterType::childrenAreDynamic() const
-{
- return true;
-}
-
-// Element properties
-void CIntegerParameterType::showProperties(string &strResult) const
-{
- base::showProperties(strResult);
-
- // Sign
- strResult += "Signed: ";
- strResult += _bSigned ? "yes" : "no";
- strResult += "\n";
-
- // Min
- strResult += "Min: ";
- strResult += _bSigned ? std::to_string((int32_t)_uiMin) : std::to_string(_uiMin);
- strResult += "\n";
-
- // Max
- strResult += "Max: ";
- strResult += _bSigned ? std::to_string((int32_t)_uiMax) : std::to_string(_uiMax);
- strResult += "\n";
-
- // Check if there's an adaptation object available
- const CParameterAdaptation *pParameterAdaption = getParameterAdaptation();
-
- if (pParameterAdaption) {
-
- // Display adaptation properties
- strResult += "Adaptation:\n";
-
- pParameterAdaption->showProperties(strResult);
- }
-}
-
-bool CIntegerParameterType::fromXml(const CXmlElement &xmlElement,
- CXmlSerializingContext &serializingContext)
-{
- // Sign
- xmlElement.getAttribute("Signed", _bSigned);
-
- // Size in bits
- size_t sizeInBits = 0;
- xmlElement.getAttribute("Size", sizeInBits);
-
- // Size
- setSize(sizeInBits / 8);
-
- // Min / Max
- // TODO: Make IntegerParameter template
- if (_bSigned) {
-
- // Signed means we have one less util bit
- sizeInBits--;
-
- if (!xmlElement.getAttribute("Min", (int32_t &)_uiMin)) {
-
- _uiMin = 1U << sizeInBits;
- }
-
- if (!xmlElement.getAttribute("Max", (int32_t &)_uiMax)) {
-
- _uiMax = (1U << sizeInBits) - 1;
- }
- signExtend((int32_t &)_uiMin);
- signExtend((int32_t &)_uiMax);
- } else {
- if (!xmlElement.getAttribute("Min", _uiMin)) {
-
- _uiMin = 0;
- }
-
- if (!xmlElement.getAttribute("Max", _uiMax)) {
-
- _uiMax = ~0U >> (8 * sizeof(size_t) - sizeInBits);
- }
- }
-
- // Base
- return base::fromXml(xmlElement, serializingContext);
-}
-
-// Conversion (tuning)
-bool CIntegerParameterType::toBlackboard(const string &strValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const
-{
- // Hexa
- bool bValueProvidedAsHexa = utility::isHexadecimal(strValue);
-
- // Get integer value from the string provided
- int64_t iData;
-
- if (!convertValueFromString(strValue, iData, parameterAccessContext)) {
-
- return false;
- }
-
- // Check against Min / Max
- if (_bSigned) {
-
- if (bValueProvidedAsHexa && isEncodable((uint64_t)iData, !bValueProvidedAsHexa)) {
-
- // Sign extend
- signExtend(iData);
- }
-
- if (!checkValueAgainstRange<int64_t>(strValue, iData, (int32_t)_uiMin, (int32_t)_uiMax,
- parameterAccessContext, bValueProvidedAsHexa)) {
-
- return false;
- }
- } else {
-
- if (!checkValueAgainstRange<uint64_t>(strValue, iData, _uiMin, _uiMax,
- parameterAccessContext, bValueProvidedAsHexa)) {
-
- return false;
- }
- }
-
- uiValue = (uint32_t)iData;
-
- return true;
-}
-
-bool CIntegerParameterType::fromBlackboard(string &strValue, const uint32_t &value,
- CParameterAccessContext ¶meterAccessContext) const
-{
- // Check unsigned value is encodable
- assert(isEncodable(value, false));
-
- // Format
- ostringstream stream;
-
- // Take care of format
- if (parameterAccessContext.valueSpaceIsRaw() && parameterAccessContext.outputRawFormatIsHex()) {
-
- // Hexa display with unecessary bits cleared out
- stream << "0x" << std::hex << std::uppercase << std::setw(static_cast<int>(getSize() * 2))
- << std::setfill('0') << value;
- } else {
-
- if (_bSigned) {
-
- int32_t iValue = value;
-
- // Sign extend
- signExtend(iValue);
-
- stream << iValue;
- } else {
-
- stream << value;
- }
- }
-
- strValue = stream.str();
-
- return true;
-}
-
-// Value access
-// Integer
-bool CIntegerParameterType::toBlackboard(uint32_t uiUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const
-{
- if (uiUserValue < _uiMin || uiUserValue > _uiMax) {
-
- parameterAccessContext.setError("Value out of range");
-
- return false;
- }
- // Do assign
- uiValue = uiUserValue;
-
- return true;
-}
-
-bool CIntegerParameterType::fromBlackboard(uint32_t &uiUserValue, uint32_t uiValue,
- CParameterAccessContext & /*ctx*/) const
-{
- // Do assign
- uiUserValue = uiValue;
-
- return true;
-}
-
-// Signed Integer
-bool CIntegerParameterType::toBlackboard(int32_t iUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const
-{
- if (iUserValue < (int32_t)_uiMin || iUserValue > (int32_t)_uiMax) {
-
- parameterAccessContext.setError("Value out of range");
-
- return false;
- }
- // Do assign
- uiValue = iUserValue;
-
- return true;
-}
-
-bool CIntegerParameterType::fromBlackboard(int32_t &iUserValue, uint32_t uiValue,
- CParameterAccessContext & /*ctx*/) const
-{
- int32_t iValue = uiValue;
-
- // Sign extend
- signExtend(iValue);
-
- // Do assign
- iUserValue = iValue;
-
- return true;
-}
-
-// Double
-bool CIntegerParameterType::toBlackboard(double dUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const
-{
- // Check if there's an adaptation object available
- const CParameterAdaptation *pParameterAdaption = getParameterAdaptation();
-
- if (!pParameterAdaption) {
-
- // Reject request and let upper class handle the error
- return base::toBlackboard(dUserValue, uiValue, parameterAccessContext);
- }
-
- // Do the conversion
- int64_t iConvertedValue = pParameterAdaption->fromUserValue(dUserValue);
-
- // Check against range
- if (_bSigned) {
-
- if (iConvertedValue < (int32_t)_uiMin || iConvertedValue > (int32_t)_uiMax) {
-
- parameterAccessContext.setError("Value out of range");
-
- return false;
- }
- } else {
-
- if (iConvertedValue < _uiMin || iConvertedValue > _uiMax) {
-
- parameterAccessContext.setError("Value out of range");
-
- return false;
- }
- }
-
- // Do assign
- uiValue = (uint32_t)iConvertedValue;
-
- return true;
-}
-
-bool CIntegerParameterType::fromBlackboard(double &dUserValue, uint32_t uiValue,
- CParameterAccessContext ¶meterAccessContext) const
-{
- // Check if there's an adaptation object available
- const CParameterAdaptation *pParameterAdaption = getParameterAdaptation();
-
- if (!pParameterAdaption) {
-
- // Reject request and let upper class handle the error
- return base::fromBlackboard(dUserValue, uiValue, parameterAccessContext);
- }
-
- int64_t iValueToConvert;
-
- // Deal with signed data
- if (_bSigned) {
-
- int32_t iValue = uiValue;
-
- signExtend(iValue);
-
- iValueToConvert = iValue;
- } else {
-
- iValueToConvert = uiValue;
- }
-
- // Do the conversion
- dUserValue = pParameterAdaption->toUserValue(iValueToConvert);
-
- return true;
-}
-
-// Default value handling (simulation only)
-uint32_t CIntegerParameterType::getDefaultValue() const
-{
- return _uiMin;
-}
-
-int CIntegerParameterType::toPlainInteger(int iSizeOptimizedData) const
-{
- if (_bSigned) {
-
- signExtend(iSizeOptimizedData);
- }
-
- return base::toPlainInteger(iSizeOptimizedData);
-}
-
-// Convert value provided by the user as a string into an int64
-bool CIntegerParameterType::convertValueFromString(
- const string &strValue, int64_t &iData, CParameterAccessContext ¶meterAccessContext) const
-{
-
- // Reset errno to check if it is updated during the conversion (strtol/strtoul)
- errno = 0;
- char *pcStrEnd;
-
- // Convert the input string
- if (_bSigned) {
-
- iData = strtoll(strValue.c_str(), &pcStrEnd, 0);
- } else {
-
- iData = strtoull(strValue.c_str(), &pcStrEnd, 0);
- }
-
- // Conversion error when the input string does not contain only digits or the number is out of
- // range (int32_t type)
- if (errno || (*pcStrEnd != '\0')) {
-
- string strError;
- strError = "Impossible to convert value " + strValue + " for " + getKind();
-
- parameterAccessContext.setError(strError);
-
- return false;
- }
-
- return true;
-}
-
-// Range checking
-template <typename type>
-bool CIntegerParameterType::checkValueAgainstRange(const string &strValue, type value,
- type minValue, type maxValue,
- CParameterAccessContext ¶meterAccessContext,
- bool bHexaValue) const
-{
- if (value < minValue || value > maxValue) {
-
- ostringstream stream;
-
- stream << "Value " << strValue << " standing out of admitted range [";
-
- if (bHexaValue) {
-
- stream << "0x" << std::hex << std::uppercase
- << std::setw(static_cast<int>(getSize() * 2)) << std::setfill('0');
- // Format Min
- stream << minValue;
- // Format Max
- stream << maxValue;
-
- } else {
-
- stream << minValue << ", " << maxValue;
- }
-
- stream << "] for " << getKind();
-
- parameterAccessContext.setError(stream.str());
-
- return false;
- }
- return true;
-}
-
-// Adaptation element retrieval
-const CParameterAdaptation *CIntegerParameterType::getParameterAdaptation() const
-{
- return static_cast<const CParameterAdaptation *>(findChildOfKind("Adaptation"));
-}
-
-// From IXmlSource
-void CIntegerParameterType::toXml(CXmlElement &xmlElement,
- CXmlSerializingContext &serializingContext) const
-{
- // Sign
- xmlElement.setAttribute("Signed", _bSigned);
-
- if (_bSigned) {
-
- // Mininmum
- xmlElement.setAttribute("Min", (int32_t)_uiMin);
-
- // Maximum
- xmlElement.setAttribute("Max", (int32_t)_uiMax);
-
- } else {
-
- // Minimum
- xmlElement.setAttribute("Min", _uiMin);
-
- // Maximum
- xmlElement.setAttribute("Max", _uiMax);
- }
-
- // Size
- xmlElement.setAttribute("Size", getSize() * 8);
-
- base::toXml(xmlElement, serializingContext);
-}
diff --git a/upstream/parameter/IntegerParameterType.h b/upstream/parameter/IntegerParameterType.h
index 5eea40b..797cd44 100644
--- a/upstream/parameter/IntegerParameterType.h
+++ b/upstream/parameter/IntegerParameterType.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2016, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -29,78 +29,317 @@
*/
#pragma once
-#include "ParameterType.h"
+#include "BaseIntegerParameterType.h"
+#include "ParameterAdaptation.h"
+#include "ParameterAccessContext.h"
+#include <convert.hpp>
+
+#include <type_traits>
+#include <sstream>
#include <string>
#include <limits>
+#include <iomanip>
-class CParameterAdaptation;
-
-class CIntegerParameterType : public CParameterType
+namespace detail
{
-public:
- CIntegerParameterType(const std::string &strName);
-
- // From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
-
- // From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
-
- /// Conversion
- // String
- virtual bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(std::string &strValue, const uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- // Integer
- virtual bool toBlackboard(uint32_t uiUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(uint32_t &uiUserValue, uint32_t uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- // Signed Integer
- virtual bool toBlackboard(int32_t iUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(int32_t &iUserValue, uint32_t uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- // Double
- virtual bool toBlackboard(double dUserValue, uint32_t &uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual bool fromBlackboard(double &dUserValue, uint32_t uiValue,
- CParameterAccessContext ¶meterAccessContext) const;
-
- // Default value handling (simulation only)
- virtual uint32_t getDefaultValue() const;
-
- // Element properties
- virtual void showProperties(std::string &strResult) const;
-
- // Integer conversion
- virtual int toPlainInteger(int iSizeOptimizedData) const;
-
- // CElement
- virtual std::string getKind() const;
+template <bool isSigned, size_t size>
+struct IntegerTraits
+{
+ static_assert(size == 8 or size == 16 or size == 32,
+ "IntegerParameterType size must be 8, 16 or 32.");
private:
- // Returns true if children dynamic creation is to be dealt with
- virtual bool childrenAreDynamic() const;
+ // Assumes that size is either 8, 16 or 32, which is ensured by the static_assert above.
+ using Signed = typename std::conditional<
+ size == 8, int8_t, typename std::conditional<size == 16, int16_t, int32_t>::type>::type;
+ using Unsigned = typename std::make_unsigned<Signed>::type;
- // Conversion from std::string
- bool convertValueFromString(const std::string &strValue, int64_t &iData,
- CParameterAccessContext ¶meterAccessContext) const;
+public:
+ using CType = typename std::conditional<isSigned, Signed, Unsigned>::type;
+};
+} // namespace detail
+
+template <bool isSigned, size_t bitSize>
+class CIntegerParameterType : public CBaseIntegerParameterType
+{
+private:
+ using Base = CBaseIntegerParameterType;
+ using CType = typename detail::IntegerTraits<isSigned, bitSize>::CType;
+
+ template <class UserType>
+ bool doToBlackboard(UserType userValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const
+ {
+ {
+ if (userValue < static_cast<UserType>(_min) ||
+ userValue > static_cast<UserType>(_max)) {
+
+ parameterAccessContext.setError("Value out of range");
+ return false;
+ }
+ // Do assign
+ uiValue = userValue;
+
+ return true;
+ }
+ }
+
+public:
+ CIntegerParameterType(const std::string &name) : Base(name){};
+
+ // From IXmlSink
+ bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) override
+ {
+ setSize(bitSize / 8);
+
+ xmlElement.getAttribute("Min", _min);
+ xmlElement.getAttribute("Max", _max);
+
+ if (_min > _max) {
+ serializingContext.setError("The range of allowed value is empty (" +
+ std::to_string(_min) + " > " + std::to_string(_max) + ").");
+ return false;
+ }
+
+ // Base
+ return Base::fromXml(xmlElement, serializingContext);
+ }
+
+ // From IXmlSource
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override
+ {
+ xmlElement.setAttribute("Signed", isSigned);
+
+ xmlElement.setAttribute("Min", _min);
+ xmlElement.setAttribute("Max", _max);
+
+ xmlElement.setAttribute("Size", bitSize);
+
+ Base::toXml(xmlElement, serializingContext);
+ }
+
+ bool fromBlackboard(std::string &strValue, const uint32_t &value,
+ CParameterAccessContext ¶meterAccessContext) const override
+ {
+ // Format
+ std::ostringstream stream;
+
+ // Take care of format
+ if (parameterAccessContext.valueSpaceIsRaw() &&
+ parameterAccessContext.outputRawFormatIsHex()) {
+
+ // Hexa display with unecessary bits cleared out
+ stream << "0x" << std::hex << std::uppercase
+ << std::setw(static_cast<int>(getSize() * 2)) << std::setfill('0') << value;
+ } else {
+
+ if (isSigned) {
+
+ int32_t iValue = value;
+
+ // Sign extend
+ signExtend(iValue);
+
+ stream << iValue;
+ } else {
+
+ stream << value;
+ }
+ }
+
+ strValue = stream.str();
+
+ return true;
+ }
+
+ // Value access
+ // Integer
+ bool toBlackboard(uint32_t uiUserValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override
+ {
+ return doToBlackboard(uiUserValue, uiValue, parameterAccessContext);
+ }
+
+ // Signed Integer
+ bool toBlackboard(int32_t iUserValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override
+ {
+ return doToBlackboard(iUserValue, uiValue, parameterAccessContext);
+ }
+
+ // Double
+ bool toBlackboard(double dUserValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override
+ {
+ // Check if there's an adaptation object available
+ const CParameterAdaptation *pParameterAdaption = getParameterAdaptation();
+
+ if (!pParameterAdaption) {
+
+ // Reject request and let upper class handle the error
+ return Base::toBlackboard(dUserValue, uiValue, parameterAccessContext);
+ }
+
+ // Do the conversion
+ int64_t iConvertedValue = pParameterAdaption->fromUserValue(dUserValue);
+
+ if (iConvertedValue < _min || iConvertedValue > _max) {
+
+ parameterAccessContext.setError("Value out of range");
+
+ return false;
+ }
+
+ // Do assign
+ uiValue = (uint32_t)iConvertedValue;
+
+ return true;
+ }
+
+ template <class T>
+ bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const
+ {
+ T intermediate;
+ if (not convertTo(strValue, intermediate)) {
+ std::string strError;
+ strError = "Impossible to convert value " + strValue + " for " + getKind();
+
+ parameterAccessContext.setError(strError);
+ return false;
+ }
+
+ CType value = static_cast<CType>(intermediate);
+ if (!checkValueAgainstRange(strValue, intermediate, parameterAccessContext,
+ utility::isHexadecimal(strValue))) {
+ return false;
+ }
+ uiValue = (uint32_t)value;
+
+ return true;
+ }
+
+ // String
+ bool toBlackboard(const std::string &strValue, uint32_t &uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override
+ {
+ if (isSigned and utility::isHexadecimal(strValue)) {
+ using Intermediate = typename std::make_unsigned<CType>::type;
+
+ return toBlackboard<Intermediate>(strValue, uiValue, parameterAccessContext);
+ } else {
+ return toBlackboard<CType>(strValue, uiValue, parameterAccessContext);
+ }
+ }
+
+ bool fromBlackboard(double &dUserValue, uint32_t uiValue,
+ CParameterAccessContext ¶meterAccessContext) const override
+ {
+ // Check if there's an adaptation object available
+ const CParameterAdaptation *pParameterAdaption = getParameterAdaptation();
+
+ if (!pParameterAdaption) {
+
+ // Reject request and let upper class handle the error
+ return Base::fromBlackboard(dUserValue, uiValue, parameterAccessContext);
+ }
+
+ int64_t iValueToConvert;
+
+ // Deal with signed data
+ if (isSigned) {
+
+ int32_t iValue = uiValue;
+
+ signExtend(iValue);
+
+ iValueToConvert = iValue;
+ } else {
+
+ iValueToConvert = uiValue;
+ }
+
+ // Do the conversion
+ dUserValue = pParameterAdaption->toUserValue(iValueToConvert);
+
+ return true;
+ }
+
+ // Default value handling (simulation only)
+ uint32_t getDefaultValue() const override { return _min; }
+
+ // Element properties
+ void showProperties(std::string &strResult) const override
+ {
+ Base::showProperties(strResult);
+
+ std::ostringstream stream;
+ stream << "Signed: " << (isSigned ? "yes" : "no") << "\n"
+ << "Min: " << _min << "\n"
+ << "Max: " << _max << "\n";
+
+ strResult += stream.str();
+
+ // Check if there's an adaptation object available
+ const CParameterAdaptation *pParameterAdaption = getParameterAdaptation();
+
+ if (pParameterAdaption) {
+
+ // Display adaptation properties
+ strResult += "Adaptation:\n";
+
+ pParameterAdaption->showProperties(strResult);
+ }
+ }
+
+ // Integer conversion
+ int toPlainInteger(int iSizeOptimizedData) const override
+ {
+ if (isSigned) {
+
+ signExtend(iSizeOptimizedData);
+ }
+
+ return Base::toPlainInteger(iSizeOptimizedData);
+ }
// Range checking
- template <typename type>
- bool checkValueAgainstRange(const std::string &strValue, type value, type minValue,
- type maxValue, CParameterAccessContext ¶meterAccessContext,
- bool bHexaValue) const;
+ bool checkValueAgainstRange(const std::string &strValue, CType value,
+ CParameterAccessContext ¶meterAccessContext,
+ bool bHexaValue) const
+ {
+ if (value < _min || value > _max) {
- // Adaptation element retrieval
- const CParameterAdaptation *getParameterAdaptation() const;
+ std::ostringstream stream;
- // Signing
- bool _bSigned{false};
+ stream << "Value " << strValue << " standing out of admitted range [";
+
+ if (bHexaValue) {
+
+ stream << "0x" << std::hex << std::uppercase
+ << std::setw(static_cast<int>(getSize() * 2)) << std::setfill('0');
+ // Format Min
+ stream << _min;
+ // Format Max
+ stream << _max;
+
+ } else {
+
+ stream << _min << ", " << _max;
+ }
+
+ stream << "] for " << getKind();
+
+ parameterAccessContext.setError(stream.str());
+
+ return false;
+ }
+ return true;
+ }
+
+private:
// Range
- uint32_t _uiMin{0};
- uint32_t _uiMax{std::numeric_limits<uint32_t>::max()};
+ CType _min{std::numeric_limits<CType>::min()};
+ CType _max{std::numeric_limits<CType>::max()};
};
diff --git a/upstream/parameter/KindElement.h b/upstream/parameter/KindElement.h
index 848180a..608a832 100644
--- a/upstream/parameter/KindElement.h
+++ b/upstream/parameter/KindElement.h
@@ -41,7 +41,7 @@
{
}
- virtual std::string getKind() const { return _strKind; }
+ std::string getKind() const override { return _strKind; }
private:
std::string _strKind;
};
diff --git a/upstream/parameter/KindElementBuilderTemplate.h b/upstream/parameter/KindElementBuilderTemplate.h
index ffce475..22666e6 100644
--- a/upstream/parameter/KindElementBuilderTemplate.h
+++ b/upstream/parameter/KindElementBuilderTemplate.h
@@ -37,7 +37,7 @@
public:
TKindElementBuilderTemplate() : CElementBuilder() {}
- virtual CElement *createElement(const CXmlElement &xmlElement) const
+ CElement *createElement(const CXmlElement &xmlElement) const override
{
return new ElementType(xmlElement.getNameAttribute(), xmlElement.getType());
}
diff --git a/upstream/parameter/LinearParameterAdaptation.h b/upstream/parameter/LinearParameterAdaptation.h
index 0c6ff5e..ac349af 100644
--- a/upstream/parameter/LinearParameterAdaptation.h
+++ b/upstream/parameter/LinearParameterAdaptation.h
@@ -40,14 +40,15 @@
CLinearParameterAdaptation(const std::string &strType);
// Conversions
- virtual int64_t fromUserValue(double dValue) const;
- virtual double toUserValue(int64_t iValue) const;
+ int64_t fromUserValue(double dValue) const override;
+ double toUserValue(int64_t iValue) const override;
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
private:
// Slope attributes
diff --git a/upstream/parameter/LogarithmicParameterAdaptation.h b/upstream/parameter/LogarithmicParameterAdaptation.h
index 9c2553b..fc3d3d6 100644
--- a/upstream/parameter/LogarithmicParameterAdaptation.h
+++ b/upstream/parameter/LogarithmicParameterAdaptation.h
@@ -53,12 +53,13 @@
* f'(y) * log(base) = log (x)
* exp(f'(y)*log(base)) = x
*/
- virtual int64_t fromUserValue(double dValue) const;
- virtual double toUserValue(int64_t iValue) const;
+ int64_t fromUserValue(double dValue) const override;
+ double toUserValue(int64_t iValue) const override;
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
private:
/**
diff --git a/upstream/parameter/LoggingElementBuilderTemplate.cpp b/upstream/parameter/LoggingElementBuilderTemplate.cpp
index 8c87a47..b640c93 100644
--- a/upstream/parameter/LoggingElementBuilderTemplate.cpp
+++ b/upstream/parameter/LoggingElementBuilderTemplate.cpp
@@ -37,4 +37,4 @@
{
return xmlElement.getNameAttribute();
}
-}
+} // namespace details
diff --git a/upstream/parameter/LoggingElementBuilderTemplate.h b/upstream/parameter/LoggingElementBuilderTemplate.h
index 1bfff06..a4b407b 100644
--- a/upstream/parameter/LoggingElementBuilderTemplate.h
+++ b/upstream/parameter/LoggingElementBuilderTemplate.h
@@ -58,7 +58,7 @@
*
*/
std::string PARAMETER_EXPORT getName(const CXmlElement &xmlElement);
-}
+} // namespace details
/**
* Builder for elements which need logger at construction
@@ -85,7 +85,7 @@
*
* @return pointer to the generated element
*/
- virtual CElement *createElement(const CXmlElement &xmlElement) const
+ CElement *createElement(const CXmlElement &xmlElement) const override
{
return new ElementType(details::getName(xmlElement), mLogger);
}
diff --git a/upstream/parameter/MappingContext.cpp b/upstream/parameter/MappingContext.cpp
index 1235e31..3599296 100644
--- a/upstream/parameter/MappingContext.cpp
+++ b/upstream/parameter/MappingContext.cpp
@@ -63,15 +63,15 @@
return 0;
}
- return strtoul(mItems[itemType].strItem->c_str(), NULL, 0);
+ return strtoul(mItems[itemType].strItem->c_str(), nullptr, 0);
}
const string *CMappingContext::getItem(const string &strKey) const
{
auto itemFound = find_if(begin(mItems), end(mItems), [&](const SItem &item) {
- return item.strKey != NULL && strKey == *item.strKey;
+ return item.strKey != nullptr && strKey == *item.strKey;
});
- return (itemFound != end(mItems)) ? itemFound->strKey : NULL;
+ return (itemFound != end(mItems)) ? itemFound->strKey : nullptr;
}
bool CMappingContext::iSet(size_t itemType) const
diff --git a/upstream/parameter/MappingData.cpp b/upstream/parameter/MappingData.cpp
index cc34103..3ea054e 100644
--- a/upstream/parameter/MappingData.cpp
+++ b/upstream/parameter/MappingData.cpp
@@ -73,7 +73,7 @@
bool CMappingData::getValue(const std::string &strkey, const std::string *&pStrValue) const
{
- KeyToValueMapConstIterator it = _keyToValueMap.find(strkey);
+ auto it = _keyToValueMap.find(strkey);
if (it != _keyToValueMap.end()) {
diff --git a/upstream/parameter/NamedElementBuilderTemplate.h b/upstream/parameter/NamedElementBuilderTemplate.h
index 8c22956..26bff26 100644
--- a/upstream/parameter/NamedElementBuilderTemplate.h
+++ b/upstream/parameter/NamedElementBuilderTemplate.h
@@ -35,7 +35,7 @@
class TNamedElementBuilderTemplate : public CElementBuilder
{
public:
- virtual CElement *createElement(const CXmlElement &xmlElement) const
+ CElement *createElement(const CXmlElement &xmlElement) const override
{
return new ElementType(xmlElement.getNameAttribute());
}
diff --git a/upstream/parameter/Parameter.h b/upstream/parameter/Parameter.h
index 2c97409..f6fa60a 100644
--- a/upstream/parameter/Parameter.h
+++ b/upstream/parameter/Parameter.h
@@ -41,15 +41,15 @@
CParameter(const std::string &strName, const CTypeElement *pTypeElement);
// Instantiation, allocation
- virtual size_t getFootPrint() const;
+ size_t getFootPrint() const override;
// Type
- virtual Type getType() const;
+ Type getType() const override;
// XML configuration settings parsing/composing
- virtual bool serializeXmlSettings(
+ bool serializeXmlSettings(
CXmlElement &xmlConfigurationSettingsElementContent,
- CConfigurationAccessContext &configurationAccessContext) const;
+ CConfigurationAccessContext &configurationAccessContext) const override;
// Boolean access
bool access(bool &bValue, bool bSet,
@@ -69,13 +69,13 @@
protected:
// Used for simulation and virtual subsystems
- virtual void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const;
+ void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const override;
// Actual value access
- virtual bool doSetValue(const std::string &strValue, size_t offset,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual void doGetValue(std::string &strValue, size_t offset,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool doSetValue(const std::string &strValue, size_t offset,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ void doGetValue(std::string &strValue, size_t offset,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Value space handling for configuration import
void handleValueSpaceAttribute(CXmlElement &xmlConfigurableElementSettingsElement,
diff --git a/upstream/parameter/ParameterAdaptation.h b/upstream/parameter/ParameterAdaptation.h
index d9cbe4b..d600161 100644
--- a/upstream/parameter/ParameterAdaptation.h
+++ b/upstream/parameter/ParameterAdaptation.h
@@ -39,17 +39,18 @@
CParameterAdaptation(const std::string &strType);
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// Conversions
virtual int64_t fromUserValue(double dValue) const;
virtual double toUserValue(int64_t iValue) const;
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
protected:
// Attributes
diff --git a/upstream/parameter/ParameterBlock.h b/upstream/parameter/ParameterBlock.h
index 0ebfdbe..a1d037c 100644
--- a/upstream/parameter/ParameterBlock.h
+++ b/upstream/parameter/ParameterBlock.h
@@ -42,5 +42,5 @@
}
// Type
- virtual Type getType() const { return EParameterBlock; }
+ Type getType() const override { return EParameterBlock; }
};
diff --git a/upstream/parameter/ParameterBlockType.h b/upstream/parameter/ParameterBlockType.h
index 6d81ee8..3662a0f 100644
--- a/upstream/parameter/ParameterBlockType.h
+++ b/upstream/parameter/ParameterBlockType.h
@@ -39,12 +39,12 @@
CParameterBlockType(const std::string &strName);
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
- virtual bool childrenAreDynamic() const;
+ bool childrenAreDynamic() const override;
// Instantiation
- virtual CInstanceConfigurableElement *doInstantiate() const;
+ CInstanceConfigurableElement *doInstantiate() const override;
// Population
- virtual void populate(CElement *pElement) const;
+ void populate(CElement *pElement) const override;
};
diff --git a/upstream/parameter/ParameterFrameworkConfiguration.cpp b/upstream/parameter/ParameterFrameworkConfiguration.cpp
index bf735fd..1f18f45 100644
--- a/upstream/parameter/ParameterFrameworkConfiguration.cpp
+++ b/upstream/parameter/ParameterFrameworkConfiguration.cpp
@@ -53,10 +53,10 @@
return _bTuningAllowed;
}
-// Server port
-uint16_t CParameterFrameworkConfiguration::getServerPort() const
+// Server bind address
+const std::string &CParameterFrameworkConfiguration::getServerBindAddress() const
{
- return _uiServerPort;
+ return _bindAddress;
}
// From IXmlSink
@@ -70,7 +70,7 @@
xmlElement.getAttribute("TuningAllowed", _bTuningAllowed);
// Server port
- xmlElement.getAttribute("ServerPort", _uiServerPort);
+ xmlElement.getAttribute("ServerPort", _bindAddress);
// Base
return base::fromXml(xmlElement, serializingContext);
diff --git a/upstream/parameter/ParameterFrameworkConfiguration.h b/upstream/parameter/ParameterFrameworkConfiguration.h
index a94f7ef..83bb49f 100644
--- a/upstream/parameter/ParameterFrameworkConfiguration.h
+++ b/upstream/parameter/ParameterFrameworkConfiguration.h
@@ -43,19 +43,20 @@
bool isTuningAllowed() const;
// Server port
- uint16_t getServerPort() const;
+ const std::string &getServerBindAddress() const;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
private:
- virtual std::string getKind() const;
- virtual bool childrenAreDynamic() const;
+ std::string getKind() const override;
+ bool childrenAreDynamic() const override;
// System class name
std::string _strSystemClassName;
// Tuning allowed
bool _bTuningAllowed{false};
// Server port
- uint16_t _uiServerPort{0};
+ std::string _bindAddress;
};
diff --git a/upstream/parameter/ParameterMgr.cpp b/upstream/parameter/ParameterMgr.cpp
index f450563..d515af0 100644
--- a/upstream/parameter/ParameterMgr.cpp
+++ b/upstream/parameter/ParameterMgr.cpp
@@ -46,7 +46,7 @@
#include "ComponentInstance.h"
#include "ParameterBlockType.h"
#include "BooleanParameterType.h"
-#include "IntegerParameterType.h"
+#include "IntegerParameterBuilder.h"
#include "FixedPointParameterType.h"
#include "FloatingPointParameterType.h"
#include "ParameterBlackboard.h"
@@ -129,7 +129,7 @@
// Used for remote processor server creation
typedef IRemoteProcessorServerInterface *(*CreateRemoteProcessorServer)(
- uint16_t uiPort, IRemoteCommandHandler *pCommandHandler);
+ std::string bindAddress, IRemoteCommandHandler *pCommandHandler);
// Config File System looks normally like this:
// ---------------------------------------------
@@ -433,7 +433,7 @@
_xmlDoc *doc =
CXmlDocSource::mkXmlDoc(_xmlConfigurationUri, true, true, elementSerializingContext);
- if (doc == NULL) {
+ if (doc == nullptr) {
return false;
}
@@ -517,7 +517,7 @@
LOG_CONTEXT("Importing system structure from file " + structureUri);
_xmlDoc *doc = CXmlDocSource::mkXmlDoc(structureUri, true, true, parameterBuildContext);
- if (doc == NULL) {
+ if (doc == nullptr) {
return false;
}
@@ -608,7 +608,7 @@
_xmlDoc *doc =
CXmlDocSource::mkXmlDoc(configurationDomainsUri, true, true, xmlDomainImportContext);
- if (doc == NULL) {
+ if (doc == nullptr) {
return false;
}
@@ -702,7 +702,7 @@
// Nagivate through system class
if (!pathNavigator.navigateThrough(getConstSystemClass()->getName(), strError)) {
- return NULL;
+ return nullptr;
}
// Find element
@@ -712,7 +712,7 @@
strError = "Path not found: " + strPath;
- return NULL;
+ return nullptr;
}
// Check found element is a parameter
@@ -739,7 +739,7 @@
// Element not found
strError = "Element not found: " + strPath;
- return NULL;
+ return nullptr;
}
if (!pConfigurableElement->isParameter()) {
@@ -747,7 +747,7 @@
// Element is not parameter
strError = "Not a parameter: " + strPath;
- return NULL;
+ return nullptr;
}
// Convert as parameter and return new handle
@@ -1355,7 +1355,7 @@
{
CElementLocator elementLocator(getSystemClass(), false);
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
@@ -1382,7 +1382,7 @@
{
CElementLocator elementLocator(getSystemClass(), false);
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
@@ -1408,7 +1408,7 @@
{
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
@@ -1432,7 +1432,7 @@
{
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
@@ -1479,7 +1479,7 @@
// Retrieve configurable element
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
@@ -1622,7 +1622,7 @@
{
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
@@ -1645,7 +1645,7 @@
{
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
@@ -1667,7 +1667,7 @@
{
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
@@ -1715,7 +1715,7 @@
{
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
@@ -1737,7 +1737,7 @@
{
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
@@ -2012,7 +2012,7 @@
{
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(strPath, &pLocatedElement, strError)) {
@@ -2028,7 +2028,7 @@
size_t baseOffset;
bool bIsLastApplied;
- CParameterBlackboard *pConfigurationBlackboard = NULL;
+ CParameterBlackboard *pConfigurationBlackboard = nullptr;
{
pConfigurationBlackboard = getConstConfigurableDomains()->findConfigurationBlackboard(
@@ -2400,7 +2400,7 @@
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) {
@@ -2443,7 +2443,7 @@
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) {
@@ -2475,7 +2475,7 @@
CElementLocator elementLocator(getSystemClass());
- CElement *pLocatedElement = NULL;
+ CElement *pLocatedElement = nullptr;
if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) {
@@ -2603,7 +2603,7 @@
// It doesn't make sense to resolve XIncludes on an imported file because
// we can't reliably decide of a "base url"
_xmlDoc *doc = CXmlDocSource::mkXmlDoc(xmlSource, fromFile, false, xmlDomainImportContext);
- if (doc == NULL) {
+ if (doc == nullptr) {
return false;
}
@@ -2654,7 +2654,7 @@
const CConfigurableDomain *requestedDomain =
getConstConfigurableDomains()->findConfigurableDomain(domainName, errorMsg);
- if (requestedDomain == NULL) {
+ if (requestedDomain == nullptr) {
return false;
}
@@ -2738,7 +2738,7 @@
void CParameterMgr::feedElementLibraries()
{
// Global Configuration handling
- CElementLibrary *pFrameworkConfigurationLibrary = new CElementLibrary;
+ auto pFrameworkConfigurationLibrary = new CElementLibrary;
pFrameworkConfigurationLibrary->addElementBuilder(
"ParameterFrameworkConfiguration",
@@ -2759,7 +2759,7 @@
_pElementLibrarySet->addElementLibrary(pFrameworkConfigurationLibrary);
// Parameter creation
- CElementLibrary *pParameterCreationLibrary = new CElementLibrary;
+ auto pParameterCreationLibrary = new CElementLibrary;
pParameterCreationLibrary->addElementBuilder(
"Subsystem", new CSubsystemElementBuilder(getSystemClass()->getSubsystemLibrary()));
@@ -2777,8 +2777,7 @@
"ParameterBlock", new TNamedElementBuilderTemplate<CParameterBlockType>());
pParameterCreationLibrary->addElementBuilder(
"BooleanParameter", new TNamedElementBuilderTemplate<CBooleanParameterType>());
- pParameterCreationLibrary->addElementBuilder(
- "IntegerParameter", new TNamedElementBuilderTemplate<CIntegerParameterType>());
+ pParameterCreationLibrary->addElementBuilder("IntegerParameter", new IntegerParameterBuilder());
pParameterCreationLibrary->addElementBuilder(
"LinearAdaptation", new TElementBuilderTemplate<CLinearParameterAdaptation>());
pParameterCreationLibrary->addElementBuilder(
@@ -2798,7 +2797,7 @@
_pElementLibrarySet->addElementLibrary(pParameterCreationLibrary);
// Parameter Configuration Domains creation
- CElementLibrary *pParameterConfigurationLibrary = new CElementLibrary;
+ auto pParameterConfigurationLibrary = new CElementLibrary;
pParameterConfigurationLibrary->addElementBuilder(
"ConfigurableDomain", new TElementBuilderTemplate<CConfigurableDomain>());
@@ -2853,28 +2852,29 @@
return true;
}
- auto port = getConstFrameworkConfiguration()->getServerPort();
+ auto bindAddress = getConstFrameworkConfiguration()->getServerBindAddress();
try {
// The ownership of remoteComandHandler is given to Bg remote processor server.
- _pRemoteProcessorServer = new BackgroundRemoteProcessorServer(port, createCommandHandler());
+ _pRemoteProcessorServer =
+ new BackgroundRemoteProcessorServer(bindAddress, createCommandHandler());
} catch (std::runtime_error &e) {
strError = string("ParameterMgr: Unable to create Remote Processor Server: ") + e.what();
return false;
}
- if (_pRemoteProcessorServer == NULL) {
+ if (_pRemoteProcessorServer == nullptr) {
strError = "ParameterMgr: Unable to create Remote Processor Server";
return false;
}
if (!_pRemoteProcessorServer->start(strError)) {
ostringstream oss;
- oss << "ParameterMgr: Unable to start remote processor server on port " << port;
+ oss << "ParameterMgr: Unable to start remote processor server on " << bindAddress;
strError = oss.str() + ": " + strError;
return false;
}
- info() << "Remote Processor Server started on port " << port;
+ info() << "Remote Processor Server started on " << bindAddress;
return true;
}
diff --git a/upstream/parameter/ParameterMgr.h b/upstream/parameter/ParameterMgr.h
index 784f55f..bc0726d 100644
--- a/upstream/parameter/ParameterMgr.h
+++ b/upstream/parameter/ParameterMgr.h
@@ -85,7 +85,7 @@
public:
// Construction
CParameterMgr(const std::string &strConfigurationFilePath, core::log::ILogger &logger);
- virtual ~CParameterMgr();
+ ~CParameterMgr() override;
/** Load plugins, structures and settings from the config file given.
*
@@ -388,14 +388,14 @@
std::string &strResult) const;
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
CParameterMgr(const CParameterMgr &);
CParameterMgr &operator=(const CParameterMgr &);
// Init
- virtual bool init(std::string &strError);
+ bool init(std::string &strError) override;
// Version
std::string getVersion() const;
diff --git a/upstream/parameter/ParameterMgrLogger.h b/upstream/parameter/ParameterMgrLogger.h
index aafb76a..778a203 100644
--- a/upstream/parameter/ParameterMgrLogger.h
+++ b/upstream/parameter/ParameterMgrLogger.h
@@ -43,9 +43,9 @@
public:
CParameterMgrLogger(T ¶meterMgrConnector) : _parameterMgrConnector(parameterMgrConnector) {}
- virtual void info(const std::string &log) { _parameterMgrConnector.info(log); }
+ void info(const std::string &log) override { _parameterMgrConnector.info(log); }
- virtual void warning(const std::string &log) { _parameterMgrConnector.warning(log); }
+ void warning(const std::string &log) override { _parameterMgrConnector.warning(log); }
private:
// Log destination
diff --git a/upstream/parameter/ParameterMgrPlatformConnector.cpp b/upstream/parameter/ParameterMgrPlatformConnector.cpp
index 8eff7c9..c69d76e 100644
--- a/upstream/parameter/ParameterMgrPlatformConnector.cpp
+++ b/upstream/parameter/ParameterMgrPlatformConnector.cpp
@@ -39,7 +39,7 @@
const string &strConfigurationFilePath)
: _pParameterMgrLogger(new CParameterMgrLogger<CParameterMgrPlatformConnector>(*this)),
_pParameterMgr(new CParameterMgr(strConfigurationFilePath, *_pParameterMgrLogger)),
- _bStarted(false), _pLogger(NULL)
+ _bStarted(false), _pLogger(nullptr)
{
}
diff --git a/upstream/parameter/ParameterType.h b/upstream/parameter/ParameterType.h
index 5cb32d9..b3a5685 100644
--- a/upstream/parameter/ParameterType.h
+++ b/upstream/parameter/ParameterType.h
@@ -45,7 +45,7 @@
{
public:
CParameterType(const std::string &strName);
- virtual ~CParameterType() = default;
+ ~CParameterType() override = default;
// Size
size_t getSize() const;
@@ -55,10 +55,11 @@
void setUnit(const std::string &strUnit);
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
/// Conversions
// String
@@ -104,7 +105,7 @@
CConfigurationAccessContext &configurationAccessContext) const;
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
// Default value handling (simulation only)
virtual uint32_t getDefaultValue() const;
@@ -125,7 +126,7 @@
protected:
// Object creation
- virtual void populate(CElement *pElement) const;
+ void populate(CElement *pElement) const override;
// Size
void setSize(size_t size);
@@ -151,7 +152,7 @@
void setXmlUnitAttribute(CXmlElement &xmlElement) const;
// Instantiation
- virtual CInstanceConfigurableElement *doInstantiate() const;
+ CInstanceConfigurableElement *doInstantiate() const override;
// Generic Access
template <typename type>
void doSignExtend(type &data) const;
diff --git a/upstream/parameter/PathNavigator.cpp b/upstream/parameter/PathNavigator.cpp
index 36deaea..22cf19a 100644
--- a/upstream/parameter/PathNavigator.cpp
+++ b/upstream/parameter/PathNavigator.cpp
@@ -87,7 +87,7 @@
return &_astrItems[_currentIndex++];
}
- return NULL;
+ return nullptr;
}
std::string CPathNavigator::getCurrentPath() const
diff --git a/upstream/parameter/PluginLocation.h b/upstream/parameter/PluginLocation.h
index 2a663d2..cf7d4db 100644
--- a/upstream/parameter/PluginLocation.h
+++ b/upstream/parameter/PluginLocation.h
@@ -39,7 +39,8 @@
CPluginLocation(const std::string &strName, const std::string &strKind);
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// Folder
const std::string &getFolder() const;
diff --git a/upstream/parameter/Results.h b/upstream/parameter/Results.h
index 3f7a13c..d0dbaae 100644
--- a/upstream/parameter/Results.h
+++ b/upstream/parameter/Results.h
@@ -38,4 +38,4 @@
/** String list type which can hold list of error/info */
typedef std::list<std::string> Results;
-} /** core namespace */
+} // namespace core
diff --git a/upstream/parameter/RuleParser.cpp b/upstream/parameter/RuleParser.cpp
index 72424d2..e069cd1 100644
--- a/upstream/parameter/RuleParser.cpp
+++ b/upstream/parameter/RuleParser.cpp
@@ -70,7 +70,7 @@
case EBeginCompoundRule: {
// Create new compound rule
- CCompoundRule *pCompoundRule = new CCompoundRule;
+ auto pCompoundRule = new CCompoundRule;
// Parse
if (!pCompoundRule->parse(*this, strError)) {
@@ -104,7 +104,7 @@
break;
case ECriterionRule: {
// Create new criterion rule
- CSelectionCriterionRule *pCriterionRule = new CSelectionCriterionRule;
+ auto pCriterionRule = new CSelectionCriterionRule;
// Parse
if (!pCriterionRule->parse(*this, strError)) {
@@ -114,7 +114,7 @@
return false;
}
- ALWAYS_ASSERT(pParentRule != NULL, "Invalid parent rule given to rule parser");
+ ALWAYS_ASSERT(pParentRule != nullptr, "Invalid parent rule given to rule parser");
// Chain
pParentRule->addChild(pCriterionRule);
@@ -232,7 +232,7 @@
assert(pRootRule);
- _pRootRule = NULL;
+ _pRootRule = nullptr;
return pRootRule;
}
diff --git a/upstream/parameter/SelectionCriteria.h b/upstream/parameter/SelectionCriteria.h
index 22f4de1..daa1b95 100644
--- a/upstream/parameter/SelectionCriteria.h
+++ b/upstream/parameter/SelectionCriteria.h
@@ -68,7 +68,7 @@
bool bHumanReadable) const;
// Base
- virtual std::string getKind() const;
+ std::string getKind() const override;
// Reset the modified status of the children
void resetModifiedStatus();
diff --git a/upstream/parameter/SelectionCriteriaDefinition.cpp b/upstream/parameter/SelectionCriteriaDefinition.cpp
index 12f1aa2..dc8259c 100644
--- a/upstream/parameter/SelectionCriteriaDefinition.cpp
+++ b/upstream/parameter/SelectionCriteriaDefinition.cpp
@@ -39,7 +39,7 @@
CSelectionCriterion *CSelectionCriteriaDefinition::createSelectionCriterion(
const std::string &strName, const CSelectionCriterionType *pType, core::log::Logger &logger)
{
- CSelectionCriterion *pSelectionCriterion = new CSelectionCriterion(strName, pType, logger);
+ auto pSelectionCriterion = new CSelectionCriterion(strName, pType, logger);
addChild(pSelectionCriterion);
diff --git a/upstream/parameter/SelectionCriteriaDefinition.h b/upstream/parameter/SelectionCriteriaDefinition.h
index a8fa75a..1d9a648 100644
--- a/upstream/parameter/SelectionCriteriaDefinition.h
+++ b/upstream/parameter/SelectionCriteriaDefinition.h
@@ -52,7 +52,7 @@
bool bHumanReadable) const;
// Base
- virtual std::string getKind() const;
+ std::string getKind() const override;
// Reset the modified status of the children
void resetModifiedStatus();
diff --git a/upstream/parameter/SelectionCriterion.h b/upstream/parameter/SelectionCriterion.h
index 76ec0ff..9c2dfe2 100644
--- a/upstream/parameter/SelectionCriterion.h
+++ b/upstream/parameter/SelectionCriterion.h
@@ -47,12 +47,12 @@
/// From ISelectionCriterionInterface
// State
- virtual void setCriterionState(int iState);
- virtual int getCriterionState() const;
+ void setCriterionState(int iState) override;
+ int getCriterionState() const override;
// Name
- virtual std::string getCriterionName() const;
+ std::string getCriterionName() const override;
// Type
- virtual const ISelectionCriterionTypeInterface *getCriterionType() const;
+ const ISelectionCriterionTypeInterface *getCriterionType() const override;
// Modified status
bool hasBeenModified() const;
void resetModifiedStatus();
@@ -67,7 +67,7 @@
std::string getFormattedDescription(bool bWithTypeInfo, bool bHumanReadable) const;
/// From CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
/**
* Export to XML
@@ -76,7 +76,7 @@
* @param[in] serializingContext The serializing context
*
*/
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
private:
// Current state
diff --git a/upstream/parameter/SelectionCriterionLibrary.cpp b/upstream/parameter/SelectionCriterionLibrary.cpp
index fc9e943..09fda7c 100644
--- a/upstream/parameter/SelectionCriterionLibrary.cpp
+++ b/upstream/parameter/SelectionCriterionLibrary.cpp
@@ -39,7 +39,7 @@
// Type creation
CSelectionCriterionType *CSelectionCriterionLibrary::createSelectionCriterionType(bool bIsInclusive)
{
- CSelectionCriterionType *pSelectionCriterionType = new CSelectionCriterionType(bIsInclusive);
+ auto pSelectionCriterionType = new CSelectionCriterionType(bIsInclusive);
addChild(pSelectionCriterionType);
diff --git a/upstream/parameter/SelectionCriterionLibrary.h b/upstream/parameter/SelectionCriterionLibrary.h
index a152258..0ff9ac9 100644
--- a/upstream/parameter/SelectionCriterionLibrary.h
+++ b/upstream/parameter/SelectionCriterionLibrary.h
@@ -39,5 +39,5 @@
CSelectionCriterionType *createSelectionCriterionType(bool bIsInclusive);
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
};
diff --git a/upstream/parameter/SelectionCriterionRule.h b/upstream/parameter/SelectionCriterionRule.h
index c51bfa2..7dac343 100644
--- a/upstream/parameter/SelectionCriterionRule.h
+++ b/upstream/parameter/SelectionCriterionRule.h
@@ -56,22 +56,23 @@
public:
// Parse
- virtual bool parse(CRuleParser &ruleParser, std::string &strError);
+ bool parse(CRuleParser &ruleParser, std::string &strError) override;
// Dump
std::string dump() const override;
// Rule check
- virtual bool matches() const;
+ bool matches() const override;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
// Class kind
- virtual std::string getKind() const;
+ std::string getKind() const override;
protected:
// Content dumping
diff --git a/upstream/parameter/SelectionCriterionType.cpp b/upstream/parameter/SelectionCriterionType.cpp
index 3354702..d97d18b 100644
--- a/upstream/parameter/SelectionCriterionType.cpp
+++ b/upstream/parameter/SelectionCriterionType.cpp
@@ -118,7 +118,7 @@
bool CSelectionCriterionType::getAtomicNumericalValue(const std::string &strValue,
int &iValue) const
{
- NumToLitMapConstIt it = _numToLitMap.find(strValue);
+ auto it = _numToLitMap.find(strValue);
if (it != _numToLitMap.end()) {
diff --git a/upstream/parameter/SelectionCriterionType.h b/upstream/parameter/SelectionCriterionType.h
index 5c13c8f..4b2f767 100644
--- a/upstream/parameter/SelectionCriterionType.h
+++ b/upstream/parameter/SelectionCriterionType.h
@@ -42,7 +42,7 @@
CSelectionCriterionType(bool bIsInclusive);
// From ISelectionCriterionTypeInterface
- virtual bool addValuePair(int iValue, const std::string &strValue, std::string &strError);
+ bool addValuePair(int iValue, const std::string &strValue, std::string &strError) override;
/**
* Retrieve the numerical value from the std::string representation of the criterion type.
*
@@ -53,15 +53,15 @@
*
* @return true if integer value retrieved from the std::string one, false otherwise.
*/
- virtual bool getNumericalValue(const std::string &strValue, int &iValue) const;
- virtual bool getLiteralValue(int iValue, std::string &strValue) const;
- virtual bool isTypeInclusive() const;
+ bool getNumericalValue(const std::string &strValue, int &iValue) const override;
+ bool getLiteralValue(int iValue, std::string &strValue) const override;
+ bool isTypeInclusive() const override;
// Value list
std::string listPossibleValues() const;
// Formatted state
- virtual std::string getFormattedState(int iValue) const;
+ std::string getFormattedState(int iValue) const override;
/**
* Export to XML
@@ -70,10 +70,10 @@
* @param[in] serializingContext The serializing context
*
*/
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
// From CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
/**
diff --git a/upstream/parameter/SimulatedBackSynchronizer.h b/upstream/parameter/SimulatedBackSynchronizer.h
index f561b89..e8e15f5 100644
--- a/upstream/parameter/SimulatedBackSynchronizer.h
+++ b/upstream/parameter/SimulatedBackSynchronizer.h
@@ -43,7 +43,7 @@
CParameterBlackboard *pParameterBlackboard);
// Back synchronization
- virtual void sync();
+ void sync() override;
private:
// Fake error for parameter context creation
diff --git a/upstream/parameter/StringParameter.h b/upstream/parameter/StringParameter.h
index 6adede9..a7bba8e 100644
--- a/upstream/parameter/StringParameter.h
+++ b/upstream/parameter/StringParameter.h
@@ -39,20 +39,20 @@
CStringParameter(const std::string &strName, const CTypeElement *pTypeElement);
// Instantiation, allocation
- virtual size_t getFootPrint() const;
+ size_t getFootPrint() const override;
// Type
- virtual Type getType() const;
+ Type getType() const override;
protected:
// Used for simulation and virtual subsystems
- virtual void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const;
+ void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const override;
// Actual value access (tuning)
- virtual bool doSetValue(const std::string &strValue, size_t offset,
- CParameterAccessContext ¶meterAccessContext) const;
- virtual void doGetValue(std::string &strValue, size_t offset,
- CParameterAccessContext ¶meterAccessContext) const;
+ bool doSetValue(const std::string &strValue, size_t offset,
+ CParameterAccessContext ¶meterAccessContext) const override;
+ void doGetValue(std::string &strValue, size_t offset,
+ CParameterAccessContext ¶meterAccessContext) const override;
// Size
size_t getSize() const;
diff --git a/upstream/parameter/StringParameterType.h b/upstream/parameter/StringParameterType.h
index 9d8786f..9e00ec5 100644
--- a/upstream/parameter/StringParameterType.h
+++ b/upstream/parameter/StringParameterType.h
@@ -44,20 +44,21 @@
size_t getMaxLength() const;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
// CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
private:
// Instantiation
- virtual CInstanceConfigurableElement *doInstantiate() const;
+ CInstanceConfigurableElement *doInstantiate() const override;
// Max length in bytes
size_t _maxLength{0};
diff --git a/upstream/parameter/Subsystem.cpp b/upstream/parameter/Subsystem.cpp
index 43e633d..c422a88 100644
--- a/upstream/parameter/Subsystem.cpp
+++ b/upstream/parameter/Subsystem.cpp
@@ -252,7 +252,7 @@
findSubsystemObjectFromConfigurableElement(pInstanceConfigurableElement);
// Exit if node does not correspond to a SubsystemObject
- if (pSubsystemObject == NULL) {
+ if (pSubsystemObject == nullptr) {
return "";
}
diff --git a/upstream/parameter/Subsystem.h b/upstream/parameter/Subsystem.h
index af7e1fb..fa18ce7 100644
--- a/upstream/parameter/Subsystem.h
+++ b/upstream/parameter/Subsystem.h
@@ -61,10 +61,10 @@
* @param[in] logger the main logger of the application
*/
CSubsystem(const std::string &strName, core::log::Logger &logger);
- virtual ~CSubsystem();
+ ~CSubsystem() override;
- virtual bool structureFromXml(const CXmlElement &xmlElement,
- CXmlSerializingContext &serializingContext);
+ bool structureFromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// Susbsystem sanity
virtual bool isAlive() const;
@@ -73,9 +73,9 @@
virtual bool needResync(bool bClear);
// from CElement
- virtual std::string getKind() const;
+ std::string getKind() const override;
- virtual bool getMappingData(const std::string &strKey, const std::string *&pStrValue) const;
+ bool getMappingData(const std::string &strKey, const std::string *&pStrValue) const override;
std::string getFormattedMapping() const override;
/**
@@ -98,7 +98,7 @@
protected:
// Used for simulation and virtual subsystems
- virtual void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const;
+ void setDefaultValues(CParameterAccessContext ¶meterAccessContext) const override;
/// Functionality intendedn for derived Subsystems
// Subsystem context mapping keys publication
@@ -111,7 +111,7 @@
CSubsystem &operator=(const CSubsystem &);
// Belonging subsystem
- virtual const CSubsystem *getBelongingSubsystem() const;
+ const CSubsystem *getBelongingSubsystem() const override;
// Mapping execution
bool mapSubsystemElements(std::string &strError);
@@ -130,9 +130,9 @@
*
* @return true on success, false on failure
*/
- virtual bool mapBegin(CInstanceConfigurableElement *pInstanceConfigurableElement,
- bool &bKeepDiving, std::string &strError);
- virtual void mapEnd();
+ bool mapBegin(CInstanceConfigurableElement *pInstanceConfigurableElement, bool &bKeepDiving,
+ std::string &strError) override;
+ void mapEnd() override;
// Mapping access
/**
diff --git a/upstream/parameter/SubsystemElementBuilder.h b/upstream/parameter/SubsystemElementBuilder.h
index 4dfe78f..2a6e0a6 100644
--- a/upstream/parameter/SubsystemElementBuilder.h
+++ b/upstream/parameter/SubsystemElementBuilder.h
@@ -38,7 +38,7 @@
public:
CSubsystemElementBuilder(const CSubsystemLibrary *pSubsystemLibrary);
- virtual CElement *createElement(const CXmlElement &xmlElement) const;
+ CElement *createElement(const CXmlElement &xmlElement) const override;
private:
const CSubsystemLibrary *_pSubsystemLibrary;
diff --git a/upstream/parameter/SubsystemLibrary.h b/upstream/parameter/SubsystemLibrary.h
index f3082e2..fa73da8 100644
--- a/upstream/parameter/SubsystemLibrary.h
+++ b/upstream/parameter/SubsystemLibrary.h
@@ -48,7 +48,7 @@
{
private:
// Builder type (based on element's name attribute)
- virtual std::string getBuilderType(const CXmlElement &xmlElement) const
+ std::string getBuilderType(const CXmlElement &xmlElement) const override
{
// Xml element's name attribute
std::string type;
diff --git a/upstream/parameter/SubsystemObject.h b/upstream/parameter/SubsystemObject.h
index 2400573..11d8299 100644
--- a/upstream/parameter/SubsystemObject.h
+++ b/upstream/parameter/SubsystemObject.h
@@ -46,7 +46,7 @@
public:
CSubsystemObject(CInstanceConfigurableElement *pInstanceConfigurableElement,
core::log::Logger &logger);
- virtual ~CSubsystemObject();
+ ~CSubsystemObject() override;
/**
* Return the mapping value of the SubystemObject.
@@ -100,8 +100,7 @@
/** This method is not supposed to be overridden by plugins
* as if not called, plugins will not work (sets _blackboard).
*/
- bool sync(CParameterBlackboard ¶meterBlackboard, bool bBack,
- std::string &strError) override final;
+ bool sync(CParameterBlackboard ¶meterBlackboard, bool bBack, std::string &strError) final;
// Default back synchronization
void setDefaultValues(CParameterBlackboard ¶meterBlackboard) const;
diff --git a/upstream/parameter/SubsystemPlugins.h b/upstream/parameter/SubsystemPlugins.h
index c5eb1c6..5123c28 100644
--- a/upstream/parameter/SubsystemPlugins.h
+++ b/upstream/parameter/SubsystemPlugins.h
@@ -42,5 +42,5 @@
}
private:
- virtual bool childrenAreDynamic() const { return true; }
+ bool childrenAreDynamic() const override { return true; }
};
diff --git a/upstream/parameter/SyncerSet.cpp b/upstream/parameter/SyncerSet.cpp
index c27245c..b2c0913 100644
--- a/upstream/parameter/SyncerSet.cpp
+++ b/upstream/parameter/SyncerSet.cpp
@@ -68,7 +68,7 @@
if (!pSyncer->sync(parameterBlackboard, bBack, strError)) {
- if (errors != NULL) {
+ if (errors != nullptr) {
errors->push_back(strError);
}
diff --git a/upstream/parameter/SystemClass.cpp b/upstream/parameter/SystemClass.cpp
index 21c7a86..ef2383b 100644
--- a/upstream/parameter/SystemClass.cpp
+++ b/upstream/parameter/SystemClass.cpp
@@ -182,7 +182,7 @@
bool bAtLeastOneSubsystemPluginSuccessfullyLoaded = false;
- list<string>::iterator it = lstrPluginFiles.begin();
+ auto it = lstrPluginFiles.begin();
while (it != lstrPluginFiles.end()) {
diff --git a/upstream/parameter/SystemClass.h b/upstream/parameter/SystemClass.h
index 43a581b..bb9a8aa 100644
--- a/upstream/parameter/SystemClass.h
+++ b/upstream/parameter/SystemClass.h
@@ -48,7 +48,7 @@
* it need to be given to the subsystem library
*/
CSystemClass(core::log::Logger &logger);
- virtual ~CSystemClass();
+ ~CSystemClass() override;
/** Load subsystem plugin and fill the corresponding libraries.
*
@@ -81,7 +81,7 @@
void cleanSubsystemsNeedToResync();
// base
- virtual std::string getKind() const;
+ std::string getKind() const override;
bool getMappingData(const std::string &strKey, const std::string *&pStrValue) const override;
std::string getFormattedMapping() const override;
@@ -90,7 +90,7 @@
CSystemClass(const CSystemClass &);
CSystemClass &operator=(const CSystemClass &);
// base
- virtual bool childrenAreDynamic() const;
+ bool childrenAreDynamic() const override;
/** Load shared libraries subsystem plugins.
*
diff --git a/upstream/parameter/TypeElement.h b/upstream/parameter/TypeElement.h
index 9d8f46f..e73987c 100644
--- a/upstream/parameter/TypeElement.h
+++ b/upstream/parameter/TypeElement.h
@@ -41,7 +41,7 @@
{
public:
CTypeElement(const std::string &strName = "");
- virtual ~CTypeElement();
+ ~CTypeElement() override;
// Instantiation
CInstanceConfigurableElement *instantiate() const;
@@ -58,13 +58,14 @@
virtual std::string getFormattedMapping() const;
// Element properties
- virtual void showProperties(std::string &strResult) const;
+ void showProperties(std::string &strResult) const override;
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
// From IXmlSource
- virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+ void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const override;
// Scalar or Array?
bool isScalar() const;
diff --git a/upstream/parameter/VirtualSubsystem.h b/upstream/parameter/VirtualSubsystem.h
index 8590361..1b3f63f 100644
--- a/upstream/parameter/VirtualSubsystem.h
+++ b/upstream/parameter/VirtualSubsystem.h
@@ -43,11 +43,11 @@
* @param[in] logger the main logger of the application
*/
CVirtualSubsystem(const std::string &strName, core::log::Logger &logger);
- virtual ~CVirtualSubsystem();
+ ~CVirtualSubsystem() override;
protected:
// Syncer
- virtual ISyncer *getSyncer() const;
+ ISyncer *getSyncer() const override;
/**
* Fill Syncer Set From descendant nodes
@@ -59,9 +59,9 @@
private:
// From IMapper
- virtual bool mapBegin(CInstanceConfigurableElement *pInstanceConfigurableElement,
- bool &bKeepDiving, std::string &strError);
- virtual void mapEnd();
+ bool mapBegin(CInstanceConfigurableElement *pInstanceConfigurableElement, bool &bKeepDiving,
+ std::string &strError) override;
+ void mapEnd() override;
// Subsystem level dummy syncer
CVirtualSyncer *_pVirtualSyncer;
diff --git a/upstream/parameter/VirtualSyncer.h b/upstream/parameter/VirtualSyncer.h
index 3942678..1139f0c 100644
--- a/upstream/parameter/VirtualSyncer.h
+++ b/upstream/parameter/VirtualSyncer.h
@@ -39,7 +39,8 @@
CVirtualSyncer(const CConfigurableElement *pConfigurableElement);
// from ISyncer
- virtual bool sync(CParameterBlackboard ¶meterBlackboard, bool bBack, std::string &strError);
+ bool sync(CParameterBlackboard ¶meterBlackboard, bool bBack,
+ std::string &strError) override;
private:
const CConfigurableElement *_pConfigurableElement;
diff --git a/upstream/parameter/XmlFileIncluderElement.h b/upstream/parameter/XmlFileIncluderElement.h
index 144e078..ab864e6 100644
--- a/upstream/parameter/XmlFileIncluderElement.h
+++ b/upstream/parameter/XmlFileIncluderElement.h
@@ -40,7 +40,8 @@
CXmlFileIncluderElement(const std::string &strName, const std::string &strKind,
bool bValidateWithSchemas, const std::string &schemaBaseUri);
// From IXmlSink
- virtual bool fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext);
+ bool fromXml(const CXmlElement &xmlElement,
+ CXmlSerializingContext &serializingContext) override;
private:
// Element type
diff --git a/upstream/parameter/log/include/log/Context.h b/upstream/parameter/log/include/log/Context.h
index a3d5fd4..b03f9ca 100644
--- a/upstream/parameter/log/include/log/Context.h
+++ b/upstream/parameter/log/include/log/Context.h
@@ -68,5 +68,5 @@
Logger &mLogger;
};
-} /** log namespace */
-} /** core namespace */
+} // namespace log
+} // namespace core
diff --git a/upstream/parameter/log/include/log/ILogger.h b/upstream/parameter/log/include/log/ILogger.h
index 9b72813..c405f5e 100644
--- a/upstream/parameter/log/include/log/ILogger.h
+++ b/upstream/parameter/log/include/log/ILogger.h
@@ -47,5 +47,5 @@
virtual ~ILogger() {}
};
-} /** log namespace */
-} /** core namespace */
+} // namespace log
+} // namespace core
diff --git a/upstream/parameter/log/include/log/LogWrapper.h b/upstream/parameter/log/include/log/LogWrapper.h
index 14624e4..8226876 100644
--- a/upstream/parameter/log/include/log/LogWrapper.h
+++ b/upstream/parameter/log/include/log/LogWrapper.h
@@ -131,6 +131,6 @@
/** Default warning logger type */
typedef details::LogWrapper<true> Warning;
-} /** details namespace */
-} /** log namespace */
-} /** core namespace */
+} // namespace details
+} // namespace log
+} // namespace core
diff --git a/upstream/parameter/log/include/log/Logger.h b/upstream/parameter/log/include/log/Logger.h
index b224d35..ea16f4e 100644
--- a/upstream/parameter/log/include/log/Logger.h
+++ b/upstream/parameter/log/include/log/Logger.h
@@ -76,5 +76,5 @@
std::string mProlog;
};
-} /** log namespace */
-} /** core namespace */
+} // namespace log
+} // namespace core
diff --git a/upstream/remote-process/CMakeLists.txt b/upstream/remote-process/CMakeLists.txt
index e27a101..f9c9bc3 100644
--- a/upstream/remote-process/CMakeLists.txt
+++ b/upstream/remote-process/CMakeLists.txt
@@ -33,7 +33,8 @@
find_package(Threads REQUIRED)
target_link_libraries(remote-process
- PRIVATE remote-processor pfw_utility asio ${CMAKE_THREAD_LIBS_INIT})
+ PRIVATE remote-processor pfw_utility asio Threads::Threads)
- install(TARGETS remote-process RUNTIME DESTINATION bin)
+ install(TARGETS remote-process RUNTIME DESTINATION bin
+ COMPONENT eng)
endif()
diff --git a/upstream/remote-process/README.md b/upstream/remote-process/README.md
index 128dc3f..7341552 100644
--- a/upstream/remote-process/README.md
+++ b/upstream/remote-process/README.md
@@ -20,12 +20,4 @@
remote-process <host> <port> <command>
-You can get all available commands with the `help` command.
-
-You may also run a batch of commands by passing them on remote-process'
-standard input:
-
- remote-process <host> <port> < file
-
-You should not use this feature in an interactive mode, because the
-communication may timeout if you're typing your commands too slowly.
+You can get all available commands with the `help` command.
\ No newline at end of file
diff --git a/upstream/remote-process/main.cpp b/upstream/remote-process/main.cpp
index 3ebaa86..ad94dc3 100644
--- a/upstream/remote-process/main.cpp
+++ b/upstream/remote-process/main.cpp
@@ -37,10 +37,12 @@
#include "RequestMessage.h"
#include "AnswerMessage.h"
#include "Socket.h"
+#include "convert.hpp"
using namespace std;
-bool sendAndDisplayCommand(asio::ip::tcp::socket &socket, CRequestMessage &requestMessage)
+bool sendAndDisplayCommand(asio::generic::stream_protocol::socket &socket,
+ CRequestMessage &requestMessage)
{
string strError;
@@ -72,41 +74,111 @@
return true;
}
-// hostname port command [argument[s]]
+int usage(const std::string &command, const std::string &error)
+{
+ if (not error.empty()) {
+ cerr << error << endl;
+ }
+ cerr << "Usage: " << endl;
+ cerr << "Send a single command:" << endl;
+ cerr << "\t" << command
+ << " <hostname port|<protocol>://<host:port|port_name>> <command> [argument[s]]" << endl;
+
+ return 1;
+}
+
+// <hostname port|path> command [argument[s]]
// or
-// hostname port < commands
+// <hostname port|path> < commands
int main(int argc, char *argv[])
{
+ int commandPos;
+
// Enough args?
- if (argc < 4) {
-
- cerr << "Missing arguments" << endl;
- cerr << "Usage: " << endl;
- cerr << "Send a single command:" << endl;
- cerr << "\t" << argv[0] << " hostname port command [argument[s]]" << endl;
-
- return 1;
+ if (argc < 3) {
+ return usage(argv[0], "Missing arguments");
}
- using asio::ip::tcp;
asio::io_service io_service;
- tcp::resolver resolver(io_service);
+ asio::generic::stream_protocol::socket connectionSocket(io_service);
- tcp::socket connectionSocket(io_service);
-
- string host{argv[1]};
- string port{argv[2]};
+ bool isInet = false;
+ string port;
+ string host;
try {
- asio::connect(connectionSocket, resolver.resolve(tcp::resolver::query(host, port)));
+ // backward compatibility: tcp port only refered by its value
+ uint16_t testConverter;
+ if (convertTo({argv[2]}, testConverter)) {
+ isInet = true;
+ port = argv[2];
+ host = argv[1];
+ if (argc <= 3) {
+ return usage(argv[0], "Missing arguments");
+ }
+ commandPos = 3;
+ } else {
+ commandPos = 2;
+ string endPortArg{argv[1]};
+ std::string protocol;
+
+ const std::string tcpProtocol{"tcp"};
+ const std::string unixProtocol{"unix"};
+ const std::vector<std::string> supportedProtocols{ tcpProtocol, unixProtocol };
+ const std::string protocolDelimiter{"://"};
+
+ size_t protocolDelPos = endPortArg.find(protocolDelimiter);
+ if (protocolDelPos == std::string::npos) {
+ return usage(argv[0], "Invalid socket endpoint, missing " + protocolDelimiter);
+ }
+ protocol = endPortArg.substr(0, protocolDelPos);
+
+ if (std::find(begin(supportedProtocols), end(supportedProtocols), protocol) ==
+ end(supportedProtocols)) {
+ return usage(argv[0], "Invalid socket protocol " + protocol);
+ }
+ isInet = (endPortArg.find(tcpProtocol) != std::string::npos);
+ if (isInet) {
+ size_t portDelPos = endPortArg.find(':', protocolDelPos + protocolDelimiter.size());
+ if (portDelPos == std::string::npos) {
+ return usage(argv[0], "Invalid tcp endpoint" + endPortArg);
+ }
+ host = endPortArg.substr(protocolDelPos + protocolDelimiter.size(),
+ portDelPos - (protocolDelPos + protocolDelimiter.size()));
+ port = endPortArg.substr(portDelPos + 1);
+ } else {
+ port = endPortArg.substr(protocolDelPos + protocolDelimiter.size());
+ }
+ }
+ if (isInet) {
+ asio::ip::tcp::resolver resolver(io_service);
+ asio::ip::tcp::socket tcpSocket(io_service);
+
+ asio::connect(tcpSocket, resolver.resolve(asio::ip::tcp::resolver::query(host, port)));
+ connectionSocket = std::move(tcpSocket);
+ } else {
+ asio::generic::stream_protocol::socket socket(io_service);
+ asio::generic::stream_protocol::endpoint endpoint =
+ asio::local::stream_protocol::endpoint(port);
+ socket.connect(endpoint);
+ connectionSocket = std::move(socket);
+ }
+
} catch (const asio::system_error &e) {
- cerr << "Connection to '" << host << ":" << port << "' failed: " << e.what() << endl;
+ string endpoint;
+
+ if (isInet) {
+ endpoint = string("tcp://") + host + ":" + port;
+ } else { /* other supported protocols */
+ endpoint = argv[1];
+ }
+ cerr << "Connection to '" << endpoint << "' failed: " << e.what() << endl;
return 1;
}
// Create command message
- CRequestMessage requestMessage(argv[3]);
+ CRequestMessage requestMessage(argv[commandPos]);
// Add arguments
- for (int arg = 4; arg < argc; arg++) {
+ for (int arg = commandPos + 1; arg < argc; arg++) {
requestMessage.addArgument(argv[arg]);
}
diff --git a/upstream/remote-processor/AnswerMessage.h b/upstream/remote-processor/AnswerMessage.h
index 8275d5d..2bc5147 100644
--- a/upstream/remote-processor/AnswerMessage.h
+++ b/upstream/remote-processor/AnswerMessage.h
@@ -47,13 +47,13 @@
private:
// Fill data to send
- virtual void fillDataToSend();
+ void fillDataToSend() override;
// Collect received data
- virtual void collectReceivedData();
+ void collectReceivedData() override;
/** @return size of the answer message in bytes
*/
- virtual size_t getDataSize() const;
+ size_t getDataSize() const override;
// Answer
void setAnswer(const std::string &strAnswer);
diff --git a/upstream/remote-processor/BackgroundRemoteProcessorServer.cpp b/upstream/remote-processor/BackgroundRemoteProcessorServer.cpp
index 0820786..b880107 100644
--- a/upstream/remote-processor/BackgroundRemoteProcessorServer.cpp
+++ b/upstream/remote-processor/BackgroundRemoteProcessorServer.cpp
@@ -31,8 +31,8 @@
#include "RemoteProcessorServer.h"
BackgroundRemoteProcessorServer::BackgroundRemoteProcessorServer(
- uint16_t uiPort, std::unique_ptr<IRemoteCommandHandler> &&commandHandler)
- : _server(new CRemoteProcessorServer(uiPort)), mCommandHandler(std::move(commandHandler))
+ std::string bindAddress, std::unique_ptr<IRemoteCommandHandler> &&commandHandler)
+ : _server(new CRemoteProcessorServer(bindAddress)), mCommandHandler(std::move(commandHandler))
{
}
diff --git a/upstream/remote-processor/BackgroundRemoteProcessorServer.h b/upstream/remote-processor/BackgroundRemoteProcessorServer.h
index 1c17fca..22c0242 100644
--- a/upstream/remote-processor/BackgroundRemoteProcessorServer.h
+++ b/upstream/remote-processor/BackgroundRemoteProcessorServer.h
@@ -40,10 +40,10 @@
: public IRemoteProcessorServerInterface
{
public:
- BackgroundRemoteProcessorServer(uint16_t uiPort,
+ BackgroundRemoteProcessorServer(std::string bindAddress,
std::unique_ptr<IRemoteCommandHandler> &&commandHandler);
- ~BackgroundRemoteProcessorServer();
+ ~BackgroundRemoteProcessorServer() override;
bool start(std::string &error) override;
diff --git a/upstream/remote-processor/CMakeLists.txt b/upstream/remote-processor/CMakeLists.txt
index ee21f55..80f272a 100644
--- a/upstream/remote-processor/CMakeLists.txt
+++ b/upstream/remote-processor/CMakeLists.txt
@@ -40,12 +40,9 @@
set(CMAKE_THREAD_PREFER_PTHREAD 1)
find_package(Threads REQUIRED)
-target_include_directories(remote-processor
- # Symbol export macro header
- PUBLIC "${CMAKE_CURRENT_BINARY_DIR}"
- # TODO: separate remote-processor's includes in half (public/private)
- PUBLIC .)
+target_link_libraries(remote-processor PRIVATE pfw_utility asio Threads::Threads)
-target_link_libraries(remote-processor PRIVATE pfw_utility asio ${CMAKE_THREAD_LIBS_INIT})
-
-install(TARGETS remote-processor LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
+install(TARGETS remote-processor EXPORT ParameterTargets
+ LIBRARY DESTINATION lib COMPONENT runtime
+ RUNTIME DESTINATION bin COMPONENT runtime
+ ARCHIVE DESTINATION lib COMPONENT dev)
diff --git a/upstream/remote-processor/Message.cpp b/upstream/remote-processor/Message.cpp
index 66154ec..5faecc0 100644
--- a/upstream/remote-processor/Message.cpp
+++ b/upstream/remote-processor/Message.cpp
@@ -129,7 +129,7 @@
// Send/Receive
CMessage::Result CMessage::serialize(Socket &&socket, bool bOut, string &strError)
{
- asio::ip::tcp::socket &asioSocket = socket.get();
+ auto &asioSocket = socket.get();
if (bOut) {
asio::error_code ec;
diff --git a/upstream/remote-processor/RemoteCommand.h b/upstream/remote-processor/RemoteCommand.h
index 025a133..7560206 100644
--- a/upstream/remote-processor/RemoteCommand.h
+++ b/upstream/remote-processor/RemoteCommand.h
@@ -48,7 +48,7 @@
* @returns a reference to a vector containing all the arguments.
*/
virtual const std::vector<std::string> &getArguments() const = 0;
- virtual const std::string packArguments(size_t startArgument, size_t nbArguments) const = 0;
+ virtual std::string packArguments(size_t startArgument, size_t nbArguments) const = 0;
protected:
virtual ~IRemoteCommand() {}
diff --git a/upstream/remote-processor/RemoteCommandHandlerTemplate.h b/upstream/remote-processor/RemoteCommandHandlerTemplate.h
index db59a5b..3d1ef55 100644
--- a/upstream/remote-processor/RemoteCommandHandlerTemplate.h
+++ b/upstream/remote-processor/RemoteCommandHandlerTemplate.h
@@ -116,9 +116,9 @@
: _pCommandParser(pCommandParser), _maxCommandUsageLength(0)
{
// Help Command
- addCommandParser("help", NULL, 0, "", "Show commands description and usage");
+ addCommandParser("help", nullptr, 0, "", "Show commands description and usage");
}
- ~TRemoteCommandHandlerTemplate()
+ ~TRemoteCommandHandlerTemplate() override
{
// FIXME use unique_ptr
for (auto *parser : _remoteCommandParserVector) {
@@ -147,7 +147,7 @@
private:
// Command processing
- bool remoteCommandProcess(const IRemoteCommand &remoteCommand, std::string &strResult)
+ bool remoteCommandProcess(const IRemoteCommand &remoteCommand, std::string &strResult) override
{
// Dispatch
const CRemoteCommandParserItem *pRemoteCommandParserItem =
@@ -216,7 +216,7 @@
return pRemoteCommandParserItem;
}
}
- return NULL;
+ return nullptr;
}
private:
diff --git a/upstream/remote-processor/RemoteProcessorServer.cpp b/upstream/remote-processor/RemoteProcessorServer.cpp
index d3fefdd..de7447e 100644
--- a/upstream/remote-processor/RemoteProcessorServer.cpp
+++ b/upstream/remote-processor/RemoteProcessorServer.cpp
@@ -32,15 +32,17 @@
#include <memory>
#include <assert.h>
#include <string.h>
+#include <unistd.h>
#include "RequestMessage.h"
#include "AnswerMessage.h"
#include "RemoteCommandHandler.h"
#include "Socket.h"
+#include "convert.hpp"
using std::string;
-CRemoteProcessorServer::CRemoteProcessorServer(uint16_t uiPort)
- : _uiPort(uiPort), _io_service(), _acceptor(_io_service), _socket(_io_service)
+CRemoteProcessorServer::CRemoteProcessorServer(std::string bindAddress)
+ : _bindAddress(bindAddress), _io_service(), _acceptor(_io_service), _socket(_io_service)
{
}
@@ -55,18 +57,71 @@
using namespace asio;
try {
- ip::tcp::endpoint endpoint(ip::tcp::v6(), _uiPort);
+ generic::stream_protocol::endpoint endpoint;
+ uint16_t port;
+ std::string endpointName;
+ bool isInet;
+
+ // For backward compatibility, tcp port referred by its value only
+ if (convertTo(_bindAddress, port)) {
+ isInet = true;
+ } else {
+ // required form is <protocol>://<host:port|port_name>
+ const std::string tcpProtocol{"tcp"};
+ const std::string unixProtocol{"unix"};
+ const std::vector<std::string> supportedProtocols{ tcpProtocol, unixProtocol };
+ const std::string protocolDel{"://"};
+
+ size_t protocolDelPos = _bindAddress.find(protocolDel);
+ if (protocolDelPos == std::string::npos) {
+ error = "bindaddress " + _bindAddress + " ill formed, missing " + protocolDel;
+ return false;
+ }
+ std::string protocol = _bindAddress.substr(0, protocolDelPos);
+
+ if (std::find(begin(supportedProtocols), end(supportedProtocols), protocol) ==
+ end(supportedProtocols)) {
+ error = "bindaddress " + _bindAddress + " has invalid protocol " + protocol;
+ return false;
+ }
+ isInet = (_bindAddress.find(tcpProtocol) != std::string::npos);
+ if (isInet) {
+ size_t portDelPos = _bindAddress.find(':', protocolDelPos + protocolDel.size());
+ if (portDelPos == std::string::npos) {
+ error = "bindaddress " + _bindAddress + " ill formed, missing " + ":";
+ return false;
+ }
+ std::string portLiteral{_bindAddress.substr(portDelPos + 1)};
+ if (!convertTo(portLiteral, port)) {
+ error = "bindaddress " + _bindAddress + " port " + portLiteral + " ill formed";
+ return false;
+ }
+ } else {
+ endpointName = _bindAddress.substr(protocolDelPos + protocolDel.size());
+ }
+ }
+
+ if (isInet) {
+ endpoint = ip::tcp::endpoint(ip::tcp::v6(), port);
+ } else {
+ endpoint = local::stream_protocol::endpoint(endpointName);
+ }
_acceptor.open(endpoint.protocol());
- _acceptor.set_option(ip::tcp::acceptor::reuse_address(true));
- _acceptor.set_option(asio::socket_base::linger(true, 0));
+ if (endpoint.protocol().protocol() == ASIO_OS_DEF(IPPROTO_TCP)) {
+ _acceptor.set_option(ip::tcp::acceptor::reuse_address(true));
+ } else if (endpoint.protocol().protocol() == AF_UNSPEC) {
+ // In case of reuse, remote it first
+ unlink(endpointName.c_str());
+ }
+ _acceptor.set_option(socket_base::linger(true, 0));
_acceptor.set_option(socket_base::enable_connection_aborted(true));
_acceptor.bind(endpoint);
_acceptor.listen();
} catch (std::exception &e) {
- error = "Unable to listen on port " + std::to_string(_uiPort) + ": " + e.what();
+ error = "Unable to listen on " + _bindAddress + ": " + e.what();
return false;
}
@@ -88,7 +143,10 @@
return;
}
- _socket.set_option(asio::ip::tcp::no_delay(true));
+ const auto &endpoint = _socket.local_endpoint();
+ if (endpoint.protocol().protocol() == ASIO_OS_DEF(IPPROTO_TCP)) {
+ _socket.set_option(asio::ip::tcp::no_delay(true));
+ }
handleNewConnection(commandHandler);
_socket.close();
diff --git a/upstream/remote-processor/RemoteProcessorServer.h b/upstream/remote-processor/RemoteProcessorServer.h
index 2da0113..7a2f739 100644
--- a/upstream/remote-processor/RemoteProcessorServer.h
+++ b/upstream/remote-processor/RemoteProcessorServer.h
@@ -31,7 +31,7 @@
#include "remote_processor_export.h"
-#include <stdint.h>
+#include <string>
#include "RemoteProcessorServerInterface.h"
#include <asio.hpp>
@@ -40,7 +40,7 @@
class REMOTE_PROCESSOR_EXPORT CRemoteProcessorServer : public IRemoteProcessorServerInterface
{
public:
- CRemoteProcessorServer(uint16_t uiPort);
+ CRemoteProcessorServer(std::string bindAddress);
virtual ~CRemoteProcessorServer();
// State
@@ -54,10 +54,10 @@
// New connection
void handleNewConnection(IRemoteCommandHandler &commandHandler);
- // Port number
- uint16_t _uiPort;
+ // Bind address
+ std::string _bindAddress;
asio::io_service _io_service;
- asio::ip::tcp::acceptor _acceptor;
- asio::ip::tcp::socket _socket;
+ asio::basic_socket_acceptor<asio::generic::stream_protocol> _acceptor;
+ asio::generic::stream_protocol::socket _socket;
};
diff --git a/upstream/remote-processor/RequestMessage.cpp b/upstream/remote-processor/RequestMessage.cpp
index 0eb1e85..0c32438 100644
--- a/upstream/remote-processor/RequestMessage.cpp
+++ b/upstream/remote-processor/RequestMessage.cpp
@@ -28,6 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "RequestMessage.h"
+#include "Utility.h"
#include <assert.h>
#include <algorithm>
#include <ctype.h>
@@ -81,30 +82,12 @@
return _argumentVector[argument];
}
-const string CRequestMessage::packArguments(size_t uiStartArgument, size_t uiNbArguments) const
+string CRequestMessage::packArguments(size_t uiStartArgument, size_t uiNbArguments) const
{
- string strPackedArguments;
-
assert(uiStartArgument + uiNbArguments <= _argumentVector.size());
- // Pack arguments, separating them with a space
- bool bFirst = true;
-
- for (size_t argument = uiStartArgument; argument < uiStartArgument + uiNbArguments;
- argument++) {
-
- if (!bFirst) {
-
- strPackedArguments += " ";
- } else {
-
- bFirst = false;
- }
-
- strPackedArguments += _argumentVector[argument];
- }
-
- return strPackedArguments;
+ auto start = begin(_argumentVector) + uiStartArgument;
+ return utility::asString(std::vector<std::string>(start, start + uiNbArguments), " ");
}
// Fill data to send
diff --git a/upstream/remote-processor/RequestMessage.h b/upstream/remote-processor/RequestMessage.h
index 7c78db6..57c0be0 100644
--- a/upstream/remote-processor/RequestMessage.h
+++ b/upstream/remote-processor/RequestMessage.h
@@ -44,14 +44,14 @@
// Command Name
void setCommand(const std::string &strCommand);
- virtual const std::string &getCommand() const;
+ const std::string &getCommand() const override;
// Arguments
- virtual void addArgument(const std::string &strArgument);
- virtual size_t getArgumentCount() const;
- virtual const std::string &getArgument(size_t argument) const;
- virtual const std::vector<std::string> &getArguments() const;
- virtual const std::string packArguments(size_t startArgument, size_t nbArguments) const;
+ void addArgument(const std::string &strArgument) override;
+ size_t getArgumentCount() const override;
+ const std::string &getArgument(size_t argument) const override;
+ const std::vector<std::string> &getArguments() const override;
+ std::string packArguments(size_t startArgument, size_t nbArguments) const override;
private:
/**
@@ -62,14 +62,14 @@
static const char *const gacDelimiters;
// Fill data to send
- virtual void fillDataToSend();
+ void fillDataToSend() override;
// Collect received data
- virtual void collectReceivedData();
+ void collectReceivedData() override;
// Size
/**
* @return size of the request message in bytes
*/
- virtual size_t getDataSize() const;
+ size_t getDataSize() const override;
// Trim input std::string
static std::string trim(const std::string &strToTrim);
diff --git a/upstream/remote-processor/Socket.h b/upstream/remote-processor/Socket.h
index 020750b..091d1cb 100644
--- a/upstream/remote-processor/Socket.h
+++ b/upstream/remote-processor/Socket.h
@@ -29,19 +29,19 @@
*/
#include <asio.hpp>
-/** Wraps and hides asio::ip::tcp::socket
+/** Wraps and hides asio::generic::stream_protocol::socket
*
- * asio::ip::tcp::socket cannot be forward-declared because it is an
+ * asio::generic::stream_protocol::socket cannot be forward-declared because it is an
* inner-class. This class wraps the asio class in order for it to be
* forward-declared and avoid it to leak in client interfaces.
*/
class Socket
{
public:
- Socket(asio::ip::tcp::socket &socket) : mSocket(socket) {}
+ Socket(asio::generic::stream_protocol::socket &socket) : mSocket(socket) {}
- asio::ip::tcp::socket &get() { return mSocket; }
+ asio::generic::stream_protocol::socket &get() { return mSocket; }
private:
- asio::ip::tcp::socket &mSocket;
+ asio::generic::stream_protocol::socket &mSocket;
};
diff --git a/upstream/schemas/CMakeLists.txt b/upstream/schemas/CMakeLists.txt
index ba876fe..0b9dc6c 100644
--- a/upstream/schemas/CMakeLists.txt
+++ b/upstream/schemas/CMakeLists.txt
@@ -37,4 +37,5 @@
Subsystem.xsd
SystemClass.xsd
W3cXmlAttributes.xsd
- DESTINATION share/${PROJECT_NAME}/schemas)
+ DESTINATION share/${PROJECT_NAME}/schemas
+ COMPONENT eng)
diff --git a/upstream/schemas/ParameterFrameworkConfiguration.xsd b/upstream/schemas/ParameterFrameworkConfiguration.xsd
index 522b806..6cc97a5 100644
--- a/upstream/schemas/ParameterFrameworkConfiguration.xsd
+++ b/upstream/schemas/ParameterFrameworkConfiguration.xsd
@@ -33,7 +33,7 @@
<xs:element name="SettingsConfiguration" type="SettingsConfigurationType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="SystemClassName" use="required" type="xs:NMTOKEN"/>
- <xs:attribute name="ServerPort" use="required" type="xs:positiveInteger"/>
+ <xs:attribute name="ServerPort" use="required" type="xs:string"/>
<xs:attribute name="TuningAllowed" use="required" type="xs:boolean"/>
</xs:complexType>
</xs:element>
diff --git a/upstream/schemas/README.md b/upstream/schemas/README.md
index f634d8c..4c1efb1 100644
--- a/upstream/schemas/README.md
+++ b/upstream/schemas/README.md
@@ -38,7 +38,7 @@
- The `SystemClass` name (for consistency check)
- `TuningAllowed` (whether the parameter-framework listens for commands)
-- The `ServerPort` on which the parameter-framework listens if
+- The `ServerPort` bind Address (PATH or TCP port) on which the parameter-framework listens if
`TuningAllowed=true`.
## SystemClass.xsd
diff --git a/upstream/skeleton-subsystem/CMakeLists.txt b/upstream/skeleton-subsystem/CMakeLists.txt
index 1ec822d..807a4db 100644
--- a/upstream/skeleton-subsystem/CMakeLists.txt
+++ b/upstream/skeleton-subsystem/CMakeLists.txt
@@ -26,18 +26,26 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# working on 2.8.12 - broken on older versions
-cmake_minimum_required(VERSION 2.8.12)
+# Known to work with CMake 3.2.2, might work with older 3.x versions, will not
+# work with versions prior to 3.0.0.
+
+cmake_minimum_required(VERSION 3.2.2)
project(parameter-framework-plugins-skeleton)
+find_package(ParameterFramework REQUIRED)
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_EXTENSIONS NO)
+set(CMAKE_CXX_STANDARD_REQUIRED YES)
+
if(WIN32)
# Force include iso646.h to support alternative operator form (and, or, not...)
# Such support is require by the standard and can be enabled with /Za
# but doing so breaks compilation of windows headers...
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /FIiso646.h")
+ set_property(DIRECTORY PROPERTY COMPILE_OPTIONS /W4 /FIiso646.h)
else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Werror -Wall -Wextra -Wconversion")
+ set_property(DIRECTORY PROPERTY COMPILE_OPTIONS -Werror -Wall -Wextra -Wconversion)
endif()
# Hide symbols by default, then exposed symbols are the same in linux and windows
@@ -45,29 +53,16 @@
set(CMAKE_VISIBILITY_INLINES_HIDDEN true)
# Force libs and executable to all be at a known place - simplifies a lot of
-# things, expecially setting the test environment
+# things, especially setting the test environment
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
-#
-# Find PFW libraries and include directories
-#
-find_path(PFW_INCLUDE_ROOT NAMES parameter/plugin/Plugin.h)
-
-find_library(PFW_CORE_LIBRARY NAMES parameter)
-
-set(PFW_INCLUDE_DIRS
- ${PFW_INCLUDE_ROOT}/parameter/plugin
- ${PFW_INCLUDE_ROOT}/xmlserializer
- ${PFW_INCLUDE_ROOT}/utility)
-
add_library(skeleton-subsystem MODULE
SkeletonSubsystemBuilder.cpp
SkeletonSubsystem.cpp
SkeletonSubsystemObject.cpp)
-target_include_directories(skeleton-subsystem PRIVATE ${PFW_INCLUDE_DIRS})
-target_link_libraries(skeleton-subsystem ${PFW_CORE_LIBRARY})
+target_link_libraries(skeleton-subsystem PRIVATE ParameterFramework::plugin)
install(TARGETS skeleton-subsystem
LIBRARY DESTINATION lib
diff --git a/upstream/skeleton-subsystem/SkeletonSubsystem.cpp b/upstream/skeleton-subsystem/SkeletonSubsystem.cpp
index 227d71a..9e555d7 100644
--- a/upstream/skeleton-subsystem/SkeletonSubsystem.cpp
+++ b/upstream/skeleton-subsystem/SkeletonSubsystem.cpp
@@ -32,11 +32,9 @@
#include "SubsystemObjectFactory.h"
#include "SkeletonSubsystemObject.h"
-#define base CSubsystem
-
// Implementation
CSkeletonSubsystem::CSkeletonSubsystem(const std::string &strName, core::log::Logger &logger)
- : base(strName, logger)
+ : CSubsystem(strName, logger)
{
// Provide mapping keys to upper layer
addContextMappingKey("Owner");
diff --git a/upstream/skeleton-subsystem/test/CMakeLists.txt b/upstream/skeleton-subsystem/test/CMakeLists.txt
index 46cb669..d36d456 100644
--- a/upstream/skeleton-subsystem/test/CMakeLists.txt
+++ b/upstream/skeleton-subsystem/test/CMakeLists.txt
@@ -30,8 +30,7 @@
configure_file(toplevel.xml "${CMAKE_CURRENT_BINARY_DIR}" COPYONLY)
add_executable(skeleton-test main.cpp)
-target_include_directories(skeleton-test PRIVATE "${PFW_INCLUDE_ROOT}/parameter/client")
-target_link_libraries(skeleton-test "${PFW_CORE_LIBRARY}")
+target_link_libraries(skeleton-test PRIVATE ParameterFramework::parameter)
add_test(NAME skeleton-test
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
diff --git a/upstream/test/catch/CMakeLists.txt b/upstream/test/catch/CMakeLists.txt
index 14b9afa..4e7d68f 100644
--- a/upstream/test/catch/CMakeLists.txt
+++ b/upstream/test/catch/CMakeLists.txt
@@ -30,7 +30,7 @@
# TODO Use gtest as it is the team recommendation
# Unfortunately gtest is very hard to setup as not binary distributed
# catch is only one header so it is very easy
- find_path(CATCH_HEADER catch.hpp)
+ find_path(CATCH_HEADER catch.hpp PATH_SUFFIXES catch)
set_property(CACHE CATCH_HEADER PROPERTY ADVANCED TRUE)
if(NOT CATCH_HEADER)
message(SEND_ERROR
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration.py b/upstream/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration.py
index 8c5e641..3bc1d03 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration.py
@@ -308,7 +308,7 @@
- no configuration created
- existent configurations not affected by error
"""
- print self.test_Conf_Renaming_Error.__doc__
+ print(self.test_Conf_Renaming_Error.__doc__)
# New domain creation for testing purpose
log.I("New domain creation for testing purpose : %s" % (self.domain_name))
log.I("command [createDomain]")
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Export_Import_Domains.py b/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Export_Import_Domains.py
index 2bfc50a..09dbbff 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Export_Import_Domains.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Export_Import_Domains.py
@@ -46,7 +46,7 @@
- Testing import errors
- Testing export errors
"""
-import os, commands
+import os
import unittest
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Sync.py b/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Sync.py
index d95318d..4d6c994 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Sync.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Sync.py
@@ -44,7 +44,7 @@
- Testing sync nominal case
- Testing errors
"""
-import commands, os
+import os
import unittest
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_getParameter.py b/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_getParameter.py
index e0c7fb9..53abd42 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_getParameter.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_getParameter.py
@@ -71,6 +71,6 @@
#Get undefined parameter value
log.I("Get undefined parameter value")
out, err = self.pfw.sendCmd("getParameter", "Undefined_parameter", expectSuccess=False)
- print str(out)
+ print(str(out))
assert err == None, "Error when getting parameter : %s" % (err)
assert out != "Done", "Error not detected when getting an undefined parameter"
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_listingFunctions.py b/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_listingFunctions.py
index 327f2e4..f0e8f3a 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_listingFunctions.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_listingFunctions.py
@@ -41,7 +41,7 @@
- Testing dumpDomains function on nominal case
- Testing dumpElements function on nominal case
"""
-import commands, os
+import os
import unittest
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tBit_Block.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tBit_Block.py
index f0161ad..f530997 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tBit_Block.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tBit_Block.py
@@ -55,7 +55,6 @@
"""
import os
-import commands
import unittest
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tBoolean.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tBoolean.py
index 9c95692..f9db199 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tBoolean.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tBoolean.py
@@ -126,7 +126,7 @@
~~~~~~~~~~~~~~~~~
- Error detected, boolean not updated
"""
- print self.testBooleanNegative.__doc__
+ print(self.testBooleanNegative.__doc__)
value = "-1"
out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False)
assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
@@ -152,7 +152,7 @@
~~~~~~~~~~~~~~~~~
- Error detected, boolean not updated
"""
- print self.testBooleanOverflow.__doc__
+ print(self.testBooleanOverflow.__doc__)
value = "2"
out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False)
assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tEnum.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tEnum.py
index 524e763..88199dd 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tEnum.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tEnum.py
@@ -51,7 +51,6 @@
- Enum parameter undefined value = UNDEF
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q0_15.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q0_15.py
index 0c9e273..692fbc6 100755
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q0_15.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q0_15.py
@@ -52,7 +52,6 @@
- FP16_Q0.15 parameter in nominal case = 0.2453
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q15_0.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q15_0.py
index 11e237b..bf46e82 100755
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q15_0.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q15_0.py
@@ -52,7 +52,6 @@
- FP16_Q15.0 parameter in nominal case = 2222
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q7_8.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q7_8.py
index 2fb44d3..0e06602 100755
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q7_8.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q7_8.py
@@ -52,7 +52,6 @@
- FP16_Q7.8 parameter in nominal case = 23.59
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q0_31.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q0_31.py
index 133d481..4dcb7a0 100755
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q0_31.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q0_31.py
@@ -52,7 +52,6 @@
- FP16_Q0.31 parameter in nominal case = 0.5000000000
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q15_16.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q15_16.py
index 013855a..2acc8a0 100755
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q15_16.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q15_16.py
@@ -52,7 +52,6 @@
- FP32_Q15.16 parameter in nominal case = 12345.12345
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q31_0.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q31_0.py
index 4497d52..4373209 100755
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q31_0.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q31_0.py
@@ -52,7 +52,6 @@
- FP32_Q31.0 parameter in nominal case = 2222
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q8_20.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q8_20.py
index 126a6a2..a2d85f1 100755
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q8_20.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q8_20.py
@@ -52,7 +52,6 @@
- FP32_Q8.20 parameter in nominal case = -128.123456
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q0_7.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q0_7.py
index dc1d733..8748a22 100755
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q0_7.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q0_7.py
@@ -52,7 +52,6 @@
- FP8_Q0.7 parameter in nominal case = 0.50
"""
import os
-import commands
import unittest
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q3_4.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q3_4.py
index 825d3d2..15cab87 100755
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q3_4.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q3_4.py
@@ -52,7 +52,6 @@
- FP8_Q0.7 parameter in nominal case = 4.3
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q7_0.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q7_0.py
index 4918aa7..e783691 100755
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q7_0.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q7_0.py
@@ -52,7 +52,6 @@
- FP8_Q7.0 parameter in nominal case = 64
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16.py
index 774bc56..3443f1a 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16.py
@@ -51,7 +51,6 @@
- INT16 parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py
index 34fa1cc..74dbf6c 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py
@@ -52,7 +52,6 @@
- Testing array index out of bounds
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
@@ -66,9 +65,9 @@
def setUp(self):
self.param_name = "/Test/Test/TEST_DIR/INT16_ARRAY"
self.param_short_name = os.environ["PFW_RESULT"] + "/INT16_ARRAY"
- print '\r'
+ print('\r')
self.pfw.sendCmd("setTuningMode", "on")
- print '\r'
+ print('\r')
self.array_size = 5
self.array_min = -50
self.array_max = 50
@@ -158,6 +157,42 @@
indexed_files_system_array_value = open(self.param_short_name).read().splitlines()[index]
assert indexed_files_system_array_value == hex_indexed_array_value, log.F("FILESSYSTEM : %s[%s] update error"
% (self.param_name, str(index)))
+ def test_dump_Values(self):
+ """
+ Testing INT16_ARRAY dump value
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every INT16_ARRAY elements to values : 1 0 -50 0 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16_ARRAY array elements correctly recorded
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_dump_Values.__doc__)
+ index = 2
+ indexed_array_value = self.array_min
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ hex_indexed_array_value = hex(c_uint16(indexed_array_value).value)
+ #Check parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("dumpElement", str(self.param_name), "")
+ #out, err = self.pfw.sendCmd("getParameter", str(indexed_array_value_path), "")
+ assert err == None, log.E("when setting parameter %s[%s] : %s"
+ % (self.param_name, str(index), err))
+ assert out == str("- IntegerParameter: INT16_ARRAY = 1 0 -50 0 0"), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, str("- IntegerParameter: INT16_ARRAY = 1 0 -50 0 0"), out))
def test_Min_Value_Overflow(self):
"""
@@ -302,7 +337,7 @@
log.D(self.test_Array_Index_Overflow.__doc__)
index_values = (self.array_size-1, self.array_size+1, -1)
for index in index_values:
- print index
+ print(index)
indexed_array_value = self.array_max
indexed_array_value_path = "".join([self.param_name, "/", str(index)])
#Check parameter value setting
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16_Max.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16_Max.py
index 62d2db1..53cecb3 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16_Max.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT16_Max.py
@@ -51,7 +51,6 @@
- INT16_Max parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT32.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT32.py
index fc82b03..b1cc0de 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT32.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT32.py
@@ -51,7 +51,6 @@
- INT32 parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
@@ -83,8 +82,8 @@
- INT32 parameter set to 50
- Blackboard and filesystem values checked
"""
- print self.test_Nominal_Case.__doc__
- print "INFO : INT32 parameter in nominal case = 50"
+ print(self.test_Nominal_Case.__doc__)
+ print("INFO : INT32 parameter in nominal case = 50")
value = "50"
hex_value = "0x32"
#Set parameter value
@@ -97,7 +96,7 @@
assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
#Check parameter value on filesystem
assert open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] == hex_value, "FILESYSTEM : parameter update error"
- print "INFO : test OK"
+ print("INFO : test OK")
def test_TypeMin(self):
"""
@@ -117,8 +116,8 @@
- INT32 parameter set to -1000
- Blackboard and filesystem values checked
"""
- print self.test_TypeMin.__doc__
- print "INFO : INT32 parameter min value = -1000"
+ print(self.test_TypeMin.__doc__)
+ print("INFO : INT32 parameter min value = -1000")
value = "-1000"
hex_value = "0xfffffc18"
#Set parameter value
@@ -131,7 +130,7 @@
assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
#Check parameter value on filesystem
assert open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] == hex_value, "FILESYSTEM : parameter update error"
- print "INFO : test OK"
+ print("INFO : test OK")
def test_TypeMin_Overflow(self):
"""
@@ -152,8 +151,8 @@
- INT32 parameter not updated
- Blackboard and filesystem values checked
"""
- print self.test_TypeMin_Overflow.__doc__
- print "INFO : INT32 parameter min value out of bounds = -1001"
+ print(self.test_TypeMin_Overflow.__doc__)
+ print("INFO : INT32 parameter min value out of bounds = -1001")
value = "-1001"
param_check = open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1]
#Set parameter value
@@ -162,7 +161,7 @@
assert out != "Done", "PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name)
#Check parameter value on filesystem
assert open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] == param_check, "FILESYSTEM : Forbiden parameter change"
- print "INFO : test OK"
+ print("INFO : test OK")
def test_TypeMax(self):
"""
@@ -182,8 +181,8 @@
- INT32 parameter set to 1000
- Blackboard and filesystem values checked
"""
- print self.test_TypeMax.__doc__
- print "INFO : INT32 parameter max value = 1000"
+ print(self.test_TypeMax.__doc__)
+ print("INFO : INT32 parameter max value = 1000")
value = "1000"
hex_value = "0x3e8"
#Set parameter value
@@ -196,7 +195,7 @@
assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
#Check parameter value on filesystem
assert open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] == hex_value, "FILESYSTEM : parameter update error"
- print "INFO : test OK"
+ print("INFO : test OK")
def test_TypeMax_Overflow(self):
"""
@@ -217,8 +216,8 @@
- INT32 parameter not updated
- Blackboard and filesystem values checked
"""
- print self.test_TypeMax_Overflow.__doc__
- print "INFO : INT32 parameter max value out of bounds = 1001"
+ print(self.test_TypeMax_Overflow.__doc__)
+ print("INFO : INT32 parameter max value out of bounds = 1001")
value = "1001"
param_check = open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1]
#Set parameter value
@@ -227,4 +226,4 @@
assert out != "Done", "PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name)
#Check parameter value on filesystem
assert open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] == param_check, "FILESYSTEM : Forbiden parameter change"
- print "INFO : test OK"
+ print("INFO : test OK")
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT32_Max.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT32_Max.py
index 15e5dde..5d8b2b9 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT32_Max.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT32_Max.py
@@ -51,7 +51,6 @@
- INT32_Max parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT8.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT8.py
index f82a524..884fb5d 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT8.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT8.py
@@ -51,7 +51,6 @@
- INT8 parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT8_Max.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT8_Max.py
index 9eff0bb..46e0476 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT8_Max.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tINT8_Max.py
@@ -51,7 +51,6 @@
- INT8_Max parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
@@ -83,8 +82,8 @@
- INT8_Max parameter set to 50
- Blackboard and filesystem values checked
"""
- print self.test_Nominal_Case.__doc__
- print "INFO : INT8_Max parameter in nominal case = 50"
+ print(self.test_Nominal_Case.__doc__)
+ print("INFO : INT8_Max parameter in nominal case = 50")
value = "50"
hex_value = "0x32"
#Set parameter value
@@ -97,7 +96,7 @@
assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
#Check parameter value on filesystem
assert open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] == hex_value, "FILESYSTEM : parameter update error"
- print "INFO : test OK"
+ print("INFO : test OK")
def test_TypeMin(self):
"""
@@ -117,8 +116,8 @@
- INT8_Max parameter set to -128
- Blackboard and filesystem values checked
"""
- print self.test_TypeMin.__doc__
- print "INFO : INT8_Max parameter min value = -128"
+ print(self.test_TypeMin.__doc__)
+ print("INFO : INT8_Max parameter min value = -128")
value = "-128"
hex_value = "0x80"
#Set parameter value
@@ -131,7 +130,7 @@
assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
#Check parameter value on filesystem
assert open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] == hex_value, "FILESYSTEM : parameter update error"
- print "INFO : test OK"
+ print("INFO : test OK")
def test_TypeMin_Overflow(self):
"""
@@ -152,8 +151,8 @@
- INT8_Max parameter not updated
- Blackboard and filesystem values checked
"""
- print self.test_TypeMin_Overflow.__doc__
- print "INFO : INT8_Max parameter min value out of bounds = -129"
+ print(self.test_TypeMin_Overflow.__doc__)
+ print("INFO : INT8_Max parameter min value out of bounds = -129")
value = "-129"
param_check = open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1]
#Set parameter value
@@ -162,7 +161,7 @@
assert out != "Done", "PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name)
#Check parameter value on filesystem
assert open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] == param_check, "FILESYSTEM : Forbiden parameter change"
- print "INFO : test OK"
+ print("INFO : test OK")
def test_TypeMax(self):
"""
@@ -182,8 +181,8 @@
- INT8_Max parameter set to 127
- Blackboard and filesystem values checked
"""
- print self.test_TypeMax.__doc__
- print "INFO : INT8_Max parameter max value = 127"
+ print(self.test_TypeMax.__doc__)
+ print("INFO : INT8_Max parameter max value = 127")
value = "127"
hex_value = "0x7f"
#Set parameter value
@@ -196,7 +195,7 @@
assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
#Check parameter value on filesystem
assert open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] == hex_value, "FILESYSTEM : parameter update error"
- print "INFO : test OK"
+ print("INFO : test OK")
def test_TypeMax_Overflow(self):
"""
@@ -217,8 +216,8 @@
- INT8_Max parameter not updated
- Blackboard and filesystem values checked
"""
- print self.test_TypeMax_Overflow.__doc__
- print "INFO : INT8_Max parameter max value out of bounds = 128"
+ print(self.test_TypeMax_Overflow.__doc__)
+ print("INFO : INT8_Max parameter max value out of bounds = 128")
value = "128"
param_check = open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1]
#Set parameter value
@@ -227,4 +226,4 @@
assert out != "Done", "PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name)
#Check parameter value on filesystem
assert open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] == param_check, "FILESYSTEM : Forbiden parameter change"
- print "INFO : test OK"
+ print("INFO : test OK")
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tParameter_Block.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tParameter_Block.py
index 76317b4..bff1e47 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tParameter_Block.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tParameter_Block.py
@@ -51,7 +51,6 @@
- Testing error : Try to set an undefined param
"""
import os
-import commands
import unittest
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tRAW.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tRAW.py
index eb7dc5b..023267a 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tRAW.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tRAW.py
@@ -67,7 +67,6 @@
- Writing Raw
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tSTRING_128.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tSTRING_128.py
index 78f829f..44af52d 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tSTRING_128.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tSTRING_128.py
@@ -29,7 +29,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os
-import commands, string, random
+import string, random
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT16.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT16.py
index f7fc72e..3ff0796 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT16.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT16.py
@@ -54,7 +54,6 @@
- UINT16 parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT16_Max.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT16_Max.py
index 805017e..5368ed1 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT16_Max.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT16_Max.py
@@ -53,7 +53,6 @@
- UINT16_Max parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32.py
index e33296b..2813567 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32.py
@@ -53,7 +53,6 @@
- UINT32 parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_ARRAY.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_ARRAY.py
index c277a06..41060c8 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_ARRAY.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_ARRAY.py
@@ -54,7 +54,6 @@
- Testing value format error
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
@@ -67,9 +66,9 @@
def setUp(self):
self.param_name = "/Test/Test/TEST_DIR/UINT32_ARRAY"
self.param_short_name = os.environ["PFW_RESULT"] + "/UINT32_ARRAY"
- print '\r'
+ print('\r')
self.pfw.sendCmd("setTuningMode", "on")
- print '\r'
+ print('\r')
self.array_size = 100
self.array_min = 0
self.array_max = 100
@@ -303,7 +302,7 @@
log.D(self.test_Array_Index_Overflow.__doc__)
index_values = (self.array_size-1, self.array_size+1, -1)
for index in index_values:
- print index
+ print(index)
indexed_array_value = self.array_max
indexed_array_value_path = "".join([self.param_name, "/", str(index)])
#Check parameter value setting
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_Max.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_Max.py
index 9966ac3..5a5af92 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_Max.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_Max.py
@@ -53,7 +53,6 @@
- UINT16 parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8.py
index 8a6c815..674c7f1 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8.py
@@ -53,7 +53,6 @@
- UINT8 parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_ARRAY.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_ARRAY.py
index 88c2e58..9090d1b 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_ARRAY.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_ARRAY.py
@@ -54,7 +54,6 @@
- Testing value format error
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
@@ -67,9 +66,9 @@
def setUp(self):
self.param_name = "/Test/Test/TEST_DIR/UINT8_ARRAY"
self.param_short_name = os.environ["PFW_RESULT"] + "/UINT8_ARRAY"
- print '\r'
+ print('\r')
self.pfw.sendCmd("setTuningMode", "on")
- print '\r'
+ print('\r')
self.array_size = 5
self.array_min = 0
self.array_max = 15
@@ -303,7 +302,7 @@
log.D(self.test_Array_Index_Overflow.__doc__)
index_values = (self.array_size-1, self.array_size+1, -1)
for index in index_values:
- print index
+ print(index)
indexed_array_value = self.array_max
indexed_array_value_path = "".join([self.param_name, "/", str(index)])
#Check parameter value setting
diff --git a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_Max.py b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_Max.py
index 71bfdab..b12cdb1 100644
--- a/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_Max.py
+++ b/upstream/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_Max.py
@@ -53,7 +53,6 @@
- UINT8_Max parameter in nominal case = 50
"""
import os
-import commands
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
diff --git a/upstream/test/functional-tests-legacy/Util/ACTLogging.py b/upstream/test/functional-tests-legacy/Util/ACTLogging.py
index fdc71ef..23bed09 100644
--- a/upstream/test/functional-tests-legacy/Util/ACTLogging.py
+++ b/upstream/test/functional-tests-legacy/Util/ACTLogging.py
@@ -30,19 +30,19 @@
class Logger(object) :
def E(self, string):
- print "\nERROR: %s\n" % (string)
+ print("\nERROR: %s\n" % (string))
return "ERROR: %s" % (string)
def F(self, string):
- print "\nFAIL : %s\n" % (string)
+ print("\nFAIL : %s\n" % (string))
return "FAIL : %s" % (string)
def I(self, string):
- print "INFO : %s" % (string)
+ print("INFO : %s" % (string))
return "INFO : %s" % (string)
def D(self, string):
- print "\n======================================================================"
- print "%s" %(string)
- print "======================================================================"
+ print("\n======================================================================")
+ print("%s" %(string))
+ print("======================================================================")
return string
diff --git a/upstream/test/functional-tests-legacy/Util/PfwUnitTestLib.py b/upstream/test/functional-tests-legacy/Util/PfwUnitTestLib.py
index 78b1f76..714a41d 100644
--- a/upstream/test/functional-tests-legacy/Util/PfwUnitTestLib.py
+++ b/upstream/test/functional-tests-legacy/Util/PfwUnitTestLib.py
@@ -55,12 +55,12 @@
sys_cmd = self.platform_command + [cmd]
if args is not None:
sys_cmd += args
- print "CMD : %s" % sys_cmd
+ print("CMD : %s" % sys_cmd)
try:
p = subprocess.Popen(sys_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- except Exception as (errno, strerror):
- return None, strerror
+ except OSError as error:
+ return None, error.strerror
out, err = p.communicate()
out = out.rstrip('\r\n')
@@ -74,18 +74,18 @@
class Hal(RemoteCli):
# Arbitrary choosen port, try to avoid conflicting with IANA registered ports
- testPlatformPort = 18444
- platform_command = ["remote-process", "localhost", str(testPlatformPort)]
+ testPlatformBindAddress = "18444"
+ platform_command = ["remote-process", "localhost", testPlatformBindAddress]
def __init__(self, pfw):
self.pfw = pfw
# Starts the HAL exe
def startHal(self):
- cmd= ["test-platform", os.environ["PFW_TEST_CONFIGURATION"], str(self.testPlatformPort)]
+ cmd= ["test-platform", os.environ["PFW_TEST_CONFIGURATION"], self.testPlatformBindAddress]
self.setRemoteProcess(subprocess.Popen(cmd))
# Wait for the test-platform listening socket
- while socket.socket().connect_ex(("localhost", self.testPlatformPort)) != 0:
+ while socket.socket().connect_ex(("localhost", int(self.testPlatformBindAddress))) != 0:
assert self.remoteProcess.poll() == None, "Test platform has failed to start. Return code: %s" % self.remoteProcess.returncode
time.sleep(0.01)
diff --git a/upstream/test/functional-tests/AutoSync.cpp b/upstream/test/functional-tests/AutoSync.cpp
index 9353b8d..c075700 100644
--- a/upstream/test/functional-tests/AutoSync.cpp
+++ b/upstream/test/functional-tests/AutoSync.cpp
@@ -30,11 +30,14 @@
#include "Config.hpp"
#include "ParameterFramework.hpp"
+#include "DynamicLibrary.hpp"
#include <SubsystemObject.h>
#include <IntrospectionEntryPoint.h>
#include "Test.hpp"
#include <catch.hpp>
#include <string>
+#include <iostream>
+#include "Memory.hpp"
using std::string;
@@ -43,7 +46,13 @@
struct BoolPF : public ParameterFramework
{
- BoolPF() : ParameterFramework{createConfig()} {}
+ BoolPF() : ParameterFramework{createConfig()} {
+
+ mDynamicLibrary = ::utility::make_unique<DynamicLibrary>(mSubsystemPath);
+ REQUIRE(mDynamicLibrary != nullptr);
+ mGetParamFunc = mDynamicLibrary->getSymbol<GetParamFunc>("getParameterValue");
+ REQUIRE(mGetParamFunc != nullptr);
+ }
/** Set the boolean parameter value within the "Conf" configuration,
* which is always applicable. */
@@ -53,14 +62,18 @@
setConfigurationParameter("Domain", "Conf", "/test/test/param", valueStr);
}
+ bool getParameterValue()
+ {
+ return mGetParamFunc();
+ }
+
private:
static Config createConfig()
{
Config config;
config.instances = R"(<BooleanParameter Name="param" Mapping="Object"/>)";
- config.plugins = {{"", {"introspection-subsystem"}}};
+ config.plugins = {{PLUGIN_PATH, {PLUGIN_NAME}}};
config.subsystemType = "INTROSPECTION";
-
config.domains = R"(<ConfigurableDomain Name="Domain">
<Configurations>
<Configuration Name="Conf">
@@ -83,6 +96,11 @@
return config;
}
+
+ using GetParamFunc = bool (*)();
+ std::string mSubsystemPath = std::string(PLUGIN_PATH) + (*PLUGIN_PATH ? "/":"") + PLUGIN_NAME;
+ std::unique_ptr<DynamicLibrary> mDynamicLibrary;
+ bool (*mGetParamFunc)();
};
SCENARIO_METHOD(BoolPF, "Auto sync")
@@ -91,7 +109,7 @@
REQUIRE_NOTHROW(start());
THEN ("Parameter value is false according to the settings") {
- REQUIRE_FALSE(introspectionSubsystem::getParameterValue());
+ REQUIRE_FALSE(getParameterValue());
AND_THEN ("Tuning is off") {
REQUIRE_FALSE(isTuningModeOn());
@@ -103,7 +121,7 @@
REQUIRE_NOTHROW(setParameterValue(true));
THEN ("Sync is done") {
- CHECK(introspectionSubsystem::getParameterValue());
+ CHECK(getParameterValue());
}
}
}
@@ -114,13 +132,13 @@
REQUIRE_NOTHROW(setParameterValue(true));
THEN ("Sync should not have occurred yet") {
- REQUIRE_FALSE(introspectionSubsystem::getParameterValue());
+ REQUIRE_FALSE(getParameterValue());
WHEN ("Turning autosync on") {
REQUIRE_NOTHROW(setAutoSync(true));
THEN ("Sync is done") {
- CHECK(introspectionSubsystem::getParameterValue());
+ CHECK(getParameterValue());
}
}
}
@@ -130,4 +148,4 @@
}
}
}
-}
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/Basic.cpp b/upstream/test/functional-tests/Basic.cpp
index 60e6bbc..b414460 100644
--- a/upstream/test/functional-tests/Basic.cpp
+++ b/upstream/test/functional-tests/Basic.cpp
@@ -178,4 +178,4 @@
}
}
-} // parameterFramework
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/BitParameter.cpp b/upstream/test/functional-tests/BitParameter.cpp
new file mode 100644
index 0000000..0a0fb95
--- /dev/null
+++ b/upstream/test/functional-tests/BitParameter.cpp
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2017, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Config.hpp"
+#include "ParameterFramework.hpp"
+#include "ElementHandle.hpp"
+#include "Test.hpp"
+
+#include <catch.hpp>
+
+#include <string>
+
+using std::string;
+
+namespace parameterFramework
+{
+
+const auto validBitParameterInstances = Config{
+ &Config::instances,
+ // Default for integers is unsigned/32bits
+ R"(<BitParameterBlock Name="nominal" Size="16"><BitParameter Pos="0" Size="1" Name="bool"/><BitParameter Pos="1" Size="2" Name="twobits"/><BitParameter Pos="3" Size="3" Max="6" Name="treebits"/></BitParameterBlock>)"};
+
+const auto &invalidBitParameterParameters =
+ Tests<string>{{"Too much bits", "<BitParameterBlock Name='toomuchbits' Size='8'><BitParameter "
+ "Pos='1' Size='2' Name='twobits'/><BitParameter Pos='3' "
+ "Size='7' Name='toobits'/></BitParameterBlock>"},
+ {"Max too high", "<BitParameterBlock Name='maxtoohigh' Size='8'><BitParameter "
+ "Pos='1' Size='2' Name='twobits'/><BitParameter Pos='3' "
+ "Size='2' Max='5' Name='toohigh'/></BitParameterBlock>"}};
+
+struct BitParameterPF : public ParameterFramework
+{
+ BitParameterPF() : ParameterFramework{std::move(validBitParameterInstances)} {}
+};
+
+SCENARIO_METHOD(LazyPF, "Invalid BitParameter types XML structure", "[BitParameter types]")
+{
+ for (auto &vec : invalidBitParameterParameters) {
+ GIVEN ("intentional error: " + vec.title) {
+ create(Config{&Config::instances, vec.payload});
+ THEN ("Start should fail") {
+ CHECK_THROWS_AS(mPf->start(), Exception);
+ }
+ }
+ }
+}
+
+SCENARIO_METHOD(BitParameterPF, "BitParameter types", "[BitParameter types]")
+{
+ GIVEN ("A valid XML structure file") {
+ THEN ("Start should succeed") {
+ CHECK_NOTHROW(start());
+ REQUIRE_NOTHROW(setTuningMode(true));
+ string path = "/test/test/nominal/treebits";
+
+ AND_THEN ("Set/Get a BitParameter type parameter in real value space") {
+
+ for (auto &vec : Tests<string>{
+ {"(too high)", "7"}, {"(too low)", "-1"},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "6"}, {"(lower limit)", "0"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get a BitParameter type parameter in real value space") {
+ ElementHandle handle{*this, path};
+ REQUIRE_NOTHROW(setRawValueSpace(true));
+ REQUIRE_NOTHROW(setHexOutputFormat(true));
+
+ for (auto &vec : Tests<string>{
+ {"(too high)", "0x7"},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "0x6"}, {"(lower limit)", "0x0"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get a BitParameter type parameter in boolean") {
+ ElementHandle handle{*this, path};
+ /** @FIXME: 'set' operations on a ParameterHandle are silently
+ * ignored in tuning mode. Does it make sense ? */
+ REQUIRE_NOTHROW(setTuningMode(false));
+
+ for (auto &vec : Tests<bool>{
+ {"(upper limit)", true}, {"(lower limit)", false},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(handle.setAsBoolean(vec.payload), Exception);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get a BitParameter type parameter in boolean") {
+ path = "/test/test/nominal/bool";
+ ElementHandle handle{*this, path};
+ /** @FIXME: 'set' operations on a ParameterHandle are silently
+ * ignored in tuning mode. Does it make sense ? */
+ REQUIRE_NOTHROW(setTuningMode(false));
+
+ for (auto &vec : Tests<bool>{
+ {"(upper limit)", true}, {"(lower limit)", false},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(handle.setAsBoolean(vec.payload));
+ bool getValueBack;
+ REQUIRE_NOTHROW(handle.getAsBoolean(getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+ }
+ }
+}
+}
diff --git a/upstream/test/functional-tests/Boolean.cpp b/upstream/test/functional-tests/Boolean.cpp
new file mode 100644
index 0000000..c485aba
--- /dev/null
+++ b/upstream/test/functional-tests/Boolean.cpp
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2017, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Config.hpp"
+#include "ParameterFramework.hpp"
+#include "ElementHandle.hpp"
+#include "Test.hpp"
+
+#include <catch.hpp>
+
+#include <string>
+
+using std::string;
+
+namespace parameterFramework
+{
+
+const auto validBooleanInstances = Config{&Config::instances,
+ // Default for integers is unsigned/32bits
+ R"(<BooleanParameter Name="Empty"/>
+ <BooleanParameter Name="nominal"/>)"};
+
+struct BooleanPF : public ParameterFramework
+{
+ BooleanPF() : ParameterFramework{std::move(validBooleanInstances)} {}
+};
+
+SCENARIO_METHOD(BooleanPF, "Boolean types", "[Boolean types]")
+{
+ GIVEN ("A valid XML structure file") {
+ THEN ("Start should succeed") {
+ CHECK_NOTHROW(start());
+ REQUIRE_NOTHROW(setTuningMode(true));
+ string path = "/test/test/nominal";
+
+ AND_THEN ("Set/Get a Boolean type parameter in real value space") {
+
+ for (auto &vec : Tests<string>{
+ {"(too high)", "2"}, {"(too low)", "-1"}, {"(not a number)", "foobar"},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "1"}, {"(lower limit)", "0"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get boolean type parameter handle") {
+ ElementHandle handle{*this, path};
+ /** @FIXME: 'set' operations on a ParameterHandle are silently
+ * ignored in tuning mode. Does it make sense ? */
+ REQUIRE_NOTHROW(setTuningMode(false));
+
+ for (auto &vec : Tests<bool>{
+ {"(upper limit)", true}, {"(lower limit)", false},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(handle.setAsBoolean(vec.payload));
+ bool getValueBack;
+ REQUIRE_NOTHROW(handle.getAsBoolean(getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get integer type parameter handle") {
+ ElementHandle handle{*this, path};
+ /** @FIXME: 'set' operations on a ParameterHandle are silently
+ * ignored in tuning mode. Does it make sense ? */
+ REQUIRE_NOTHROW(setTuningMode(false));
+
+ for (auto &vec : Tests<uint32_t>{
+ {"(upper limit)", 1}, {"(lower limit)", 0},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(handle.setAsInteger(vec.payload));
+ uint32_t getValueBack;
+ REQUIRE_NOTHROW(handle.getAsInteger(getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ for (auto &vec : Tests<uint32_t>{
+ {"(too high)", 2},
+ }) {
+ GIVEN ("An invalid value " + vec.title) {
+ CHECK_THROWS_AS(handle.setAsInteger(vec.payload), Exception);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get a Boolean type parameter in real value space") {
+ ElementHandle handle{*this, path};
+ REQUIRE_NOTHROW(setRawValueSpace(true));
+
+ for (auto &vec : Tests<string>{
+ {"(too high hexa)", "0x2"},
+ {"(too high dec)", "2"},
+ {"(too low hexa )", "0xFF"},
+ {"(not a number)", "foobar"},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(TRUE hexa)", "0x1"}, {"(TRUE dec)", "1"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == "1");
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(FALSE hexa)", "0x0"}, {"(FALSE dec)", "0"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == "0");
+ }
+ }
+ }
+ }
+ }
+}
+}
diff --git a/upstream/test/functional-tests/CMakeLists.txt b/upstream/test/functional-tests/CMakeLists.txt
index 1ab0449..b938231 100644
--- a/upstream/test/functional-tests/CMakeLists.txt
+++ b/upstream/test/functional-tests/CMakeLists.txt
@@ -35,14 +35,24 @@
# Add unit test
add_executable(parameterFunctionalTest
Basic.cpp
+ Boolean.cpp
+ BitParameter.cpp
+ EnumParameter.cpp
FloatingPoint.cpp
+ FixedPoint.cpp
+ Integer.cpp
+ Linear.cpp
+ Logarithmic.cpp
Handle.cpp
AutoSync.cpp)
find_package(LibXml2 REQUIRED)
+ target_compile_definitions(parameterFunctionalTest PUBLIC -D PLUGIN_NAME=\"introspection-subsystem\" PLUGIN_PATH=\"\")
+
target_link_libraries(parameterFunctionalTest
- PRIVATE parameter catch tmpfile LibXml2::libxml2 introspection-subsystem)
+ PRIVATE parameter
+ PRIVATE pfw_utility catch tmpfile LibXml2::libxml2 introspection-subsystem)
add_test(NAME parameterFunctionalTest
COMMAND parameterFunctionalTest)
diff --git a/upstream/test/functional-tests/EnumParameter.cpp b/upstream/test/functional-tests/EnumParameter.cpp
new file mode 100644
index 0000000..5d17837
--- /dev/null
+++ b/upstream/test/functional-tests/EnumParameter.cpp
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2017, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Config.hpp"
+#include "ParameterFramework.hpp"
+#include "ElementHandle.hpp"
+#include "Test.hpp"
+
+#include <catch.hpp>
+
+#include <string>
+
+using std::string;
+
+namespace parameterFramework
+{
+
+const auto validEnumParameterInstances = Config{
+ &Config::instances,
+ // Default for integers is unsigned/32bits
+ R"(<EnumParameter Name="nominal" Size="8"><ValuePair Literal="on" Numerical="3"/><ValuePair Literal="off" Numerical="0"/></EnumParameter>)"};
+
+const auto &invalidEnumParameterParameters = Tests<string>{
+ {"No Size", "<EnumParameter Name='nosize'><ValuePair Literal='on' Numerical='3'/><ValuePair "
+ "Literal='off' Numerical='0'/></EnumParameter>"}};
+
+struct EnumParameterPF : public ParameterFramework
+{
+ EnumParameterPF() : ParameterFramework{std::move(validEnumParameterInstances)} {}
+};
+
+SCENARIO_METHOD(LazyPF, "Invalid EnumParameter types XML structure", "[EnumParameter types]")
+{
+ for (auto &vec : invalidEnumParameterParameters) {
+ GIVEN ("intentional error: " + vec.title) {
+ create(Config{&Config::instances, vec.payload});
+ THEN ("Start should fail") {
+ CHECK_THROWS_AS(mPf->start(), Exception);
+ }
+ }
+ }
+}
+
+SCENARIO_METHOD(EnumParameterPF, "EnumParameter types", "[EnumParameter types]")
+{
+ GIVEN ("A valid XML structure file") {
+ THEN ("Start should succeed") {
+ CHECK_NOTHROW(start());
+ REQUIRE_NOTHROW(setTuningMode(true));
+ string path = "/test/test/nominal";
+
+ AND_THEN ("Set/Get a EnumParameter type parameter in real value space") {
+
+ for (auto &vec : Tests<string>{
+ {"(not a number)", "foobar"},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "on"}, {"(lower limit)", "off"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get a EnumParameter type parameter in raw value space") {
+ ElementHandle handle{*this, path};
+ REQUIRE_NOTHROW(setRawValueSpace(true));
+
+ for (auto &vec : Tests<string>{{"(too high)", "7"}, {"(too low)", "-1"}}) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "3"}, {"(lower limit)", "0"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+
+ REQUIRE_NOTHROW(setHexOutputFormat(true));
+
+ for (auto &vec : Tests<string>{{"(too high)", "0x7"}, {"(too low)", "0xFF"}}) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "0x03"}, {"(lower limit)", "0x00"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get a EnumParameter type parameter in Integer value space") {
+ ElementHandle handle{*this, path};
+ /** @FIXME: 'set' operations on a ParameterHandle are silently
+ * ignored in tuning mode. Does it make sense ? */
+ REQUIRE_NOTHROW(setTuningMode(false));
+
+ for (auto &vec : Tests<int32_t>{
+ {"(upper limit)", 3}, {"(lower limit)", 0},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(handle.setAsSignedInteger(vec.payload));
+ int32_t getValueBack;
+ REQUIRE_NOTHROW(handle.getAsSignedInteger(getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ for (auto &vec : Tests<int32_t>{
+ {"(too high)", 13}, {"(too low)", -51},
+ }) {
+ GIVEN ("An invalid value " + vec.title) {
+ CHECK_THROWS_AS(handle.setAsSignedInteger(vec.payload), Exception);
+ }
+ }
+ }
+ }
+ }
+}
+}
diff --git a/upstream/test/functional-tests/FixedPoint.cpp b/upstream/test/functional-tests/FixedPoint.cpp
new file mode 100644
index 0000000..ecc69b5
--- /dev/null
+++ b/upstream/test/functional-tests/FixedPoint.cpp
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2017, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Config.hpp"
+#include "ParameterFramework.hpp"
+#include "ElementHandle.hpp"
+#include "Test.hpp"
+
+#include <catch.hpp>
+
+#include <string>
+
+using std::string;
+
+namespace parameterFramework
+{
+
+const auto validFixedPointInstances =
+ Config{&Config::instances,
+ // Default for integers is unsigned/32bits
+ R"(<FixedPointParameter Name="nominal" Size="16" Integral="2" Fractional="7"/>)"};
+const auto &invalidFixedPointParameters =
+ Tests<string>{{"U8 Dec + Fractional > 7",
+ "<FixedPointParameter Name='q2.6' Size='8' Integral='2' Fractional='6'/>"},
+ {"U16 Dec + Fractional > 15",
+ "<FixedPointParameter Name='q9.7' Size='16' Integral='9' Fractional='7'/>"},
+ {"U32 Fractional > 31",
+ "<FixedPointParameter Name='q0.32' Size='32' Integral='0' Fractional='32'/>"}};
+
+struct FixedPointPF : public ParameterFramework
+{
+ FixedPointPF() : ParameterFramework{std::move(validFixedPointInstances)} {}
+};
+
+SCENARIO_METHOD(LazyPF, "Invalid FixedPoint types XML structure", "[FixedPoint types]")
+{
+ for (auto &vec : invalidFixedPointParameters) {
+ GIVEN ("intentional error: " + vec.title) {
+ create(Config{&Config::instances, vec.payload});
+ THEN ("Start should fail") {
+ CHECK_THROWS_AS(mPf->start(), Exception);
+ }
+ }
+ }
+}
+
+SCENARIO_METHOD(FixedPointPF, "FixedPoint types", "[FixedPoint types]")
+{
+ GIVEN ("A valid XML structure file") {
+ THEN ("Start should succeed") {
+ CHECK_NOTHROW(start());
+ REQUIRE_NOTHROW(setTuningMode(true));
+ string path = "/test/test/nominal";
+
+ AND_THEN ("Set/Get a Fixed Point type parameter in real value space") {
+ for (auto &vec : Tests<string>{
+ {"(too high)", "4.0000000"},
+ {"(too low)", "-4.0078125"},
+ {"(not a number)", "foobar"},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "3.9921875"},
+ {"(lower limit)", "-4.0000000"},
+ {"(inside range)", "0.0000000"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+ AND_THEN ("Set/Get a Fixed Point parameter in raw value space") {
+ REQUIRE_NOTHROW(setRawValueSpace(true));
+
+ for (auto &vec : Tests<string>{
+ {"(upper limit) as decimal", "32767"},
+ {"(lower limit) as decimal", "-32768"},
+ {"(inside range) as decimal", "0"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(too high)", "32768"}, {"(too low)", "-32769"},
+ }) {
+ GIVEN ("Invalid value interger" + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(too high)", "0x10000"}, {"(too low)", "0xfffe0000"},
+ }) {
+ GIVEN ("Invalid value hexa" + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ }
+ }
+ }
+}
+}
diff --git a/upstream/test/functional-tests/FloatingPoint.cpp b/upstream/test/functional-tests/FloatingPoint.cpp
index fd41797..5581cd4 100644
--- a/upstream/test/functional-tests/FloatingPoint.cpp
+++ b/upstream/test/functional-tests/FloatingPoint.cpp
@@ -176,4 +176,4 @@
}
}
}
-}
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/Handle.cpp b/upstream/test/functional-tests/Handle.cpp
index d7aafb9..fd25da8 100644
--- a/upstream/test/functional-tests/Handle.cpp
+++ b/upstream/test/functional-tests/Handle.cpp
@@ -384,8 +384,8 @@
<IntegerParameter Name="integer_array">0xFFFFFFF6 0x00000000 0x00000008 0x0000000A</IntegerParameter>
<FixedPointParameter ValueSpace="Raw" Name="fix_point">0x24000000</FixedPointParameter>
<FixedPointParameter ValueSpace="Raw" Name="fix_point_array">0x72000000 0x0B000000 0xF0000000</FixedPointParameter>
- <EnumParameter Name="enum">five</EnumParameter>
- <EnumParameter Name="enum_array">eight min eight min</EnumParameter>
+ <EnumParameter Name="enum">0x05</EnumParameter>
+ <EnumParameter Name="enum_array">0x0008 0x8001 0x0008 0x8001</EnumParameter>
<StringParameter Name="string">A string of 32 character.@@@@@@@</StringParameter>
<BitParameterBlock Name="bit_block">
<BitParameter Name="one">0x1</BitParameter>
diff --git a/upstream/test/functional-tests/Integer.cpp b/upstream/test/functional-tests/Integer.cpp
new file mode 100644
index 0000000..1a44ca3
--- /dev/null
+++ b/upstream/test/functional-tests/Integer.cpp
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Config.hpp"
+#include "ParameterFramework.hpp"
+#include "ElementHandle.hpp"
+#include "Test.hpp"
+#include "BinaryCopy.hpp"
+
+#include <catch.hpp>
+
+#include <string>
+
+using std::string;
+
+namespace parameterFramework
+{
+
+const auto validIntegerInstances = Config{&Config::instances,
+ // Default for integers is unsigned/32bits
+ R"(<IntegerParameter Name="Empty"/>
+ <IntegerParameter Name="trivial" Size="8" Signed="true"/>
+ <IntegerParameter Name="nominal" Size="8" Signed="true" Min="-50" Max="12"/>
+ <IntegerParameter Name="negMinMaxS8" Size="8" Signed="true" Min="-120" Max="-110"/>
+ <IntegerParameter Name="posMinMaxS8" Size="8" Signed="true" Min="90" Max="100"/>
+ <IntegerParameter Name="defaultMinS8" Size="8" Signed="true" Min="-128"/>
+ <IntegerParameter Name="defaultMaxS8" Size="8" Signed="true" Max="127"/>
+ <IntegerParameter Name="defaultMinU8" Size="8" Signed="false" Min="0"/>
+ <IntegerParameter Name="defaultMaxU8" Size="8" Signed="false" Max="255"/>
+ <IntegerParameter Name="defaultMinS16" Size="16" Signed="true" Min="-32768"/>
+ <IntegerParameter Name="defaultMaxS16" Size="16" Signed="true" Max="32767"/>
+ <IntegerParameter Name="defaultMinU16" Size="16" Signed="false" Min="0"/>
+ <IntegerParameter Name="defaultMaxU16" Size="16" Signed="false" Max="65535"/>
+ <IntegerParameter Name="defaultMinS32" Size="32" Signed="true" Min="-2147483648"/>
+ <IntegerParameter Name="defaultMaxS32" Size="32" Signed="true" Max="2147483647"/>
+ <IntegerParameter Name="defaultMinU32" Size="32" Signed="false" Min="0"/>
+ <IntegerParameter Name="defaultMaxU32" Size="32" Signed="false" Max="4294967295"/>)"};
+const auto &invalidIntegerParameters = Tests<string>{
+ {"invalid Size(64)", "<IntegerParameter Name='error' Size='64'/>"},
+ {"minimum > maximum", "<IntegerParameter Name='error' Min='1' Max='0'/>"},
+ {"S8 minimum > MaxRange", "<IntegerParameter Name='error' Size='8' Signed='true' Min='128'/>"},
+ {"S8 minimum < MinRange", "<IntegerParameter Name='error' Size='8' Signed='true' Min='-129'/>"},
+ {"S8 maximum > MaxRange", "<IntegerParameter Name='error' Size='8' Signed='true' Max='128'/>"},
+ {"S8 maximum < MinRange", "<IntegerParameter Name='error' Size='8' Signed='true' Max='-129'/>"},
+ {"U8 minimum > MaxRange", "<IntegerParameter Name='error' Size='8' Signed='false' Min='256'/>"},
+ {"U8 maximum > MaxRange", "<IntegerParameter Name='error' Size='8' Signed='false' Max='256'/>"},
+ {"S16 minimum > MaxRange",
+ "<IntegerParameter Name='error' Size='16' Signed='true' Min='32768'/>"},
+ {"S16 minimum < MinRange",
+ "<IntegerParameter Name='error' Size='16' Signed='true' Min='-32769'/>"},
+ {"S16 maximum > MaxRange",
+ "<IntegerParameter Name='error' Size='16' Signed='true' Max='32768'/>"},
+ {"S16 maximum < MinRange",
+ "<IntegerParameter Name='error' Size='16' Signed='true' Max='-32769'/>"},
+ {"U16 minimum > MaxRange",
+ "<IntegerParameter Name='error' Size='16' Signed='false' Min='65536'/>"},
+ {"U16 maximum > MaxRange",
+ "<IntegerParameter Name='error' Size='16' Signed='false' Max='65536'/>"}};
+
+struct IntegerPF : public ParameterFramework
+{
+ IntegerPF() : ParameterFramework{std::move(validIntegerInstances)} {}
+};
+
+SCENARIO_METHOD(LazyPF, "Invalid Integer types XML structure", "[Integer types]")
+{
+ for (auto &vec : invalidIntegerParameters) {
+ GIVEN ("intentional error: " + vec.title) {
+ create(Config{&Config::instances, vec.payload});
+ THEN ("Start should fail") {
+ CHECK_THROWS_AS(mPf->start(), Exception);
+ }
+ }
+ }
+}
+
+SCENARIO_METHOD(IntegerPF, "Integer types", "[Integer types]")
+{
+ GIVEN ("A valid XML structure file") {
+ THEN ("Start should succeed") {
+ CHECK_NOTHROW(start());
+ REQUIRE_NOTHROW(setTuningMode(true));
+ string path = "/test/test/nominal";
+
+ AND_THEN ("Set/Get a integer type parameter in real value space") {
+
+ for (auto &vec : Tests<string>{
+ {"(too high)", "13"}, {"(too low)", "-51"}, {"(not a number)", "foobar"},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "12"}, {"(lower limit)", "-50"}, {"(inside range)", "0"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get a integer type parameter in raw value space") {
+ REQUIRE_NOTHROW(setRawValueSpace(true));
+ REQUIRE_NOTHROW(setHexOutputFormat(true));
+
+ for (auto &vec : Tests<string>{
+ {"(too high)", "0x0D"}, {"(too low)", "0xCD"},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "0x0C"},
+ {"(lower limit)", "0xCE"},
+ {"(inside range)", "0x00"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get integer type parameter handle") {
+ ElementHandle handle{*this, path};
+ /** @FIXME: 'set' operations on a ParameterHandle are silently
+ * ignored in tuning mode. Does it make sense ? */
+ REQUIRE_NOTHROW(setTuningMode(false));
+
+ for (auto &vec : Tests<int32_t>{
+ {"(upper limit)", 12}, {"(lower limit)", -50}, {"(inside range)", 0},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(handle.setAsSignedInteger(vec.payload));
+ int32_t getValueBack;
+ REQUIRE_NOTHROW(handle.getAsSignedInteger(getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ for (auto &vec : Tests<int32_t>{
+ {"(too high)", 13}, {"(too low)", -51},
+ }) {
+ GIVEN ("An invalid value " + vec.title) {
+ CHECK_THROWS_AS(handle.setAsSignedInteger(vec.payload), Exception);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get double type parameter handle") {
+ ElementHandle handle{*this, path};
+ /** @FIXME: 'set' operations on a ParameterHandle are silently
+ * ignored in tuning mode. Does it make sense ? */
+ REQUIRE_NOTHROW(setTuningMode(false));
+
+ for (auto &vec : Tests<double>{
+ {"(upper limit)", 12.0f},
+ {"(lower limit)", -50.0f},
+ {"(inside range)", 0.0f},
+ }) {
+ GIVEN ("A valid value (rejected not supported)" + vec.title) {
+ CHECK_THROWS_AS(handle.setAsDouble(vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<double>{
+ {"(too high)", 12.01f}, {"(too low)", -50.01f},
+ }) {
+ GIVEN ("An invalid value " + vec.title) {
+ CHECK_THROWS_AS(handle.setAsDouble(vec.payload), Exception);
+ }
+ }
+ }
+ }
+ }
+}
+}
diff --git a/upstream/test/functional-tests/Linear.cpp b/upstream/test/functional-tests/Linear.cpp
new file mode 100644
index 0000000..363567c
--- /dev/null
+++ b/upstream/test/functional-tests/Linear.cpp
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2017, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Config.hpp"
+#include "ParameterFramework.hpp"
+#include "ElementHandle.hpp"
+#include "Test.hpp"
+#include "BinaryCopy.hpp"
+
+#include <catch.hpp>
+
+#include <string>
+
+using std::string;
+
+namespace parameterFramework
+{
+
+const auto validLinearInstances = Config{
+ &Config::instances,
+ // Size is fixed at 32 and as such is optional */
+ R"(<IntegerParameter Name="trivial" Signed="true"> <LinearAdaptation SlopeNumerator="200" SlopeDenominator="10"/> </IntegerParameter>
+ <IntegerParameter Name="nominal" Size="32" Signed="true" Min="-1440" Max="300"> <LinearAdaptation SlopeNumerator="10" SlopeDenominator="100"/> </IntegerParameter>)"};
+const auto &invalidLinearParameters = Tests<string>{
+ {"invalid Size(64)", "<IntegerParameter Name='nominal' Size='64' Signed='true' Min='-144' "
+ "Max='30'> <LinearAdaptation SlopeNumerator='200' SlopeDenominator='10'/> "
+ "</IntegerParameter>"},
+ {"minimum > maximum", "<IntegerParameter Name='nominal' Size='32' Signed='true' Min='30' "
+ "Max='-144'> <LinearAdaptation SlopeNumerator='1' "
+ "SlopeDenominator='10'/> </IntegerParameter>"},
+ {"SlopeDenominator=0",
+ "<IntegerParameter Name='nominal' Size='32' Signed='true' Min='-144' Max='30'> "
+ "<LinearAdaptation SlopeNumerator='1' SlopeDenominator='0'/> "
+ "</IntegerParameter>"}};
+
+struct LinearsPF : public ParameterFramework
+{
+ LinearsPF() : ParameterFramework{std::move(validLinearInstances)} {}
+};
+
+SCENARIO_METHOD(LazyPF, "Invalid Linear points XML structure", "[Linear Type]")
+{
+ for (auto &vec : invalidLinearParameters) {
+ GIVEN ("intentional error: " + vec.title) {
+ create(Config{&Config::instances, vec.payload});
+ THEN ("Start should fail") {
+ CHECK_THROWS_AS(mPf->start(), Exception);
+ }
+ }
+ }
+}
+
+SCENARIO_METHOD(LinearsPF, "Linear points", "[Linear Type]")
+{
+ GIVEN ("A valid XML structure file") {
+ THEN ("Start should succeed") {
+ CHECK_NOTHROW(start());
+ REQUIRE_NOTHROW(setTuningMode(true));
+ string path = "/test/test/nominal";
+ AND_THEN ("Set/Get a Loagaritmic point parameter in real value space") {
+
+ for (auto &vec : Tests<string>{
+ {"(too high)", "301"},
+ {"(too low)", "-1441"},
+ {"(not a number)", "foobar"},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "300"},
+ {"(lower limit)", "-1440"},
+ {"(inside range)", "0"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack = "-11";
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+
+ AND_THEN ("Set/Get double type parameter handle") {
+ ElementHandle handle{*this, path};
+ /** @FIXME: 'set' operations on a ParameterHandle are silently
+ * ignored in tuning mode. Does it make sense ? */
+ REQUIRE_NOTHROW(setTuningMode(false));
+ REQUIRE_NOTHROW(setRawValueSpace(true));
+
+ /* nominal is defined as a Num=10,Denum=100 (division by 10). So limits should be 10
+ * above Mina dn Max Integer value in order to get exception. */
+ for (auto &vec : Tests<double>{
+ {"(upper limit)", 3000.0f},
+ {"(lower limit)", -14400.0f},
+ {"(inside range)", 0.0f},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(handle.setAsDouble(vec.payload));
+ double getValueBack = 1.0f;
+ REQUIRE_NOTHROW(handle.getAsDouble(getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ for (auto &vec : Tests<double>{
+ {"(too high)", 3010.0f}, {"(too low)", -14410.00f},
+ }) {
+ GIVEN ("An invalid value " + vec.title) {
+ CHECK_THROWS_AS(handle.setAsDouble(vec.payload), Exception);
+ }
+ }
+ }
+ }
+ }
+}
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/Logarithmic.cpp b/upstream/test/functional-tests/Logarithmic.cpp
new file mode 100644
index 0000000..137338e
--- /dev/null
+++ b/upstream/test/functional-tests/Logarithmic.cpp
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Config.hpp"
+#include "ParameterFramework.hpp"
+#include "ElementHandle.hpp"
+#include "Test.hpp"
+#include "BinaryCopy.hpp"
+
+#include <catch.hpp>
+
+#include <string>
+
+using std::string;
+
+namespace parameterFramework
+{
+
+const auto validLogarithmicInstances = Config{
+ &Config::instances,
+ // Size is fixed at 32 and as such is optional */
+ R"(<IntegerParameter Name="trivial" Signed="true"> <LogarithmicAdaptation SlopeNumerator="200" LogarithmBase="10"/> </IntegerParameter>
+ <IntegerParameter Name="nominal" Size="32" Signed="true" Min="-144" Max="30"> <LogarithmicAdaptation SlopeNumerator="1" LogarithmBase="10"/> </IntegerParameter>)"};
+const auto &invalidLogarithmicParameters = Tests<string>{
+ {"invalid Size(64)", "<IntegerParameter Name='nominal' Size='64' Signed='true' Min='-144' "
+ "Max='30'> <LogarithmicAdaptation SlopeNumerator='1' LogarithmBase='10'/> "
+ "</IntegerParameter>"},
+ {"minimum > maximum", "<IntegerParameter Name='nominal' Size='32' Signed='true' Min='30' "
+ "Max='-144'> <LogarithmicAdaptation SlopeNumerator='1' "
+ "LogarithmBase='10'/> </IntegerParameter>"},
+ {"logBase =1", "<IntegerParameter Name='nominal' Size='32' Signed='true' Min='-144' Max='30'> "
+ "<LogarithmicAdaptation SlopeNumerator='1' LogarithmBase='1'/> "
+ "</IntegerParameter>"},
+ {"logBase negative", "<IntegerParameter Name='nominal' Size='32' Signed='true' Min='-144' "
+ "Max='30'> <LogarithmicAdaptation SlopeNumerator='1' "
+ "LogarithmBase='-10'/> </IntegerParameter>"}};
+
+struct LogarithmicsPF : public ParameterFramework
+{
+ LogarithmicsPF() : ParameterFramework{std::move(validLogarithmicInstances)} {}
+};
+
+SCENARIO_METHOD(LazyPF, "Invalid Logarithmic points XML structure", "[Logarithmic Type]")
+{
+ for (auto &vec : invalidLogarithmicParameters) {
+ GIVEN ("intentional error: " + vec.title) {
+ create(Config{&Config::instances, vec.payload});
+ THEN ("Start should fail") {
+ CHECK_THROWS_AS(mPf->start(), Exception);
+ }
+ }
+ }
+}
+
+SCENARIO_METHOD(LogarithmicsPF, "Logarithmic points", "[Logarithmic Type]")
+{
+ GIVEN ("A valid XML structure file") {
+ THEN ("Start should succeed") {
+ CHECK_NOTHROW(start());
+ REQUIRE_NOTHROW(setTuningMode(true));
+ string path = "/test/test/nominal";
+ AND_THEN ("Set/Get a Loagaritmic point parameter in real value space") {
+
+ for (auto &vec : Tests<string>{
+ {"(too high)", "31"}, {"(too low)", "-145"}, {"(not a number)", "foobar"},
+ }) {
+ GIVEN ("Invalid value " + vec.title) {
+ CHECK_THROWS_AS(setParameter(path, vec.payload), Exception);
+ }
+ }
+ for (auto &vec : Tests<string>{
+ {"(upper limit)", "30"},
+ {"(lower limit)", "-144"},
+ {"(inside range)", "0"},
+ }) {
+ GIVEN ("A valid value " + vec.title) {
+ CHECK_NOTHROW(setParameter(path, vec.payload));
+ string getValueBack;
+ REQUIRE_NOTHROW(getParameter(path, getValueBack));
+ CHECK(getValueBack == vec.payload);
+ }
+ }
+ }
+ }
+ }
+}
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/include/Config.hpp b/upstream/test/functional-tests/include/Config.hpp
index 3d3f117..3f80290 100644
--- a/upstream/test/functional-tests/include/Config.hpp
+++ b/upstream/test/functional-tests/include/Config.hpp
@@ -79,4 +79,4 @@
std::string subsystemType = "Virtual";
};
-} // parameterFramework
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/include/ConfigFiles.hpp b/upstream/test/functional-tests/include/ConfigFiles.hpp
index 3d14b86..2aa7107 100644
--- a/upstream/test/functional-tests/include/ConfigFiles.hpp
+++ b/upstream/test/functional-tests/include/ConfigFiles.hpp
@@ -124,4 +124,4 @@
utility::TmpFile mConfigFile;
};
-} // parameterFramework
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/include/ElementHandle.hpp b/upstream/test/functional-tests/include/ElementHandle.hpp
index fe42b71..335ac67 100644
--- a/upstream/test/functional-tests/include/ElementHandle.hpp
+++ b/upstream/test/functional-tests/include/ElementHandle.hpp
@@ -76,6 +76,9 @@
/** Wrap EH::getAsDouble to throw an exception on failure. */
void getAsDouble(double &value) const { mayFailCall(&EH::getAsDouble, value); }
+ void setAsBoolean(bool value) { mayFailCall(&EH::setAsBoolean, value); }
+ void getAsBoolean(bool &value) const { mayFailCall(&EH::getAsBoolean, value); }
+
void setAsInteger(uint32_t value) { mayFailCall(&EH::setAsInteger, value); }
void getAsInteger(uint32_t &value) const { mayFailCall(&EH::getAsInteger, value); }
void setAsIntegerArray(const std::vector<uint32_t> &value)
@@ -112,4 +115,4 @@
void setAsBytes(const std::vector<uint8_t> &settings) { mayFailSet(&EH::setAsBytes, settings); }
};
-} // parameterFramework
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/include/Exception.hpp b/upstream/test/functional-tests/include/Exception.hpp
index 8ae0597..d9e0658 100644
--- a/upstream/test/functional-tests/include/Exception.hpp
+++ b/upstream/test/functional-tests/include/Exception.hpp
@@ -41,4 +41,4 @@
using std::runtime_error::runtime_error;
};
-} // parameterFramework
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/include/FailureWrapper.hpp b/upstream/test/functional-tests/include/FailureWrapper.hpp
index 753e1dc..41c643a 100644
--- a/upstream/test/functional-tests/include/FailureWrapper.hpp
+++ b/upstream/test/functional-tests/include/FailureWrapper.hpp
@@ -133,4 +133,4 @@
return res;
}
};
-} // parameterFramework
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/include/ParameterFramework.hpp b/upstream/test/functional-tests/include/ParameterFramework.hpp
index f6f36a8..207733c 100644
--- a/upstream/test/functional-tests/include/ParameterFramework.hpp
+++ b/upstream/test/functional-tests/include/ParameterFramework.hpp
@@ -170,4 +170,4 @@
friend class ElementHandle;
};
-} // parameterFramework
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/include/StoreLogger.hpp b/upstream/test/functional-tests/include/StoreLogger.hpp
index 8364157..1943a99 100644
--- a/upstream/test/functional-tests/include/StoreLogger.hpp
+++ b/upstream/test/functional-tests/include/StoreLogger.hpp
@@ -70,7 +70,7 @@
const Logs &getLogs() const { return logs; }
- const Logs filter(Log::Level level) const
+ Logs filter(Log::Level level) const
{
return filter([&level](const Log &log) { return log.level == level; });
};
@@ -115,4 +115,4 @@
return os << log.level << log.msg << std::endl;
}
-} // parameterFramework
+} // namespace parameterFramework
diff --git a/upstream/test/functional-tests/include/Test.hpp b/upstream/test/functional-tests/include/Test.hpp
index 51f397a..bdc6ca7 100644
--- a/upstream/test/functional-tests/include/Test.hpp
+++ b/upstream/test/functional-tests/include/Test.hpp
@@ -128,4 +128,4 @@
setFailureOnFailedSettingsLoad(false);
}
};
-}
+} // namespace parameterFramework
diff --git a/upstream/test/introspection-subsystem/CMakeLists.txt b/upstream/test/introspection-subsystem/CMakeLists.txt
index faccab3..b59be40 100644
--- a/upstream/test/introspection-subsystem/CMakeLists.txt
+++ b/upstream/test/introspection-subsystem/CMakeLists.txt
@@ -52,7 +52,7 @@
#
# Note : headers located in root project directory remain private.
target_include_directories(introspection-subsystem
- PUBLIC "include" "${CMAKE_CURRENT_BINARY_DIR}")
+ PUBLIC "include")
- target_link_libraries(introspection-subsystem PRIVATE parameter)
+ target_link_libraries(introspection-subsystem PRIVATE plugin-internal-hack)
endif()
diff --git a/upstream/test/introspection-subsystem/IntrospectionEntryPoint.cpp b/upstream/test/introspection-subsystem/IntrospectionEntryPoint.cpp
index b26e938..b5028be 100644
--- a/upstream/test/introspection-subsystem/IntrospectionEntryPoint.cpp
+++ b/upstream/test/introspection-subsystem/IntrospectionEntryPoint.cpp
@@ -40,5 +40,5 @@
{
return SubsystemObject::getSingletonInstanceValue();
}
-}
-}
+} // namespace introspectionSubsystem
+} // namespace parameterFramework
diff --git a/upstream/test/introspection-subsystem/IntrospectionSubsystem.cpp b/upstream/test/introspection-subsystem/IntrospectionSubsystem.cpp
index 7c3e945..450e052 100644
--- a/upstream/test/introspection-subsystem/IntrospectionSubsystem.cpp
+++ b/upstream/test/introspection-subsystem/IntrospectionSubsystem.cpp
@@ -41,5 +41,5 @@
{
addSubsystemObjectFactory(new TSubsystemObjectFactory<SubsystemObject>("Object", 0));
}
-}
-}
+} // namespace introspectionSubsystem
+} // namespace parameterFramework
diff --git a/upstream/test/introspection-subsystem/IntrospectionSubsystem.h b/upstream/test/introspection-subsystem/IntrospectionSubsystem.h
index 1f89841..76abd26 100644
--- a/upstream/test/introspection-subsystem/IntrospectionSubsystem.h
+++ b/upstream/test/introspection-subsystem/IntrospectionSubsystem.h
@@ -46,5 +46,5 @@
private:
using base = CSubsystem;
};
-}
-}
+} // namespace introspectionSubsystem
+} // namespace parameterFramework
diff --git a/upstream/test/introspection-subsystem/IntrospectionSubsystemObject.cpp b/upstream/test/introspection-subsystem/IntrospectionSubsystemObject.cpp
index 2a05981..3e5ea37 100644
--- a/upstream/test/introspection-subsystem/IntrospectionSubsystemObject.cpp
+++ b/upstream/test/introspection-subsystem/IntrospectionSubsystemObject.cpp
@@ -79,5 +79,5 @@
blackboardRead(&mParameter, parameterSize);
return true;
}
-}
-}
+} // namespace introspectionSubsystem
+} // namespace parameterFramework
diff --git a/upstream/test/introspection-subsystem/IntrospectionSubsystemObject.h b/upstream/test/introspection-subsystem/IntrospectionSubsystemObject.h
index f91f686..ab21cb9 100644
--- a/upstream/test/introspection-subsystem/IntrospectionSubsystemObject.h
+++ b/upstream/test/introspection-subsystem/IntrospectionSubsystemObject.h
@@ -85,5 +85,5 @@
bool mParameter;
};
-}
-}
+} // namespace introspectionSubsystem
+} // namespace parameterFramework
diff --git a/upstream/test/introspection-subsystem/include/IntrospectionEntryPoint.h b/upstream/test/introspection-subsystem/include/IntrospectionEntryPoint.h
index ce3e22c..84dc71b 100644
--- a/upstream/test/introspection-subsystem/include/IntrospectionEntryPoint.h
+++ b/upstream/test/introspection-subsystem/include/IntrospectionEntryPoint.h
@@ -36,6 +36,15 @@
namespace introspectionSubsystem
{
+#ifdef __cplusplus
+extern "C" {
+#endif
+
INTROSPECTION_SUBSYSTEM_EXPORT bool getParameterValue();
+
+#ifdef __cplusplus
}
-}
+#endif
+
+} // namespace introspectionSubsystem
+} // namespace parameterFramework
diff --git a/upstream/test/test-platform/CMakeLists.txt b/upstream/test/test-platform/CMakeLists.txt
index 533de3c..5c54b4a 100644
--- a/upstream/test/test-platform/CMakeLists.txt
+++ b/upstream/test/test-platform/CMakeLists.txt
@@ -36,5 +36,5 @@
# Workaround because asio is still leaking to test-platform
target_link_libraries(test-platform PRIVATE asio)
- install(TARGETS test-platform RUNTIME DESTINATION bin)
+ install(TARGETS test-platform RUNTIME DESTINATION bin COMPONENT eng)
endif()
diff --git a/upstream/test/test-platform/TestPlatform.cpp b/upstream/test/test-platform/TestPlatform.cpp
index e022131..d090939 100644
--- a/upstream/test/test-platform/TestPlatform.cpp
+++ b/upstream/test/test-platform/TestPlatform.cpp
@@ -38,8 +38,8 @@
using std::string;
-CTestPlatform::CTestPlatform(const string &strClass, uint16_t iPortNumber)
- : mParameterMgrPlatformConnector(strClass), mLogger(), mRemoteProcessorServer(iPortNumber)
+CTestPlatform::CTestPlatform(const string &strClass, std::string bindAddress)
+ : mParameterMgrPlatformConnector(strClass), mLogger(), mRemoteProcessorServer(bindAddress)
{
mParameterMgrPlatformConnector.setLogger(&mLogger);
}
@@ -156,9 +156,9 @@
CTestPlatform::CommandReturn CTestPlatform::createExclusiveSelectionCriterion(
const IRemoteCommand &remoteCommand, string &strResult)
{
- return createExclusiveSelectionCriterion(remoteCommand.getArgument(0),
- strtoul(remoteCommand.getArgument(1).c_str(), NULL, 0),
- strResult)
+ return createExclusiveSelectionCriterion(
+ remoteCommand.getArgument(0),
+ strtoul(remoteCommand.getArgument(1).c_str(), nullptr, 0), strResult)
? CTestPlatform::CCommandHandler::EDone
: CTestPlatform::CCommandHandler::EFailed;
}
@@ -166,9 +166,9 @@
CTestPlatform::CommandReturn CTestPlatform::createInclusiveSelectionCriterion(
const IRemoteCommand &remoteCommand, string &strResult)
{
- return createInclusiveSelectionCriterion(remoteCommand.getArgument(0),
- strtoul(remoteCommand.getArgument(1).c_str(), NULL, 0),
- strResult)
+ return createInclusiveSelectionCriterion(
+ remoteCommand.getArgument(0),
+ strtoul(remoteCommand.getArgument(1).c_str(), nullptr, 0), strResult)
? CTestPlatform::CCommandHandler::EDone
: CTestPlatform::CCommandHandler::EFailed;
}
@@ -258,7 +258,7 @@
ISelectionCriterionTypeInterface *pCriterionType =
mParameterMgrPlatformConnector.createSelectionCriterionType(false);
- assert(pCriterionType != NULL);
+ assert(pCriterionType != nullptr);
size_t nbStates = remoteCommand.getArgumentCount() - 1;
@@ -286,7 +286,7 @@
ISelectionCriterionTypeInterface *pCriterionType =
mParameterMgrPlatformConnector.createSelectionCriterionType(true);
- assert(pCriterionType != NULL);
+ assert(pCriterionType != nullptr);
size_t nbStates = remoteCommand.getArgumentCount() - 1;
diff --git a/upstream/test/test-platform/TestPlatform.h b/upstream/test/test-platform/TestPlatform.h
index f9c27f7..8917dbb 100644
--- a/upstream/test/test-platform/TestPlatform.h
+++ b/upstream/test/test-platform/TestPlatform.h
@@ -45,7 +45,7 @@
typedef CCommandHandler::CommandStatus CommandReturn;
public:
- CTestPlatform(const std::string &strclass, uint16_t iPortNumber);
+ CTestPlatform(const std::string &strclass, std::string bindAddress);
virtual ~CTestPlatform();
// Init
diff --git a/upstream/test/test-platform/main.cpp b/upstream/test/test-platform/main.cpp
index 6cb5267..f09fcba 100644
--- a/upstream/test/test-platform/main.cpp
+++ b/upstream/test/test-platform/main.cpp
@@ -41,11 +41,11 @@
using std::endl;
using std::string;
-static const uint16_t defaultPortNumber = 5001;
+static const std::string defaultBindAddress("5001");
static void showUsage()
{
- cerr << "test-platform [-h|--help] <file path> [port number, default " << defaultPortNumber
+ cerr << "test-platform [-h|--help] <file path> [bind address, default " << defaultBindAddress
<< "]" << endl;
}
@@ -86,26 +86,22 @@
auto filePath = options.front();
options.pop_front();
- // Handle optional port number argument
- uint16_t portNumber = defaultPortNumber;
+ // Handle optional bind address argument
+ auto bindAddress = defaultBindAddress;
if (not options.empty()) {
- if (not convertTo(options.front(), portNumber)) {
- showInvalidUsage("Could not convert \"" + options.front() +
- "\" to a socket port number.");
- return 2;
- };
+ bindAddress = options.front();
options.pop_front();
}
// All arguments should have been consumed
if (not options.empty()) {
showInvalidUsage("Unexpected extra arguments: " + utility::asString(options));
- return 3;
+ return 2;
}
string strError;
- if (!CTestPlatform(filePath, portNumber).run(strError)) {
+ if (!CTestPlatform(filePath, bindAddress).run(strError)) {
cerr << "Test-platform error:" << strError.c_str() << endl;
return -1;
diff --git a/upstream/test/test-subsystem/CMakeLists.txt b/upstream/test/test-subsystem/CMakeLists.txt
index eeaa7de..e5e752b 100644
--- a/upstream/test/test-subsystem/CMakeLists.txt
+++ b/upstream/test/test-subsystem/CMakeLists.txt
@@ -35,5 +35,5 @@
TESTSubsystemString.cpp
TESTSubsystemBuilder.cpp)
- target_link_libraries(test-subsystem PRIVATE parameter)
+ target_link_libraries(test-subsystem PRIVATE plugin-internal-hack)
endif()
diff --git a/upstream/test/test-subsystem/TESTSubsystem.cpp b/upstream/test/test-subsystem/TESTSubsystem.cpp
index 473d923..5a1f0e5 100644
--- a/upstream/test/test-subsystem/TESTSubsystem.cpp
+++ b/upstream/test/test-subsystem/TESTSubsystem.cpp
@@ -60,14 +60,14 @@
// Susbsystem sanity health
bool CTESTSubsystem::isAlive() const
{
- assert(gacFwNamePropName != NULL);
+ assert(gacFwNamePropName != nullptr);
return read(std::string(gacFwNamePropName) + "/isAlive") == "true";
}
// Resynchronization after subsystem restart needed
bool CTESTSubsystem::needResync(bool bClear)
{
- assert(gacFwNamePropName != NULL);
+ assert(gacFwNamePropName != nullptr);
std::string strNeedResyncFile = std::string(gacFwNamePropName) + "/needResync";
bool bNeedResync;
diff --git a/upstream/test/tmpfile/CMakeLists.txt b/upstream/test/tmpfile/CMakeLists.txt
index 84818e7..1975f3a 100644
--- a/upstream/test/tmpfile/CMakeLists.txt
+++ b/upstream/test/tmpfile/CMakeLists.txt
@@ -34,5 +34,9 @@
endif ()
add_library(tmpfile STATIC ${OS_SPECIFIC_TMPFILE})
- target_include_directories(tmpfile PUBLIC .)
+
+ if (NOT WIN32)
+ target_compile_definitions(tmpfile PUBLIC -D RW_PATH=\"\")
+ endif ()
+
endif()
diff --git a/upstream/test/tmpfile/TmpFile.hpp b/upstream/test/tmpfile/TmpFile.hpp
index ebefa93..edde7f2 100644
--- a/upstream/test/tmpfile/TmpFile.hpp
+++ b/upstream/test/tmpfile/TmpFile.hpp
@@ -102,5 +102,5 @@
std::string mPath;
};
-} // utility
-} // parameterFramework
+} // namespace utility
+} // namespace parameterFramework
diff --git a/upstream/test/tmpfile/posix/TmpFile.cpp b/upstream/test/tmpfile/posix/TmpFile.cpp
index 36efbd6..59fe441 100644
--- a/upstream/test/tmpfile/posix/TmpFile.cpp
+++ b/upstream/test/tmpfile/posix/TmpFile.cpp
@@ -42,7 +42,7 @@
{
using std::string;
- char path[] = "Tmp_ParameterFramework_XXXXXX";
+ char path[] = RW_PATH "Tmp_ParameterFramework_XXXXXX";
int fd = mkstemp(path);
if (fd == -1) {
throwErrnoError("Could not create tmp file with pattern \"" + string(path) + '"');
@@ -53,5 +53,5 @@
return path;
}
-} // utility
-} // parameterFramework
+} // namespace utility
+} // namespace parameterFramework
diff --git a/upstream/tools/bash_completion/CMakeLists.txt b/upstream/tools/bash_completion/CMakeLists.txt
index f2fb491..435ee69 100644
--- a/upstream/tools/bash_completion/CMakeLists.txt
+++ b/upstream/tools/bash_completion/CMakeLists.txt
@@ -27,4 +27,5 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
install(FILES remote-process
- DESTINATION share/bash-completion/completions/)
+ DESTINATION share/bash-completion/completions/
+ COMPONENT eng)
diff --git a/upstream/tools/clientSimulator/CMakeLists.txt b/upstream/tools/clientSimulator/CMakeLists.txt
index 299bfc6..4848d27 100644
--- a/upstream/tools/clientSimulator/CMakeLists.txt
+++ b/upstream/tools/clientSimulator/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Intel Corporation
+# Copyright (c) 2015-2017, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
@@ -26,27 +26,25 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# has been tested on 2.8.11 only - should not work on older versions
-cmake_minimum_required(VERSION 2.8.11)
-
-project(parameter-framework-clientSimulator)
-
-# Force usage of Python 3.x ...
-find_package(PythonInterp 3 REQUIRED)
-# ... and force the libs to be at the same version as the interpreter
-find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT REQUIRED)
-include_directories(${PYTHON_INCLUDE_DIRS})
+# Force usage of Python 3.x; here, we use find_program instead of find_package
+# because other parts of Parameter Framework request Python 2.x and CMake has
+# troubles with the cohabitation.
+find_program(PYTHON3 python3 REQUIRED)
# Find the python modules install path.
# plat_specific is needed because we are installing a shared-library python
# module and not only a pure python module.
# prefix='' makes get_python_lib return a relative path.
execute_process(COMMAND
- ${PYTHON_EXECUTABLE} -c
+ ${PYTHON3} -c
"from distutils import sysconfig;\\
print(sysconfig.get_python_lib(plat_specific=True, prefix=''))"
OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
-install(DIRECTORY clientsimulator DESTINATION ${PYTHON_MODULE_PATH})
+install(DIRECTORY clientsimulator
+ DESTINATION ${PYTHON_MODULE_PATH}
+ COMPONENT client_simulator)
-install(PROGRAMS pfClientSimulator.py DESTINATION bin)
+install(PROGRAMS pfClientSimulator.py
+ DESTINATION bin
+ COMPONENT client_simulator)
diff --git a/upstream/tools/xmlGenerator/CMakeLists.txt b/upstream/tools/xmlGenerator/CMakeLists.txt
index 72d1d95..a3567c5 100644
--- a/upstream/tools/xmlGenerator/CMakeLists.txt
+++ b/upstream/tools/xmlGenerator/CMakeLists.txt
@@ -29,7 +29,7 @@
add_executable(domainGeneratorConnector domainGeneratorConnector.cpp)
target_link_libraries(domainGeneratorConnector PRIVATE parameter pfw_utility)
-install(TARGETS domainGeneratorConnector RUNTIME DESTINATION bin)
+install(TARGETS domainGeneratorConnector RUNTIME DESTINATION bin COMPONENT eng)
install(PROGRAMS
domainGenerator.sh
@@ -40,4 +40,5 @@
EddParser.py
PFWScriptGenerator.py
updateRoutageDomains.sh
- DESTINATION bin)
+ DESTINATION bin
+ COMPONENT eng)
diff --git a/upstream/tools/xmlGenerator/EddParser.py b/upstream/tools/xmlGenerator/EddParser.py
index 97a59a7..7f8a5b9 100755
--- a/upstream/tools/xmlGenerator/EddParser.py
+++ b/upstream/tools/xmlGenerator/EddParser.py
@@ -34,8 +34,12 @@
import re
import sys
import copy
-from itertools import izip
-from itertools import imap
+# For Python 2.x/3.x compatibility
+try:
+ from itertools import izip as zip
+ from itertools import imap as map
+except:
+ pass
# =====================================================================
""" Context classes, used during propagation and the "to PFW script" step """
@@ -113,13 +117,13 @@
class Options () :
"""handle element options"""
def __init__(self, options=[], optionNames=[]) :
- self.options = dict(izip(optionNames, options))
+ self.options = dict(zip(optionNames, options))
# print(options,optionNames,self.options)
def __str__(self) :
ops2str = []
- for name, argument in self.options.items() :
+ for name, argument in list(self.options.items()) :
ops2str.append(str(name) + "=\"" + str(argument) + "\"")
return " ".join(ops2str)
@@ -176,7 +180,7 @@
options = line.split(self.optionDelimiter, len(self.optionNames) - 1)
# get ride of leftover spaces
- optionsStrip = list(imap(str.strip, options))
+ optionsStrip = list(map(str.strip, options))
return optionsStrip
@@ -877,12 +881,12 @@
context.append(myelement)
context[-2].addChild(myelement)
- except MySyntaxWarning, ex:
+ except MySyntaxWarning as ex:
ex.setLine(line, num + 1)
if verbose :
- print >>sys.stderr, ex
+ sys.stderr.write("{}\n".format(ex))
- except MySyntaxError, ex :
+ except MySyntaxError as ex :
ex.setLine(line, num + 1)
raise
diff --git a/upstream/tools/xmlGenerator/PFWScriptGenerator.py b/upstream/tools/xmlGenerator/PFWScriptGenerator.py
index f43e317..145295d 100755
--- a/upstream/tools/xmlGenerator/PFWScriptGenerator.py
+++ b/upstream/tools/xmlGenerator/PFWScriptGenerator.py
@@ -133,7 +133,7 @@
try:
myroot.propagate()
- except EddParser.MyPropagationError, ex :
+ except EddParser.MyPropagationError as ex :
printE(ex)
printE("EXIT ON FAILURE")
exit(1)
diff --git a/upstream/tools/xmlGenerator/domainGenerator.py b/upstream/tools/xmlGenerator/domainGenerator.py
index 0fade85..12a26f1 100755
--- a/upstream/tools/xmlGenerator/domainGenerator.py
+++ b/upstream/tools/xmlGenerator/domainGenerator.py
@@ -140,7 +140,7 @@
try:
root.propagate()
- except EddParser.MyPropagationError, ex :
+ except EddParser.MyPropagationError as ex :
logging.critical(str(ex))
logging.info("EXIT ON FAILURE")
exit(1)
diff --git a/upstream/tools/xmlValidator/CMakeLists.txt b/upstream/tools/xmlValidator/CMakeLists.txt
index f44fed0..536f948 100644
--- a/upstream/tools/xmlValidator/CMakeLists.txt
+++ b/upstream/tools/xmlValidator/CMakeLists.txt
@@ -26,4 +26,4 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-install(PROGRAMS xmlValidator.py DESTINATION bin)
+install(PROGRAMS xmlValidator.py DESTINATION bin COMPONENT eng)
diff --git a/upstream/utility/CMakeLists.txt b/upstream/utility/CMakeLists.txt
index 49e01e2..0350275 100644
--- a/upstream/utility/CMakeLists.txt
+++ b/upstream/utility/CMakeLists.txt
@@ -38,8 +38,6 @@
Utility.cpp
DynamicLibrary.cpp)
-target_include_directories(pfw_utility PUBLIC .)
-
# Needed for linking against shared libraries on Linux (no-op on Windows)
set_target_properties(pfw_utility PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
@@ -48,7 +46,8 @@
ErrorContext.hpp
Utility.h
convert.hpp
- DESTINATION "include/utility")
+ DESTINATION "include/parameter/utility"
+ COMPONENT dev)
if(BUILD_TESTING)
# Add unit test
diff --git a/upstream/utility/PfError.hpp b/upstream/utility/PfError.hpp
new file mode 100644
index 0000000..233cfcb
--- /dev/null
+++ b/upstream/utility/PfError.hpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#pragma once
+
+#include <stdexcept>
+
+struct PfError : public std::runtime_error
+{
+ using std::runtime_error::runtime_error;
+};
diff --git a/upstream/utility/Utility.cpp b/upstream/utility/Utility.cpp
index bf94422..8b476e3 100644
--- a/upstream/utility/Utility.cpp
+++ b/upstream/utility/Utility.cpp
@@ -39,14 +39,6 @@
namespace utility
{
-// Format string list
-std::string asString(const std::list<std::string> &lstr, const std::string &strSeparator)
-{
- return join<std::string>(begin(lstr), end(lstr), [strSeparator](string acc, string right) {
- return acc + strSeparator + right;
- });
-}
-
// Format string map
std::string asString(const std::map<std::string, std::string> &mapStr,
const std::string &strItemSeparator, const std::string &strKeyValueSeparator)
diff --git a/upstream/utility/Utility.h b/upstream/utility/Utility.h
index c32095a..0f2aec3 100644
--- a/upstream/utility/Utility.h
+++ b/upstream/utility/Utility.h
@@ -35,6 +35,7 @@
#include <map>
#include <sstream>
#include <numeric>
+#include <type_traits>
namespace utility
{
@@ -62,15 +63,24 @@
}
/**
-* Format the items of a map into a string as a list of key-value pairs. The map must be
-* composed of pairs of strings.
+* Format the items of a sequence container of strings into a string.
*
+* @tparam Sequence the string sequence container (e.g. list or vector)
* @param[in] lstr A list of strings
* @param[in] separator The separator to use between each item
*
* @return the concatenated elements.
*/
-std::string asString(const std::list<std::string> &lstr, const std::string &separator = "\n");
+template <class Sequence>
+std::string asString(const Sequence &lstr, const std::string &separator = "\n")
+{
+ static_assert(std::is_same<typename Sequence::value_type, std::string>::value,
+ "asString called on a sequence container that does not contains strings");
+
+ return join<std::string>(
+ begin(lstr), end(lstr),
+ [separator](std::string acc, std::string right) { return acc + separator + right; });
+}
/**
* Format the items of a map into a string as a list of key-value pairs. The map must be
@@ -99,4 +109,4 @@
*/
bool isHexadecimal(const std::string &strValue);
-} // utility
+} // namespace utility
diff --git a/upstream/utility/posix/DynamicLibrary.cpp b/upstream/utility/posix/DynamicLibrary.cpp
index 1a3af60..10b5e17 100644
--- a/upstream/utility/posix/DynamicLibrary.cpp
+++ b/upstream/utility/posix/DynamicLibrary.cpp
@@ -44,7 +44,7 @@
if (_handle == nullptr) {
const char *dlError = dlerror();
- throw std::runtime_error((dlError != NULL) ? dlError : "unknown dlopen error");
+ throw std::runtime_error((dlError != nullptr) ? dlError : "unknown dlopen error");
}
}
@@ -60,7 +60,7 @@
if (sym == nullptr) {
const char *dlError = dlerror();
- throw std::runtime_error((dlError != NULL) ? dlError : "unknown dlsym error");
+ throw std::runtime_error((dlError != nullptr) ? dlError : "unknown dlsym error");
}
return sym;
diff --git a/upstream/xmlserializer/CMakeLists.txt b/upstream/xmlserializer/CMakeLists.txt
index 067a00e..ee263a5 100644
--- a/upstream/xmlserializer/CMakeLists.txt
+++ b/upstream/xmlserializer/CMakeLists.txt
@@ -60,16 +60,14 @@
"please install a version of libxml2 supporting it.")
endif()
-target_include_directories(xmlserializer PUBLIC .)
-
target_link_libraries(xmlserializer
PUBLIC pfw_utility # For NonCopyable and ErrorContext
PRIVATE LibXml2::libxml2)
-
install(FILES
XmlSink.h
XmlSource.h
XmlElement.h
XmlSerializingContext.h
- DESTINATION "include/xmlserializer")
+ DESTINATION "include/parameter/xmlserializer"
+ COMPONENT dev)
diff --git a/upstream/xmlserializer/XmlDocSource.cpp b/upstream/xmlserializer/XmlDocSource.cpp
index ed366bf..c4ec5fa 100644
--- a/upstream/xmlserializer/XmlDocSource.cpp
+++ b/upstream/xmlserializer/XmlDocSource.cpp
@@ -61,7 +61,7 @@
if (_pDoc) {
// Free XML doc
xmlFreeDoc(_pDoc);
- _pDoc = NULL;
+ _pDoc = nullptr;
}
}
@@ -110,7 +110,7 @@
bool CXmlDocSource::isParsable() const
{
// Check that the doc has been created
- return _pDoc != NULL;
+ return _pDoc != nullptr;
}
bool CXmlDocSource::populate(CXmlSerializingContext &serializingContext)
@@ -167,7 +167,7 @@
#ifdef LIBXML_SCHEMAS_ENABLED
string schemaUri = getSchemaUri();
- xmlDocPtr pSchemaDoc = xmlReadFile(schemaUri.c_str(), NULL, XML_PARSE_NONET);
+ xmlDocPtr pSchemaDoc = xmlReadFile(schemaUri.c_str(), nullptr, XML_PARSE_NONET);
if (!pSchemaDoc) {
// Unable to load Schema
@@ -233,28 +233,28 @@
_xmlDoc *CXmlDocSource::mkXmlDoc(const string &source, bool fromFile, bool xincludes,
CXmlSerializingContext &serializingContext)
{
- _xmlDoc *doc = NULL;
+ _xmlDoc *doc = nullptr;
if (fromFile) {
- doc = xmlReadFile(source.c_str(), NULL, 0);
+ doc = xmlReadFile(source.c_str(), nullptr, 0);
} else {
- doc = xmlReadMemory(source.c_str(), (int)source.size(), "", NULL, 0);
+ doc = xmlReadMemory(source.c_str(), (int)source.size(), "", nullptr, 0);
}
- if (doc == NULL) {
+ if (doc == nullptr) {
string errorMsg = "libxml failed to read";
if (fromFile) {
errorMsg += " \"" + source + "\"";
}
serializingContext.appendLineToError(errorMsg);
- return NULL;
+ return nullptr;
}
if (xincludes and (xmlXIncludeProcess(doc) < 0)) {
serializingContext.appendLineToError("libxml failed to resolve XIncludes");
xmlFreeDoc(doc);
- doc = NULL;
+ doc = nullptr;
}
return doc;
diff --git a/upstream/xmlserializer/XmlDocSource.h b/upstream/xmlserializer/XmlDocSource.h
index 85b4114..8093a27 100644
--- a/upstream/xmlserializer/XmlDocSource.h
+++ b/upstream/xmlserializer/XmlDocSource.h
@@ -57,7 +57,7 @@
* @param[in] pRootNode a pointer to the root element of the document.
* @param[in] bValidateWithSchema a boolean that toggles schema validation
*/
- CXmlDocSource(_xmlDoc *pDoc, bool bValidateWithSchema = false, _xmlNode *pRootNode = NULL);
+ CXmlDocSource(_xmlDoc *pDoc, bool bValidateWithSchema = false, _xmlNode *pRootNode = nullptr);
/**
* Constructor
diff --git a/upstream/xmlserializer/XmlElement.cpp b/upstream/xmlserializer/XmlElement.cpp
index 902d0d9..e00d08e 100644
--- a/upstream/xmlserializer/XmlElement.cpp
+++ b/upstream/xmlserializer/XmlElement.cpp
@@ -28,9 +28,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "XmlElement.h"
+#include "PfError.hpp"
#include <libxml/tree.h>
#include "convert.hpp"
#include <stdlib.h>
+#include <stdexcept>
using std::string;
@@ -38,7 +40,7 @@
{
}
-CXmlElement::CXmlElement() : _pXmlElement(NULL)
+CXmlElement::CXmlElement() : _pXmlElement(nullptr)
{
}
@@ -73,19 +75,15 @@
bool CXmlElement::hasAttribute(const string &strAttributeName) const
{
- return xmlHasProp(_pXmlElement, (const xmlChar *)strAttributeName.c_str()) != NULL;
+ return xmlHasProp(_pXmlElement, (const xmlChar *)strAttributeName.c_str()) != nullptr;
}
template <>
bool CXmlElement::getAttribute<std::string>(const string &name, string &value) const
{
- if (!hasAttribute(name)) {
- return false;
- }
-
string backup = value;
xmlChar *pucXmlValue = xmlGetProp((xmlNode *)_pXmlElement, (const xmlChar *)name.c_str());
- if (pucXmlValue == NULL) {
+ if (pucXmlValue == nullptr) {
value = backup;
return false;
}
@@ -108,7 +106,7 @@
T backup = value;
if (!convertTo<T>(rawValue, value)) {
value = backup;
- return false;
+ throw PfError("\'" + rawValue + "\' could not be parsed as the requested type.");
}
return true;
@@ -124,7 +122,7 @@
string CXmlElement::getTextContent() const
{
xmlChar *pucXmlContent = xmlNodeGetContent(_pXmlElement);
- if (pucXmlContent == NULL) {
+ if (pucXmlContent == nullptr) {
return "";
}
@@ -234,7 +232,7 @@
void CXmlElement::createChild(CXmlElement &childElement, const string &strType)
{
#ifdef LIBXML_TREE_ENABLED
- xmlNodePtr pChildNode = xmlNewChild(_pXmlElement, NULL, BAD_CAST strType.c_str(), NULL);
+ xmlNodePtr pChildNode = xmlNewChild(_pXmlElement, nullptr, BAD_CAST strType.c_str(), nullptr);
childElement.setXmlElement(pChildNode);
#endif
@@ -264,8 +262,9 @@
return false;
}
-template bool CXmlElement::getAttribute(const std::string &name, std::string &value) const;
template bool CXmlElement::getAttribute(const std::string &name, bool &value) const;
+template bool CXmlElement::getAttribute(const std::string &name, signed char &value) const;
+template bool CXmlElement::getAttribute(const std::string &name, unsigned char &value) const;
template bool CXmlElement::getAttribute(const std::string &name, short &value) const;
template bool CXmlElement::getAttribute(const std::string &name, unsigned short &value) const;
template bool CXmlElement::getAttribute(const std::string &name, int &value) const;
@@ -277,8 +276,8 @@
template bool CXmlElement::getAttribute(const std::string &name, float &value) const;
template bool CXmlElement::getAttribute(const std::string &name, double &value) const;
-template void CXmlElement::setAttribute(const std::string &name, const std::string &value);
-template void CXmlElement::setAttribute(const std::string &name, const bool &value);
+template void CXmlElement::setAttribute(const std::string &name, const signed char &value);
+template void CXmlElement::setAttribute(const std::string &name, const unsigned char &value);
template void CXmlElement::setAttribute(const std::string &name, const short &value);
template void CXmlElement::setAttribute(const std::string &name, const unsigned short &value);
template void CXmlElement::setAttribute(const std::string &name, const int &value);
diff --git a/upstream/xmlserializer/XmlMemoryDocSink.h b/upstream/xmlserializer/XmlMemoryDocSink.h
index b91c2aa..5562878 100644
--- a/upstream/xmlserializer/XmlMemoryDocSink.h
+++ b/upstream/xmlserializer/XmlMemoryDocSink.h
@@ -57,7 +57,8 @@
*
* @return false if any error occurs
*/
- virtual bool doProcess(CXmlDocSource &xmlDocSource, CXmlSerializingContext &serializingContext);
+ bool doProcess(CXmlDocSource &xmlDocSource,
+ CXmlSerializingContext &serializingContext) override;
// Xml Sink
IXmlSink *_pXmlSink;
diff --git a/upstream/xmlserializer/XmlMemoryDocSource.cpp b/upstream/xmlserializer/XmlMemoryDocSource.cpp
index 41b5ef2..37e3551 100644
--- a/upstream/xmlserializer/XmlMemoryDocSource.cpp
+++ b/upstream/xmlserializer/XmlMemoryDocSource.cpp
@@ -39,7 +39,7 @@
const std::string &strProduct,
const std::string &strVersion)
: base(xmlNewDoc(BAD_CAST "1.0"), bValidateWithSchema,
- xmlNewNode(NULL, BAD_CAST strRootElementType.c_str())),
+ xmlNewNode(nullptr, BAD_CAST strRootElementType.c_str())),
_pXmlSource(pXmlSource), _strProduct(strProduct), _strVersion(strVersion)
{
init();
diff --git a/upstream/xmlserializer/XmlMemoryDocSource.h b/upstream/xmlserializer/XmlMemoryDocSource.h
index c8a0d55..be92ca2 100644
--- a/upstream/xmlserializer/XmlMemoryDocSource.h
+++ b/upstream/xmlserializer/XmlMemoryDocSource.h
@@ -61,7 +61,7 @@
*
* @return false if any error occurs
*/
- virtual bool populate(CXmlSerializingContext &serializingContext);
+ bool populate(CXmlSerializingContext &serializingContext) override;
private:
/**
diff --git a/upstream/xmlserializer/XmlSerializingContext.cpp b/upstream/xmlserializer/XmlSerializingContext.cpp
index 4666c54..0b08bab 100644
--- a/upstream/xmlserializer/XmlSerializingContext.cpp
+++ b/upstream/xmlserializer/XmlSerializingContext.cpp
@@ -40,7 +40,7 @@
CXmlSerializingContext::~CXmlSerializingContext()
{
// TODO: restore the previous handler
- xmlSetStructuredErrorFunc(NULL, NULL);
+ xmlSetStructuredErrorFunc(nullptr, nullptr);
prependToError(_strXmlError);
}
@@ -59,7 +59,7 @@
{
CXmlSerializingContext *self = static_cast<CXmlSerializingContext *>(userData);
- std::string filename = (error->file != NULL) ? error->file : "(user input)";
+ std::string filename = (error->file != nullptr) ? error->file : "(user input)";
// xmlErrorPtr->int2 contains the column; see xmlerror.h
self->_strXmlError += filename + ":" + std::to_string(error->line) + ":" +
std::to_string(error->int2) + ": " + error->message;
diff --git a/upstream/xmlserializer/XmlStreamDocSink.cpp b/upstream/xmlserializer/XmlStreamDocSink.cpp
index 4acd089..0cb281e 100644
--- a/upstream/xmlserializer/XmlStreamDocSink.cpp
+++ b/upstream/xmlserializer/XmlStreamDocSink.cpp
@@ -39,7 +39,7 @@
bool CXmlStreamDocSink::doProcess(CXmlDocSource &xmlDocSource,
CXmlSerializingContext &serializingContext)
{
- xmlChar *dumpedDoc = NULL;
+ xmlChar *dumpedDoc = nullptr;
int iSize;
xmlDocDumpFormatMemoryEnc(xmlDocSource.getDoc(), &dumpedDoc, &iSize, "UTF-8", 1);
diff --git a/upstream/xmlserializer/XmlStreamDocSink.h b/upstream/xmlserializer/XmlStreamDocSink.h
index 368505d..32e1e81 100644
--- a/upstream/xmlserializer/XmlStreamDocSink.h
+++ b/upstream/xmlserializer/XmlStreamDocSink.h
@@ -55,7 +55,8 @@
*
* @return false if any error occurs
*/
- virtual bool doProcess(CXmlDocSource &xmlDocSource, CXmlSerializingContext &serializingContext);
+ bool doProcess(CXmlDocSource &xmlDocSource,
+ CXmlSerializingContext &serializingContext) override;
/**
* Result ostream containing the XML informations