The Sparta Modeling Framework
Loading...
Searching...
No Matches
LifeTracker.hpp
Go to the documentation of this file.
1// <LifeTracker.h> -*- C++ -*-
2
3
9#pragma once
10
11#include <memory>
12
13namespace sparta
14{
15 namespace utils
16 {
66 template<class TrackedObjectT>
67 class LifeTracker : public std::shared_ptr<LifeTracker<TrackedObjectT> >
68 {
69 public:
70 LifeTracker(TrackedObjectT * obj) :
71 std::shared_ptr<LifeTracker<TrackedObjectT>>(this, [] (LifeTracker<TrackedObjectT> *) {}),
72 tracked_object(obj)
73 {}
74
75 TrackedObjectT * tracked_object;
76 };
77
78 }
79}
80
A class that will track the lifetime of the object it points to.
Macros for handling exponential backoff.