CacheTypes.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP2_CACHE_CACHETYPES_H
00013 #define ZYPP2_CACHE_CACHETYPES_H
00014 
00015 #include <iosfwd>
00016 
00017 #include <map>
00018 #include <string>
00019 #include "zypp/Rel.h"
00020 #include "zypp/Arch.h"
00021 #include "zypp/ResTraits.h"
00022 #include "zypp/Dep.h"
00023 #include "zypp/Resolvable.h"
00024 #include "zypp/Pathname.h"
00025 #include "zypp/data/RecordId.h"
00026 
00028 namespace zypp
00029 { 
00030 
00031   namespace cache
00032   { 
00033 
00035     //
00036     //  CLASS NAME : CacheTypes
00037     //
00045     class CacheTypes
00046     {
00047       friend std::ostream & operator<<( std::ostream & str, const CacheTypes & obj );
00048     public:
00055       CacheTypes( const Pathname &dbdir );
00056       
00058       ~CacheTypes();
00059  
00067       Rel relationFor( const data::RecordId &id );
00068       
00076       data::RecordId idForRelation( const Rel &rel );
00077       
00085       Resolvable::Kind kindFor( const data::RecordId &id );
00086 
00094       data::RecordId idForKind( const Resolvable::Kind & kind );
00095       
00103       Dep deptypeFor( const data::RecordId &id );
00104       
00112       data::RecordId idForDeptype( const Dep & dep );
00113       
00121       Arch archFor( const data::RecordId &id );
00122       
00130       data::RecordId idForArch( const Arch & arch );
00131       
00132     public:
00133 
00134     private:
00135       void refreshCache();
00136       
00137       std::map<data::RecordId, Rel> _rel_cache;
00138       std::map<data::RecordId, Resolvable::Kind> _kind_cache;
00139       std::map<data::RecordId, std::string> _deptype_cache;
00140       std::map<data::RecordId, Arch> _arch_cache;
00141       Pathname _dbdir;
00142     };
00144 
00146     std::ostream & operator<<( std::ostream & str, const CacheTypes & obj );
00147 
00149   } // namespace cache
00152 } // namespace zypp
00154 #endif // ZYPP2_CACHE_CACHETYPES_H

Generated on Tue Sep 25 19:23:00 2007 for libzypp by  doxygen 1.5.3