Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename T>
- void deleteProcessors(T &processor) {
- for (typename T::iterator iter = processor.begin(); iter != processor.end(); ++iter) {
- delete iter->second;
- }
- processor.clear();
- }
- class taggerHandler : virtual public taggerIf {
- public:
- taggerHandler() {
- this->loadResources();
- }
- void tagText(std::string& _return, const std::string& text, const std::string& language) {
- //useful function
- }
- void reload(std::string& _return, const std::string& parmeters) {
- this->clearResources();
- this->loadResources();
- }
- private:
- void loadResources() {
- //here config reading, option declaring etc..
- //maco just object from freeling library, that could allocate 100MB
- string language = "en";
- this->macoProcs[language] = shared_ptr<maco>(new maco());
- }
- void clearResources(){
- //this way was before shared_ptr
- //deleteProcessors(macoProcs);
- macoProcs.clear();
- }
- map<string, shared_ptr<maco> > macoProcs;
- };
Advertisement
Add Comment
Please, Sign In to add comment