Manager.h

Go to the documentation of this file.
00001 /*
00002 This file is part of hugin.
00003 
00004 hugin is free software: you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation, either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 hugin is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with hugin.  If not, see <http://www.gnu.org/licenses/>.
00016 */
00017 
00025 #ifndef MANAGER_H_
00026 #define MANAGER_H_
00027 #ifdef __APPLE__
00028 //for MacOX the macro "check" gets somewhere defined
00029 //this will collide with some boost libs, to prevent conflicts
00030 //we undef the macro
00031 #undef check
00032 #endif
00033 #include <boost/ptr_container/ptr_vector.hpp>
00034 
00035 #include "MakefileItem.h"
00036 #include "Manageable.h"
00037 
00038 namespace makefile
00039 {
00040 
00041 
00058 class MAKEIMPEX Manager
00059 {
00060         // boost::ptr_vector is perfect here, and it handles deletion.
00061         boost::ptr_vector<Manageable> mitems;
00062 
00063         Manager(const Manager&);        // cannot copy this object!
00064 public:
00065         Manager();
00066         virtual ~Manager() {}
00067 
00074         template<class I>
00075         I* own(I* item)
00076         {
00077                 mitems.push_back(item);
00078                 return item;
00079         }
00085         template<class MI>
00086         MI* own_add(MI* item)
00087         {
00088                 own(item);
00089                 item->add();
00090                 return item;
00091         }
00092 
00093 };
00094 
00095 }
00096 
00097 #endif /* MANAGER_H_ */

Generated on 28 Nov 2014 for Hugintrunk by  doxygen 1.4.7