--- /dev/null
+//---------------------------- object_monitor.h ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- object_monitor.h ---------------------------
+#ifndef __deal2__object_monitor_h
+#define __deal2__object_monitor_h
+
+
+
+#include <set>
+
+class Subscriptor;
+
+
+
+class ObjectMonitor
+{
+ public:
+ ObjectMonitor ();
+ ~ObjectMonitor ();
+
+ void activate ();
+ void deactivate ();
+
+ void register_object (const Subscriptor *p);
+ void deregister_object (const Subscriptor *p);
+ private:
+ std::set<const Subscriptor*> registered_objects;
+ bool activated;
+};
+
+
+extern ObjectMonitor *object_monitor;
+
+
+
+#endif
+
+
+
--- /dev/null
+//---------------------------- object_monitor_activator.h ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- object_monitor_activator.h ---------------------------
+#ifndef __deal2__object_monitor_activator_h
+#define __deal2__object_monitor_activator_h
+
+
+
+
+class ObjectMonitorActivator
+{
+ public:
+ ObjectMonitorActivator ();
+ ~ObjectMonitorActivator ();
+};
+
+
+
+
+
+#endif
+
+
+
--- /dev/null
+//---------------------------- object_monitor.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- object_monitor.cc ---------------------------
+
+
+#include <base/object_monitor.h>
+#include <base/subscriptor.h>
+
+
+ObjectMonitor *object_monitor;
+
+
+
+ObjectMonitor::ObjectMonitor ():
+ activated (false)
+{};
+
+
+ObjectMonitor::~ObjectMonitor ()
+{};
+
+
+
+void ObjectMonitor::activate ()
+{
+ activated=true;
+};
+
+
+
+void ObjectMonitor::deactivate ()
+{
+ activated = false;
+ if (registered_objects.size() > 0)
+ {
+ for (std::set<const Subscriptor*>::const_iterator i=registered_objects.begin();
+ i!=registered_objects.end(); ++i)
+ std::cout << "Object still exists of type "
+ << typeid(**i).name()
+ << std::endl;
+ abort ();
+ };
+};
+
+
+void ObjectMonitor::register_object (const Subscriptor *p)
+{
+ if (activated)
+ {
+ cout << typeid(*p).name() << endl;
+ if (registered_objects.find(p) != registered_objects.end())
+ abort();
+ registered_objects.insert (p);
+ };
+};
+
+
+void
+ObjectMonitor::deregister_object (const Subscriptor *p)
+{
+ if (activated)
+ {
+ if (registered_objects.find(p) == registered_objects.end())
+ abort();
+ registered_objects.erase (registered_objects.find(p));
+ };
+};
--- /dev/null
+//---------------------------- object_monitor_activator.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- object_monitor_activator.cc ---------------------------
+
+
+#include <base/object_monitor.h>
+#include <base/object_monitor_activator.h>
+#include <base/subscriptor.h>
+
+
+ObjectMonitorActivator::ObjectMonitorActivator ()
+{
+ if (true)
+ Subscriptor b;
+ object_monitor->activate();
+};
+
+
+ObjectMonitorActivator::~ObjectMonitorActivator ()
+{
+ object_monitor->deactivate();
+};