16 #ifndef dealii_subscriptor_h 17 #define dealii_subscriptor_h 20 #include <deal.II/base/config.h> 22 #include <deal.II/base/exceptions.h> 29 #ifdef DEAL_II_WITH_THREADS 33 DEAL_II_NAMESPACE_OPEN
113 subscribe(
const char *identifier =
nullptr)
const;
122 unsubscribe(
const char *identifier =
nullptr)
const;
135 template <
typename StreamType>
157 <<
"Object of class " << arg2 <<
" is still used by " << arg1
160 <<
"(Additional information: " << arg3 <<
")\n\n" 161 <<
"See the entry in the Frequently Asked Questions of " 162 <<
"deal.II (linked to from http://www.dealii.org/) for " 163 <<
"a lot more information on what this error means and " 164 <<
"how to fix programs in which it happens.");
173 <<
"No subscriber with identifier <" << arg2
174 <<
"> subscribes to this object of class " << arg1
175 <<
". Consequently, it cannot be unsubscribed.");
190 template <
class Archive>
192 serialize(Archive &ar,
const unsigned int version);
253 #ifdef DEAL_II_WITH_THREADS 266 template <
class Archive>
274 template <
typename StreamType>
278 #ifdef DEAL_II_WITH_THREADS 279 std::lock_guard<std::mutex> lock(
mutex);
282 for (
map_iterator it = counter_map.begin(); it != counter_map.end(); ++it)
283 stream << it->second <<
'/' << counter <<
" subscriptions from \"" 284 << it->first <<
'\"' << std::endl;
287 DEAL_II_NAMESPACE_CLOSE
static::ExceptionBase & ExcInUse(int arg1, std::string arg2, std::string arg3)
#define DeclException2(Exception2, type1, type2, outsequence)
void subscribe(const char *identifier=nullptr) const
const std::type_info * object_info
Subscriptor & operator=(const Subscriptor &)
std::map< const char *, unsigned int >::value_type map_value_type
void unsubscribe(const char *identifier=nullptr) const
std::map< const char *, unsigned int >::iterator map_iterator
unsigned int n_subscriptions() const
void serialize(Archive &ar, const unsigned int version)
std::atomic< unsigned int > counter
std::map< const char *, unsigned int > counter_map
#define DeclException3(Exception3, type1, type2, type3, outsequence)
static::ExceptionBase & ExcNoSubscriber(std::string arg1, std::string arg2)
void list_subscribers() const
void check_no_subscribers() const noexcept