]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Have both subscribe and unsubscribe in the .cc file. This resolves an issue recently...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 17 Dec 2013 13:27:26 +0000 (13:27 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 17 Dec 2013 13:27:26 +0000 (13:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@32039 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/subscriptor.h
deal.II/source/base/subscriptor.cc

index 44d425865c4bf61a6f85fff08b5a2a867efe580c..f7319cb6b527836c8e96360866b85dc14ce776f7 100644 (file)
@@ -180,20 +180,6 @@ public:
   void serialize(Archive &ar, const unsigned int version);
 
 private:
-  /**
-   * Register a subscriber for
-   * debugging purposes. Called by
-   * subscribe() in debug mode.
-   */
-  void do_subscribe(const char *id) const;
-
-  /**
-   * Deregister a subscriber for
-   * debugging purposes. Called by
-   * unsubscribe() in debug mode.
-   */
-  void do_unsubscribe(const char *id) const;
-
   /**
    * The data type used in
    * #counter_map.
@@ -274,38 +260,6 @@ Subscriptor::serialize(Archive &,
   // documentation of this function
 }
 
-// If we are in optimized mode, the subscription checking is turned
-// off. Therefore, we provide inline definitions of subscribe and
-// unsubscribe here. The definitions for debug mode are in
-// subscriptor.cc.
-
-#ifdef DEBUG
-
-inline void
-Subscriptor::subscribe(const char *id) const
-{
-  do_subscribe(id);
-}
-
-
-inline void
-Subscriptor::unsubscribe(const char *id) const
-{
-  do_unsubscribe(id);
-}
-
-#else
-
-inline void
-Subscriptor::subscribe(const char *) const
-{}
-
-
-inline void
-Subscriptor::unsubscribe(const char *) const
-{}
-
-#endif
 DEAL_II_NAMESPACE_CLOSE
 
 #endif
index 505eff12146c6b4d8e19b58f9f1d98464cc5751d..422c2311e6f772422613b36e118ac76c693b2310 100644 (file)
@@ -142,10 +142,10 @@ Subscriptor &Subscriptor::operator = (const Subscriptor &s)
   return *this;
 }
 
-// These are the implementations for debug mode. The optimized
-// versions are inlined in the header file.
 
-void Subscriptor::do_subscribe (const char *id) const
+
+void
+Subscriptor::subscribe(const char *id) const
 {
 #ifdef DEBUG
   if (object_info == 0)
@@ -153,7 +153,7 @@ void Subscriptor::do_subscribe (const char *id) const
   Threads::Mutex::ScopedLock lock (subscription_lock);
   ++counter;
 
-#ifndef DEAL_II_WITH_THREADS
+#  ifndef DEAL_II_WITH_THREADS
   const char *const name = (id != 0) ? id : unknown_subscriber;
 
   map_iterator it = counter_map.find(name);
@@ -162,12 +162,15 @@ void Subscriptor::do_subscribe (const char *id) const
 
   else
     it->second++;
-#endif
+#  endif
+#else
+  (void)id;
 #endif
 }
 
 
-void Subscriptor::do_unsubscribe (const char *id) const
+void
+Subscriptor::unsubscribe(const char *id) const
 {
 #ifdef DEBUG
   const char *name = (id != 0) ? id : unknown_subscriber;
@@ -180,23 +183,27 @@ void Subscriptor::do_unsubscribe (const char *id) const
   Threads::Mutex::ScopedLock lock (subscription_lock);
   --counter;
 
-#ifndef DEAL_II_WITH_THREADS
+#  ifndef DEAL_II_WITH_THREADS
   map_iterator it = counter_map.find(name);
   AssertNothrow (it != counter_map.end(), ExcNoSubscriber(object_info->name(), name));
   AssertNothrow (it->second > 0, ExcNoSubscriber(object_info->name(), name));
 
   it->second--;
-#endif
+#  endif
+#else
+  (void)id;
 #endif
 }
 
 
+
 unsigned int Subscriptor::n_subscriptions () const
 {
   return counter;
 }
 
 
+
 void Subscriptor::list_subscribers () const
 {
 #ifndef DEAL_II_WITH_THREADS

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.