repositeryManager.h

Go to the documentation of this file.
00001 /* -*- Mode:c++ -*- */
00002 /*
00003  *  this is part of Spm
00004  *
00005  *  Copyright (c) 2008 Guillaume Chevallereau
00006  *
00007  *  This program is free software. You can redistribute it and/or modify it 
00008  *  under the terms of the GNU General Public License as published by the 
00009  *  Free Software Foundation. Either version 2 of the license or (at your 
00010  *  option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be usefull but WITHOUT
00013  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
00014  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
00015  *  more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License along 
00018  *  with this program; if not, write to the Free Software Foundation, Inc., 
00019  *  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
00020  */
00021 #ifndef REPOSITERY_MANAGER_H
00022 #define REPOSITERY_MANAGER_H
00023 
00024 #include <boost/utility.hpp>
00025 #include <boost/shared_ptr.hpp>
00026 #include <map>
00027 #include <miniXml/ustring.h>
00028 #include "repositery.h"
00029 #include "store.h"
00030 
00031 namespace Spm
00032 {
00033   namespace Core
00034   {
00035     class RepositeryManager : public boost::noncopyable
00036     {
00037     private:
00038       static std::map<miniXml::ustring,
00039                       boost::shared_ptr<RepositeryManager> > instances_;
00040       std::vector<Repositery *> repositerys_;
00041       RepositeryManagerStore * pRepositeryStore_;
00042       miniXml::ustring user_;
00043     public:
00044       typedef std::vector<Repositery *>::iterator iterator;
00045       typedef std::vector<Repositery *>::reverse_iterator reverse_iterator;
00046       typedef std::vector<Repositery *>::const_iterator const_iterator;
00047       typedef std::vector<Repositery *>::const_reverse_iterator const_reverse_iterator;
00048       static boost::shared_ptr<RepositeryManager> & instance(const miniXml::ustring & user);
00049       RepositeryManager (const miniXml::ustring & user);
00050 
00051       const miniXml::ustring & user()
00052       {
00053         return user_;
00054       }
00055 
00056       const miniXml::ustring & user() const
00057       {
00058         return user_;
00059       }
00060 
00061       void add (Repositery * repositery);
00062       void remove (Repositery * repositery);
00063       void remove (iterator iter);
00064       
00065       iterator begin ()
00066       {
00067         return repositerys_.begin ();
00068       }
00069 
00070       iterator end ()
00071       {
00072         return repositerys_.end ();
00073       }
00074 
00075       const_iterator begin () const
00076       {
00077         return repositerys_.begin ();
00078       }
00079 
00080       const_iterator end () const
00081       {
00082         return repositerys_.end ();
00083       }
00084 
00085       reverse_iterator rbegin ()
00086       {
00087         return repositerys_.rbegin ();
00088       }
00089 
00090       reverse_iterator rend ()
00091       {
00092         return repositerys_.rend ();
00093       }
00094 
00095       const_reverse_iterator rbegin () const
00096       {
00097         return repositerys_.rbegin ();
00098       }
00099 
00100       const_reverse_iterator rend () const
00101       {
00102         return repositerys_.rend ();
00103       }
00104       
00105       iterator find (const miniXml::ustring & name);
00106     };
00107   }
00108 }
00109 #endif

Generated on Sat Mar 21 17:00:14 2009 for libSpm by  doxygen 1.5.2