1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQPkgSelMapper.h
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQPkgSelMapper_h
21 #define YQPkgSelMapper_h
29 * Mapping from ZyppPkg to the correspoinding ZyppSel.
31 * All instances of this class share the same cache. The cache remains alive as
32 * long as any instance of this class exists.
39 * Constructor. Builds a cache, if necessary.
44 * Destructor. Clears the cache if this was the last YQPkgSelMapper
45 * (i.e. if refCount() reaches 0)
47 virtual ~YQPkgSelMapper();
50 * Find the corresponding ZyppSel to a ZyppPkg.
51 * Returns 0 if there is no corresponding ZyppSel.
54 ZyppSel findZyppSel( ZyppPkg pkg );
57 * Reference count - indicates how many instances of this class are alive
60 static int refCount() { return _refCount; }
63 * Rebuild the shared cache. This is expensive. Call this only when the
64 * ZyppPool has changed, i.e. after installation sources were added or
67 * Since the cache is shared, this affects all instances of this class.
74 typedef std::map<ZyppPkg, ZyppSel> Cache;
75 typedef std::pair<ZyppPkg, ZyppSel> CachePair;
76 typedef Cache::iterator CacheIterator;
84 #endif // YQPkgSelMapper_h