16 #ifndef dealii_smartpointer_h 17 #define dealii_smartpointer_h 20 #include <deal.II/base/config.h> 22 #include <deal.II/base/exceptions.h> 27 DEAL_II_NAMESPACE_OPEN
67 template <
typename T,
typename P =
void>
146 operator T *()
const;
203 const std::string
id;
216 template <
typename T,
typename P>
219 , id(typeid(P).name())
220 , pointed_to_object_is_alive(false)
225 template <
typename T,
typename P>
228 , id(typeid(P).name())
229 , pointed_to_object_is_alive(false)
237 template <
typename T,
typename P>
241 , pointed_to_object_is_alive(false)
249 template <
typename T,
typename P>
254 , pointed_to_object_is_alive(false)
262 template <
typename T,
typename P>
266 , pointed_to_object_is_alive(false)
274 template <
typename T,
typename P>
277 if (pointed_to_object_is_alive && t !=
nullptr)
278 t->unsubscribe(&pointed_to_object_is_alive,
id);
283 template <
typename T,
typename P>
287 if (pointed_to_object_is_alive && t !=
nullptr)
289 t->unsubscribe(&pointed_to_object_is_alive,
id);
298 template <
typename T,
typename P>
307 if (pointed_to_object_is_alive && t !=
nullptr)
308 t->unsubscribe(&pointed_to_object_is_alive,
id);
311 tt->subscribe(&pointed_to_object_is_alive,
id);
317 template <
typename T,
typename P>
328 if (pointed_to_object_is_alive && t !=
nullptr)
329 t->unsubscribe(&pointed_to_object_is_alive,
id);
330 t =
static_cast<T *
>(tt);
332 tt->subscribe(&pointed_to_object_is_alive,
id);
338 template <
typename T,
typename P>
348 if (pointed_to_object_is_alive && t !=
nullptr)
349 t->unsubscribe(&pointed_to_object_is_alive,
id);
350 t =
static_cast<T *
>(tt);
352 tt->subscribe(&pointed_to_object_is_alive,
id);
358 template <
typename T,
typename P>
366 template <
typename T,
typename P>
370 Assert(pointed_to_object_is_alive,
371 ExcMessage(
"The object pointed to is not valid anymore."));
377 template <
typename T,
typename P>
381 Assert(pointed_to_object_is_alive,
382 ExcMessage(
"The object pointed to is not valid anymore."));
388 template <
typename T,
typename P>
404 template <
typename T,
typename P>
408 if (pointed_to_object_is_alive && t !=
nullptr)
409 t->unsubscribe(pointed_to_object_is_alive,
id);
414 t->subscribe(pointed_to_object_is_alive,
id);
419 template <
typename T,
typename P>
442 template <
typename T,
typename P,
class Q>
458 template <
typename T,
typename P>
474 template <
typename T,
typename P>
481 DEAL_II_NAMESPACE_CLOSE
std::atomic< bool > pointed_to_object_is_alive
static ::ExceptionBase & ExcNotInitialized()
static ::ExceptionBase & ExcMessage(std::string arg1)
void swap(BlockIndices &u, BlockIndices &v)
#define Assert(cond, exc)
void swap(SmartPointer< T, Q > &tt)
SmartPointer< T, P > & operator=(T *tt)
void swap(Vector< Number > &u, Vector< Number > &v)
std::size_t memory_consumption() const
static ::ExceptionBase & ExcInternalError()