From 589ff6ee7fb0e6428e17006584fe38df031cafe7 Mon Sep 17 00:00:00 2001
From: Jeremie Deray <jeremie.deray@pal-robotics.com>
Date: Tue, 17 Oct 2017 11:50:13 +0200
Subject: [PATCH] embed notification within StateBlock class

---
 src/state_block.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/state_block.h b/src/state_block.h
index b622bdb6a..3b6e16cae 100644
--- a/src/state_block.h
+++ b/src/state_block.h
@@ -28,7 +28,21 @@ namespace wolf {
  */
 class StateBlock
 {
+public:
+
+  enum class Notification : std::size_t
+  {
+    ADD = 0,
+    REMOVE,
+    UPDATE,
+    FIX_UPDATE,
+    ENABLED
+  };
+
     protected:
+
+        std::atomic<StateBlock::Notification> notification_;
+
         NodeBaseWPtr node_ptr_; //< pointer to the wolf Node owning this StateBlock
 
         bool fixed_; ///< Key to indicate whether the state is fixed or not
@@ -99,6 +113,10 @@ class StateBlock
 
         void removeLocalParametrization();
 
+        void notify(const StateBlock::Notification n);
+
+        StateBlock::Notification notify() const noexcept;
+
 };
 
 } // namespace wolf
@@ -196,6 +214,16 @@ inline void StateBlock::setLocalParametrizationPtr(LocalParametrizationBasePtr _
     local_param_ptr_ = _local_param;
 }
 
+inline void StateBlock::notify(const StateBlock::Notification n)
+{
+  notification_ = n;
+}
+
+inline StateBlock::Notification StateBlock::notify() const noexcept
+{
+  return notification_;
+}
+
 } // namespace wolf
 
 #endif
-- 
GitLab