#ifndef GRADIDO_LOGIN_SERVER_MODEL_TABLE_CONTROLLER_BASE_INCLUDE #define GRADIDO_LOGIN_SERVER_MODEL_TABLE_CONTROLLER_BASE_INCLUDE #include "../lib/MultithreadContainer.h" #include "Poco/AutoPtr.h" #include "../model/table/ModelBase.h" namespace controller { class TableControllerBase : protected UniLib::lib::MultithreadContainer { public: TableControllerBase(); virtual ~TableControllerBase(); // for poco auto ptr void duplicate(); void release(); protected: template Poco::AutoPtr _getModel(); template const T* _getModel() const; // for poco auto ptr int mReferenceCount; // Poco::AutoPtr mDBModel; }; // ****** template function declarations *************** template Poco::AutoPtr TableControllerBase::_getModel() { // TODO: Maybe update name for error search lock("TableControllerBase::_getModel"); T* result = static_cast(mDBModel.get()); unlock(); return Poco::AutoPtr(result, true); } template const T* TableControllerBase::_getModel() const { //lock("TableControllerBase::_getModel const"); if (mDBModel.isNull()) { //unlock(); return nullptr; } const T* result = static_cast(mDBModel.get()); //unlock(); return result; } } #endif //GRADIDO_LOGIN_SERVER_MODEL_TABLE_CONTROLLER_BASE_INCLUDE