X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/d63d2c3c6cbbd574dda4f8b00ebe6c661735edd5..cd2549143a0eb87a828e03d1ddf67565fd9942c5:/lib/base/init.h diff --git a/lib/base/init.h b/lib/base/init.h index 465bac40..6ffd04c7 100644 --- a/lib/base/init.h +++ b/lib/base/init.h @@ -3,6 +3,7 @@ #include #include +#include class eAutoInit; @@ -94,4 +95,35 @@ public: } }; +template class +eAutoInitPtr: protected eAutoInit +{ + ePtr t; + void initNow() + { + t = new T1(); + } + void closeNow() + { + t = 0; + } +public: + operator T1*() + { + return t; + } + T1 *operator->() + { + return t; + } + eAutoInitPtr(int runl, char *description): eAutoInit(runl, description) + { + eInit::add(rl, this); + } + ~eAutoInitPtr() + { + eInit::remove(rl, this); + } +}; + #endif