manager.h

Go to the documentation of this file.
00001 
00013 #ifndef MANAGER_H
00014 #define MANAGER_H
00015 
00016 #include <stdexcept>
00017 #include <string>
00018 #include <iostream>
00019 
00023 template <class T>
00024 class Manager {
00025   protected: 
00026     T _t;
00027 
00028   public: 
00029     Manager() : _t(0), _isOwner(false) {}
00030     Manager<T>(const T t) : _t(t), _isOwner(true) {}
00031     operator T() const {return _t;}
00032 
00033   protected:
00034     bool isOwner() const {return _isOwner;}
00035     void release() {_isOwner = false;}
00036 
00037   private:
00038     bool _isOwner;
00039 };
00040 
00041 #endif