]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix problem of linking debug with non-debug versions
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 11 Oct 2007 16:28:49 +0000 (16:28 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 11 Oct 2007 16:28:49 +0000 (16:28 +0000)
git-svn-id: https://svn.dealii.org/trunk@15292 0785d39b-7218-0410-832d-ea1e28bc413d

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

index f102a8a2bfe449a9cff222cb95eca266b49870a2..6a0abcf124eed613ec5cf18d31694c85fdcdb5f3 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -154,6 +154,20 @@ class Subscriptor
                                     //@}
 
   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.
@@ -229,7 +243,22 @@ class Subscriptor
 // unsubscribe here. The definitions for debug mode are in
 // subscriptor.cc.
 
-#ifndef DEBUG
+#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
index e0d43da96b2cf33ce3604d02ceece617fb1d5d91..613c99a1e2b88ab7058cb3d73cdb384fbb14694f 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -134,9 +134,9 @@ Subscriptor & Subscriptor::operator = (const Subscriptor &s)
 // These are the implementations for debug mode. The optimized
 // versions are inlined in the header file.
 
-#ifdef DEBUG
-void Subscriptor::subscribe (const char* id) const
+void Subscriptor::do_subscribe (const char* id) const
 {
+#ifdef DEBUG
   if (object_info == 0)
     object_info = &typeid(*this);
   Threads::ThreadMutex::ScopedLock lock (subscription_lock);
@@ -152,11 +152,13 @@ void Subscriptor::subscribe (const char* id) const
   else
     it->second++;
 #endif
+#endif
 }
 
 
-void Subscriptor::unsubscribe (const char* id) const
+void Subscriptor::do_unsubscribe (const char* id) const
 {
+#ifdef DEBUG
   Assert (counter>0, ExcNotUsed());
   Threads::ThreadMutex::ScopedLock lock (subscription_lock);
   --counter;
@@ -170,8 +172,8 @@ void Subscriptor::unsubscribe (const char* id) const
   
   it->second--;
 #endif
-}
 #endif
+}
 
 
 unsigned int Subscriptor::n_subscriptions () const

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.