celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erjanalt...@apache.org
Subject celix git commit: Added DM-Cxx fucntion to remove previously registered component callbacks
Date Thu, 08 Nov 2018 11:30:56 GMT
Repository: celix
Updated Branches:
  refs/heads/develop bd38363ab -> 6f9b23dcb


Added DM-Cxx fucntion to remove previously registered component callbacks


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/6f9b23dc
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/6f9b23dc
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/6f9b23dc

Branch: refs/heads/develop
Commit: 6f9b23dcbc9b1057d76d344633ed0811d2e53e7f
Parents: bd38363
Author: Erjan Altena <erjanaltena@gmail.com>
Authored: Thu Nov 8 12:30:42 2018 +0100
Committer: Erjan Altena <erjanaltena@gmail.com>
Committed: Thu Nov 8 12:30:42 2018 +0100

----------------------------------------------------------------------
 .../dm_example_cxx/phase1/src/Phase1Activator.cc            | 2 +-
 libs/framework/include/celix/dm/Component.h                 | 6 ++++++
 libs/framework/include/celix/dm/Component_Impl.h            | 9 +++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/6f9b23dc/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc b/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
index 2dd5ed2..61443dd 100644
--- a/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
@@ -99,5 +99,5 @@ void Phase1Activator::init() {
 }
 
 void Phase1Activator::deinit() {
-    //nothing to do
+    phase1cmp->removeCallbacks();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/6f9b23dc/libs/framework/include/celix/dm/Component.h
----------------------------------------------------------------------
diff --git a/libs/framework/include/celix/dm/Component.h b/libs/framework/include/celix/dm/Component.h
index 076700e..85723f9 100644
--- a/libs/framework/include/celix/dm/Component.h
+++ b/libs/framework/include/celix/dm/Component.h
@@ -237,6 +237,12 @@ namespace celix { namespace dm {
             int (T::*stop)(),
             int (T::*deinit)()
         );
+        /**
+         * Remove the previously registered callbacks for the component life cycle control
+         *
+         * @return the DM Component reference for chaining (fluent API)
+         */
+        Component<T>& removeCallbacks();
     };
 }}
 

http://git-wip-us.apache.org/repos/asf/celix/blob/6f9b23dc/libs/framework/include/celix/dm/Component_Impl.h
----------------------------------------------------------------------
diff --git a/libs/framework/include/celix/dm/Component_Impl.h b/libs/framework/include/celix/dm/Component_Impl.h
index f20cf09..7848c6a 100644
--- a/libs/framework/include/celix/dm/Component_Impl.h
+++ b/libs/framework/include/celix/dm/Component_Impl.h
@@ -326,3 +326,12 @@ Component<T>& Component<T>::setCallbacks(
 
     return *this;
 }
+
+template<class T>
+Component<T>& Component<T>::removeCallbacks() {
+
+    component_setCallbacks(this->cComponent(), nullptr, nullptr, nullptr, nullptr);
+
+    return *this;
+}
+


Mime
View raw message