13#ifndef dealii_enable_observer_pointer_h
14#define dealii_enable_observer_pointer_h
33template <
typename T,
typename P>
132 template <
typename StreamType>
156 <<
"Object of class " << arg2 <<
" is still used by " << arg1
159 <<
"(Additional information: " << arg3 <<
")\n\n"
160 <<
"See the entry in the Frequently Asked Questions of "
161 <<
"deal.II (linked to from http://dealii.org/) for "
162 <<
"a lot more information on what this error means and "
163 <<
"how to fix programs in which it happens.");
173 <<
"No subscriber with identifier <"
174 << (arg2.empty() ?
"unknown subscriber" : arg2.c_str())
175 <<
"> subscribes to this object of class " << arg1
176 <<
". Consequently, it cannot be unsubscribed.");
192 template <
class Archive>
194 serialize(Archive &ar,
const unsigned int version);
255 subscribe(std::atomic<bool> *
const validity,
256 const std::string &identifier =
"")
const;
266 const std::string &identifier =
"")
const;
284 template <typename, typename>
325template <
class Archive>
333template <
typename StreamType>
337 std::scoped_lock lock(
mutex);
340 stream << it.second <<
'/' <<
counter <<
" subscriptions from \""
341 << it.first <<
'\"' << std::endl;
virtual ~EnableObserverPointer()
void check_no_subscribers() const noexcept
void subscribe(std::atomic< bool > *const validity, const std::string &identifier="") const
void serialize(Archive &ar, const unsigned int version)
EnableObserverPointer & operator=(const EnableObserverPointer &)
std::atomic< unsigned int > counter
void unsubscribe(std::atomic< bool > *const validity, const std::string &identifier="") const
void list_subscribers() const
std::map< std::string, unsigned int > counter_map
std::vector< std::atomic< bool > * > validity_pointers
const std::type_info * object_info
unsigned int n_subscriptions() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DeclException2(Exception2, type1, type2, outsequence)
static ::ExceptionBase & ExcNoSubscriber(std::string arg1, std::string arg2)
#define DeclException3(Exception3, type1, type2, type3, outsequence)
static ::ExceptionBase & ExcInUse(int arg1, std::string arg2, std::string arg3)