From dbe1e3277ad8ac549dab5d58692f2d21f93711a9 Mon Sep 17 00:00:00 2001 From: kanschat Date: Thu, 11 Oct 2007 16:28:49 +0000 Subject: [PATCH] Fix problem of linking debug with non-debug versions git-svn-id: https://svn.dealii.org/trunk@15292 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/subscriptor.h | 33 +++++++++++++++++++++++-- deal.II/base/source/subscriptor.cc | 12 +++++---- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/deal.II/base/include/base/subscriptor.h b/deal.II/base/include/base/subscriptor.h index f102a8a2bf..6a0abcf124 100644 --- a/deal.II/base/include/base/subscriptor.h +++ b/deal.II/base/include/base/subscriptor.h @@ -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 diff --git a/deal.II/base/source/subscriptor.cc b/deal.II/base/source/subscriptor.cc index e0d43da96b..613c99a1e2 100644 --- a/deal.II/base/source/subscriptor.cc +++ b/deal.II/base/source/subscriptor.cc @@ -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 -- 2.39.5