X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fbase%2Finit.h;fp=lib%2Fbase%2Finit.h;h=6ffd04c74e098ab96cffeaea1fe7a75132414c57;hb=02da1f586ef7945fef385e6d4743ef53441bc2fa;hp=465bac40a5ae5db77e7c4e1c287b3c87fb07416a;hpb=f7bcb76bda4da5d8a830181b4a8335d3de67f333;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