avoid map in PoolImpl
[platform/upstream/libzypp.git] / zypp / pool / PoolTraits.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/pool/PoolTraits.h
10  *
11 */
12 #ifndef ZYPP_POOL_POOLTRAITS_H
13 #define ZYPP_POOL_POOLTRAITS_H
14
15 #include <set>
16 #include <map>
17
18 #include "zypp/base/Iterator.h"
19
20 #include "zypp/PoolItem.h"
21 #include "zypp/sat/Pool.h"
22
23 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26
27   class CapAndItem;
28   class Repository;
29
30   ///////////////////////////////////////////////////////////////////
31   namespace pool
32   { /////////////////////////////////////////////////////////////////
33
34     class PoolImpl;
35
36     struct ByPoolItem
37     {
38       bool operator()( const PoolItem & pi ) const
39       { return pi; }
40     };
41
42     ///////////////////////////////////////////////////////////////////
43     //
44     //  CLASS NAME : PoolTraits
45     //
46     /** */
47     struct PoolTraits
48     {
49     public:
50       typedef sat::detail::SolvableIdType               SolvableIdType;
51       /** pure items  */
52 #if 0
53        typedef std::map<sat::Solvable,PoolItem>         ItemContainerT;
54        typedef MapKVIteratorTraits<ItemContainerT>::Value_const_iterator
55                                                         const_iterator;
56 #endif
57       typedef std::vector<PoolItem>                     ItemContainerT;
58       typedef ItemContainerT::const_iterator            item_iterator;
59       typedef filter_iterator<ByPoolItem,ItemContainerT::const_iterator>
60                                                         const_iterator;
61       typedef ItemContainerT::size_type                 size_type;
62
63       // internal organization
64       typedef std::list<zypp::CapAndItem>               CapItemContainerT;      // (why,who) pairs
65       typedef std::map<std::string,CapItemContainerT>   CapItemStoreT;          // capability.index -> (why,who) pairs
66       typedef std::map<Dep,CapItemStoreT>               DepCapItemContainerT;   // Dep -> (capability.index -> (why,who) pairs)
67
68       typedef CapItemContainerT::iterator               capitemiterator;
69       typedef CapItemContainerT::const_iterator         const_capitemiterator;
70       typedef CapItemContainerT::size_type              capitemsize_type;
71       /** hashed by capability index */
72       typedef const_capitemiterator                     byCapabilityIndex_iterator;
73
74       /* list of known Repositories */
75       typedef std::list<Repository>                     RepoContainerT;
76       typedef RepoContainerT::const_iterator            repository_iterator;
77
78       typedef PoolImpl                   Impl;
79       typedef shared_ptr<PoolImpl>       Impl_Ptr;
80       typedef shared_ptr<const PoolImpl> Impl_constPtr;
81
82       /** Map of Capabilities and "who" has set it*/
83       typedef std::map<ResStatus::TransactByValue,Capabilities>         AdditionalCapabilities;
84
85     };
86     ///////////////////////////////////////////////////////////////////
87
88     /////////////////////////////////////////////////////////////////
89   } // namespace pool
90   ///////////////////////////////////////////////////////////////////
91   /////////////////////////////////////////////////////////////////
92 } // namespace zypp
93 ///////////////////////////////////////////////////////////////////
94 #endif // ZYPP_POOL_POOLTRAITS_H