You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by er...@apache.org on 2018/11/08 11:30:56 UTC

celix git commit: Added DM-Cxx fucntion to remove previously registered component callbacks

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 <er...@gmail.com>
Authored: Thu Nov 8 12:30:42 2018 +0100
Committer: Erjan Altena <er...@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;
+}
+