RAUL 0.7.0
|
00001 /* This file is part of Raul. 00002 * Copyright (C) 2007-2009 David Robillard <http://drobilla.net> 00003 * 00004 * Raul is free software; you can redistribute it and/or modify it under the 00005 * terms of the GNU General Public License as published by the Free Software 00006 * Foundation; either version 2 of the License, or (at your option) any later 00007 * version. 00008 * 00009 * Raul is distributed in the hope that it will be useful, but WITHOUT ANY 00010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. 00012 * 00013 * You should have received a copy of the GNU General Public License along 00014 * with this program; if not, write to the Free Software Foundation, Inc., 00015 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00016 */ 00017 00018 #ifndef RAUL_MAID_HPP 00019 #define RAUL_MAID_HPP 00020 00021 #include <boost/utility.hpp> 00022 #include "raul/SharedPtr.hpp" 00023 #include "raul/SRSWQueue.hpp" 00024 #include "raul/Deletable.hpp" 00025 #include "raul/List.hpp" 00026 00027 namespace Raul { 00028 00029 00046 class Maid : boost::noncopyable 00047 { 00048 public: 00049 Maid(size_t size); 00050 ~Maid(); 00051 00055 inline void push(Raul::Deletable* obj) { 00056 if (obj) 00057 _objects.push(obj); 00058 } 00059 00060 void manage(SharedPtr<Raul::Deletable> ptr); 00061 00062 void cleanup(); 00063 00064 private: 00065 typedef Raul::SRSWQueue<Raul::Deletable*> Objects; 00066 typedef Raul::List<SharedPtr<Raul::Deletable> > Managed; 00067 00068 Objects _objects; 00069 Managed _managed; 00070 }; 00071 00072 00073 } // namespace Raul 00074 00075 #endif // RAUL_MAID_HPP 00076