Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
subscriptor.h
1 // ---------------------------------------------------------------------
2 // @f$Id: subscriptor.h 32041 2013-12-17 17:29:38Z maier @f$
3 //
4 // Copyright (C) 1998 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__subscriptor_h
18 #define __deal2__subscriptor_h
19 
20 
21 #include <deal.II/base/config.h>
23 
24 #include <typeinfo>
25 #include <map>
26 #include <string>
27 
29 
58 {
59 public:
63  Subscriptor();
64 
72  Subscriptor(const Subscriptor &);
73 
78  virtual ~Subscriptor();
79 
90 
97  void subscribe (const char *identifier = 0) const;
98 
109  void unsubscribe (const char *identifier = 0) const;
110 
120  unsigned int n_subscriptions () const;
121 
125  void list_subscribers () const;
126 
135  DeclException3(ExcInUse,
136  int, char *, std::string &,
137  << "Object of class " << arg2
138  << " is still used by " << arg1 << " other objects.\n"
139  << "(Additional information: " << arg3 << ")\n"
140  << "Note the entry in the Frequently Asked Questions of "
141  << "deal.II (linked to from http://www.dealii.org/) for "
142  << "more information on what this error means.");
143 
150  DeclException2(ExcNoSubscriber, char *, char *,
151  << "No subscriber with identifier \"" << arg2
152  << "\" did subscribe to this object of class " << arg1);
154 
179  template <class Archive>
180  void serialize(Archive &ar, const unsigned int version);
181 
182 private:
187  typedef std::map<const char *, unsigned int>::value_type
189 
194  typedef std::map<const char *, unsigned int>::iterator
196 
227  mutable DEAL_VOLATILE unsigned int counter;
228 
235  mutable std::map<const char *, unsigned int> counter_map;
236 
248  mutable const std::type_info *object_info;
249 };
250 
251 //---------------------------------------------------------------------------
252 
253 template <class Archive>
254 inline
255 void
257  const unsigned int)
258 {
259  // do nothing, as explained in the
260  // documentation of this function
261 }
262 
263 DEAL_II_NAMESPACE_CLOSE
264 
265 #endif
void unsubscribe(const char *identifier=0) const
virtual ~Subscriptor()
void subscribe(const char *identifier=0) const
const std::type_info * object_info
Definition: subscriptor.h:248
DeclException3(ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects.\n"<< "(Additional information: "<< arg3<< ")\n"<< "Note the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "more information on what this error means.")
DEAL_VOLATILE unsigned int counter
Definition: subscriptor.h:227
Subscriptor & operator=(const Subscriptor &)
unsigned int n_subscriptions() const
void serialize(Archive &ar, const unsigned int version)
Definition: subscriptor.h:256
DeclException2(ExcNoSubscriber, char *, char *,<< "No subscriber with identifier \""<< arg2<< "\" did subscribe to this object of class "<< arg1)
std::map< const char *, unsigned int > counter_map
Definition: subscriptor.h:235
std::map< const char *, unsigned int >::iterator map_iterator
Definition: subscriptor.h:195
std::map< const char *, unsigned int >::value_type map_value_type
Definition: subscriptor.h:188
void list_subscribers() const