X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fbase%2Finit.h;h=6ffd04c74e098ab96cffeaea1fe7a75132414c57;hb=6f73e6abddf4170357c490966d0e1c622eb376f5;hp=465bac40a5ae5db77e7c4e1c287b3c87fb07416a;hpb=d63d2c3c6cbbd574dda4f8b00ebe6c661735edd5;p=vuplus_dvbapp diff --git a/lib/base/init.h b/lib/base/init.h index 465bac4..6ffd04c 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