]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a function to retrieve the number of subscriptions to the Subscriptor class....
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 13 Aug 1999 08:13:33 +0000 (08:13 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 13 Aug 1999 08:13:33 +0000 (08:13 +0000)
git-svn-id: https://svn.dealii.org/trunk@1693 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 20aabf2be615389a6dc95e6d74275d2cfe824327..cee5ed0e7e6bc3ad0d16f940ce1f28c664414dab 100644 (file)
@@ -66,6 +66,17 @@ class Subscriptor
                                      * Unsubscribes a user from the object.
                                      */
     void unsubscribe () const;
+
+                                    /**
+                                     * Return the present number of
+                                     * subscriptions to this object.
+                                     * This allows to use this class
+                                     * for reference counted lifetime
+                                     * determination where the last one
+                                     * to unsubscribe also deletes the
+                                     * object.
+                                     */
+    unsigned int n_subscriptions () const;
     
                                     /**
                                      * Exception:
index 65c8c15f252d1b0fad73ec8a44a75ad0e4de6a41..fff706743243a1de7f1b44e4b9fc413e0892a6cb 100644 (file)
@@ -38,3 +38,9 @@ void Subscriptor::unsubscribe () const {
   Assert (counter>0, NotUsed());
   --counter;
 };
+
+
+unsigned int Subscriptor::n_subscriptions () const 
+{
+  return counter;
+};

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.