repository_name_cache.hh

Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
00005  *
00006  * This file is part of the Paludis package manager. Paludis is free software;
00007  * you can redistribute it and/or modify it under the terms of the GNU General
00008  * Public License version 2, as published by the Free Software Foundation.
00009  *
00010  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
00011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013  * details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_CACHE_HH
00021 #define PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_CACHE_HH 1
00022 
00023 #include <paludis/util/private_implementation_pattern.hh>
00024 #include <paludis/name.hh>
00025 #include <tr1/memory>
00026 
00027 /** \file
00028  * Declarations for RepositoryNameCache, which is used by some Repository
00029  * subclasses to implement a names class.
00030  *
00031  * \ingroup g_repository
00032  *
00033  * \section Examples
00034  *
00035  * - None at this time.
00036  */
00037 
00038 namespace paludis
00039 {
00040     class FSEntry;
00041     class Repository;
00042 
00043     /**
00044      * Used by various Repository subclasses to implement a names cache.
00045      *
00046      * \see Repository
00047      * \ingroup g_repository
00048      * \nosubgrouping
00049      */
00050     class PALUDIS_VISIBLE RepositoryNameCache :
00051         private PrivateImplementationPattern<RepositoryNameCache>
00052     {
00053         public:
00054             ///\name Basic operations
00055             ///\{
00056 
00057             RepositoryNameCache(
00058                     const FSEntry & location,
00059                     const Repository * const repo);
00060 
00061             virtual ~RepositoryNameCache();
00062 
00063 
00064             ///\}
00065 
00066             ///\name Cache helper functions
00067             ///\{
00068 
00069             /**
00070              * Implement category_names_containing_package.
00071              *
00072              * May return a zero pointer, in which case the repository should
00073              * fall back to Repository::do_category_names_containing_package or
00074              * its own implementation.
00075              */
00076             std::tr1::shared_ptr<const CategoryNamePartSet> category_names_containing_package(
00077                     const PackageNamePart & p) const;
00078 
00079             /**
00080              * Whether or not our cache is usable.
00081              *
00082              * Initially this will be true. After the first query the value may
00083              * change to false (the query will return a zero pointer too).
00084              */
00085             bool usable() const PALUDIS_ATTRIBUTE((nothrow));
00086 
00087             /**
00088              * Implement cache regeneration.
00089              */
00090             void regenerate_cache() const;
00091 
00092             /**
00093              * Add a new package to the cache.
00094              */
00095             void add(const QualifiedPackageName &);
00096 
00097             /**
00098              * Remove a package from the cache.
00099              */
00100             void remove(const QualifiedPackageName &);
00101 
00102             ///\}
00103     };
00104 }
00105 
00106 #endif

Generated on Mon Sep 21 10:36:08 2009 for paludis by  doxygen 1.5.4