ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
ResourceObserver Struct Reference

Observer to monitor the lifetime of a shared resource. More...

#include <ResourceManager.hpp>

Public Member Functions

template<typename T >
 ResourceObserver (std::shared_ptr< T > const &status)
 
bool is_valid () const
 

Detailed Description

Observer to monitor the lifetime of a shared resource.

A shared resource whose lifetime isn't managed via a smart pointer can become a dangling reference. When a resource is centrally managed, e.g. via a singleton, the singleton interface can be adapted to keep track of the shared resources lifetime via an "observer" object that shares the same lifetime.

This class wraps a type-erased non-owning observer that cannot be promoted to a shared handle.

Definition at line 97 of file ResourceManager.hpp.

Constructor & Destructor Documentation

◆ ResourceObserver()

template<typename T >
ResourceObserver::ResourceObserver ( std::shared_ptr< T > const &  status)
inline

Definition at line 99 of file ResourceManager.hpp.

Member Function Documentation

◆ is_valid()


The documentation for this struct was generated from the following file: