Reference documentation for deal.II version 8.4.1
subscriptor.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2016 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__subscriptor_h
17 #define dealii__subscriptor_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/exceptions.h>
22 
23 #include <typeinfo>
24 #include <map>
25 #include <string>
26 
27 DEAL_II_NAMESPACE_OPEN
28 
57 {
58 public:
62  Subscriptor();
63 
70  Subscriptor(const Subscriptor &);
71 
75  virtual ~Subscriptor();
76 
84 
89  void subscribe (const char *identifier = 0) const;
90 
97  void unsubscribe (const char *identifier = 0) const;
98 
104  unsigned int n_subscriptions () const;
105 
109  void list_subscribers () const;
110 
119  DeclException3(ExcInUse,
120  int, char *, std::string &,
121  << "Object of class " << arg2
122  << " is still used by " << arg1 << " other objects."
123  << "\n\n"
124  << "(Additional information: " << arg3 << ")\n\n"
125  << "See the entry in the Frequently Asked Questions of "
126  << "deal.II (linked to from http://www.dealii.org/) for "
127  << "a lot more information on what this error means and "
128  << "how to fix programs in which it happens.");
129 
134  DeclException2(ExcNoSubscriber, char *, char *,
135  << "No subscriber with identifier <" << arg2
136  << "> subscribes to this object of class " << arg1
137  << ". Consequently, it cannot be unsubscribed.");
139 
152  template <class Archive>
153  void serialize(Archive &ar, const unsigned int version);
154 
155 private:
159  typedef std::map<const char *, unsigned int>::value_type
161 
165  typedef std::map<const char *, unsigned int>::iterator
167 
184  mutable DEAL_VOLATILE unsigned int counter;
185 
190  mutable std::map<const char *, unsigned int> counter_map;
191 
198  mutable const std::type_info *object_info;
199 };
200 
201 //---------------------------------------------------------------------------
202 
203 template <class Archive>
204 inline
205 void
207  const unsigned int)
208 {
209  // do nothing, as explained in the
210  // documentation of this function
211 }
212 
213 DEAL_II_NAMESPACE_CLOSE
214 
215 #endif
void unsubscribe(const char *identifier=0) const
Definition: subscriptor.cc:180
void subscribe(const char *identifier=0) const
Definition: subscriptor.cc:153
DeclException2(ExcNoSubscriber, char *, char *,<< "No subscriber with identifier <"<< arg2<< "> subscribes to this object of class "<< arg1<< ". Consequently, it cannot be unsubscribed.")
const std::type_info * object_info
Definition: subscriptor.h:198
Subscriptor & operator=(const Subscriptor &)
Definition: subscriptor.cc:144
DEAL_VOLATILE unsigned int counter
Definition: subscriptor.h:184
unsigned int n_subscriptions() const
Definition: subscriptor.cc:207
void serialize(Archive &ar, const unsigned int version)
Definition: subscriptor.h:206
DeclException3(ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects."<< "\n\n"<< "(Additional information: "<< arg3<< ")\n\n"<< "See the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "a lot more information on what this error means and "<< "how to fix programs in which it happens.")
std::map< const char *, unsigned int > counter_map
Definition: subscriptor.h:190
std::map< const char *, unsigned int >::iterator map_iterator
Definition: subscriptor.h:166
virtual ~Subscriptor()
Definition: subscriptor.cc:65
std::map< const char *, unsigned int >::value_type map_value_type
Definition: subscriptor.h:160
void list_subscribers() const
Definition: subscriptor.cc:214