You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2018/05/07 07:27:56 UTC
celix git commit: CELIX-426: Fixes some compile issues for gcc
Repository: celix
Updated Branches:
refs/heads/feature/CELIX-426-cxx-api 6f17344c4 -> 0aee10d80
CELIX-426: Fixes some compile issues for gcc
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/0aee10d8
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/0aee10d8
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/0aee10d8
Branch: refs/heads/feature/CELIX-426-cxx-api
Commit: 0aee10d8059e7186710752db54140f2f19454f6b
Parents: 6f17344
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Mon May 7 09:27:34 2018 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Mon May 7 09:27:34 2018 +0200
----------------------------------------------------------------------
.../include/celix/impl/BundleContextImpl.h | 22 +++++++++++++-------
framework/include/celix/impl/BundleImpl.h | 14 +++++++++++++
framework/include/celix/impl/FrameworkImpl.h | 9 ++++++--
3 files changed, 36 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/0aee10d8/framework/include/celix/impl/BundleContextImpl.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/impl/BundleContextImpl.h b/framework/include/celix/impl/BundleContextImpl.h
index 8da3984..4bff16c 100644
--- a/framework/include/celix/impl/BundleContextImpl.h
+++ b/framework/include/celix/impl/BundleContextImpl.h
@@ -20,6 +20,9 @@
#ifndef CELIX_IMPL_BUNDLECONTEXT_H
#define CELIX_IMPL_BUNDLECONTEXT_H
+#include <mutex>
+#include <cstring>
+
#include "bundle_context.h"
#include "service_tracker.h"
@@ -57,6 +60,11 @@ namespace celix {
this->c_ctx = nullptr;
}
+ BundleContextImpl(const BundleContextImpl&) = delete;
+ BundleContextImpl& operator=(const BundleContextImpl&) = delete;
+ BundleContextImpl(BundleContextImpl&&) = delete;
+ BundleContextImpl& operator=(BundleContextImpl&&) = delete;
+
void unregisterService(long serviceId) noexcept override {
celix_bundleContext_unregisterService(this->c_ctx, serviceId);
}
@@ -163,7 +171,7 @@ namespace celix {
auto *entry = static_cast<TrackEntry*>(handle);
celix::Properties props = createFromCProps(c_props);
auto m_bnd = const_cast<celix_bundle_t *>(c_bnd);
- auto bnd = celix::impl::BundleImpl(m_bnd);
+ celix::impl::BundleImpl bnd{m_bnd};
(entry->set)(svc, props, bnd);
};
const char *cname = serviceName.empty() ? nullptr : serviceName.c_str();
@@ -203,14 +211,14 @@ namespace celix {
auto *entry = static_cast<TrackEntry*>(handle);
celix::Properties props = createFromCProps(c_props);
auto m_bnd = const_cast<celix_bundle_t *>(c_bnd);
- auto bnd = celix::impl::BundleImpl(m_bnd);
+ celix::impl::BundleImpl bnd{m_bnd};
(entry->add)(svc, props, bnd);
};
auto c_remove = [](void *handle, void *svc, const celix_properties_t *c_props, const celix_bundle_t *c_bnd) {
auto *entry = static_cast<TrackEntry*>(handle);
celix::Properties props = createFromCProps(c_props);
auto m_bnd = const_cast<celix_bundle_t *>(c_bnd);
- auto bnd = celix::impl::BundleImpl(m_bnd);
+ celix::impl::BundleImpl bnd{m_bnd};
(entry->remove)(svc, props, bnd);
};
@@ -247,8 +255,8 @@ namespace celix {
auto c_use = [](void *handle, void *svc, const celix_properties_t *c_props, const celix_bundle_t *c_svcOwner) {
auto *fn = static_cast<const std::function<void(void *svc, const celix::Properties &props, const celix::Bundle &svcOwner)> *>(handle);
celix::Properties props = createFromCProps(c_props);
- celix_bundle_t *c_bnd = const_cast<celix_bundle_t*>(c_svcOwner);
- auto bnd = celix::impl::BundleImpl{c_bnd};
+ celix_bundle_t *m_bnd = const_cast<celix_bundle_t*>(c_svcOwner);
+ celix::impl::BundleImpl bnd{m_bnd};
(*fn)(svc, props, bnd);
};
const char *cname = serviceName.empty() ? nullptr : serviceName.c_str();
@@ -265,8 +273,8 @@ namespace celix {
auto c_use = [](void *handle, void *svc, const celix_properties_t *c_props, const celix_bundle_t *c_svcOwner) {
auto *fn = static_cast<const std::function<void(void *svc, const celix::Properties &props, const celix::Bundle &svcOwner)> *>(handle);
celix::Properties props = createFromCProps(c_props);
- celix_bundle_t *c_bnd = const_cast<celix_bundle_t*>(c_svcOwner);
- auto bnd = celix::impl::BundleImpl{c_bnd};
+ celix_bundle_t *m_bnd = const_cast<celix_bundle_t*>(c_svcOwner);
+ celix::impl::BundleImpl bnd{m_bnd};
(*fn)(svc, props, bnd);
};
const char *cname = serviceName.empty() ? nullptr : serviceName.c_str();
http://git-wip-us.apache.org/repos/asf/celix/blob/0aee10d8/framework/include/celix/impl/BundleImpl.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/impl/BundleImpl.h b/framework/include/celix/impl/BundleImpl.h
index 583ae25..465922a 100644
--- a/framework/include/celix/impl/BundleImpl.h
+++ b/framework/include/celix/impl/BundleImpl.h
@@ -40,6 +40,20 @@ namespace celix {
this->c_bnd = nullptr;
}
+ BundleImpl(const BundleImpl&) = delete;
+ BundleImpl& operator=(const BundleImpl&) = delete;
+
+ BundleImpl(BundleImpl&& rhs) : c_bnd{nullptr} {
+ using std::swap;
+ swap(this->c_bnd, rhs.c_bnd);
+ }
+
+ BundleImpl& operator=(BundleImpl&& rhs) {
+ using std::swap;
+ swap(this->c_bnd, rhs.c_bnd);
+ return *this;
+ }
+
bool isSystemBundle() const noexcept override {
bool r;
bundle_isSystemBundle(this->c_bnd, &r);
http://git-wip-us.apache.org/repos/asf/celix/blob/0aee10d8/framework/include/celix/impl/FrameworkImpl.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/impl/FrameworkImpl.h b/framework/include/celix/impl/FrameworkImpl.h
index 4a68307..6a9cceb 100644
--- a/framework/include/celix/impl/FrameworkImpl.h
+++ b/framework/include/celix/impl/FrameworkImpl.h
@@ -38,6 +38,11 @@ namespace celix {
this->setFrameworkContext();
}
+ FrameworkImpl(const FrameworkImpl&) = delete;
+ FrameworkImpl& operator=(const FrameworkImpl&) = delete;
+ FrameworkImpl(FrameworkImpl&&) = delete;
+ FrameworkImpl& operator=(FrameworkImpl&&) = delete;
+
FrameworkImpl(celix::Properties config) : owner{true} {
//framework which also owns the underlining c framework
auto c_config = properties_create();
@@ -81,9 +86,9 @@ namespace celix {
celix::Bundle& getFrameworkBundle() noexcept override {
if (this->fwBundle.size() == 0) {
- bundle_t* c_bnd = nullptr;
+ celix_bundle_t* c_bnd = nullptr;
framework_getFrameworkBundle(this->c_fwm, &c_bnd);
- this->fwBundle.emplace_back(celix::impl::BundleImpl{c_bnd});
+ this->fwBundle.emplace_back(c_bnd);
}
return this->fwBundle[0];