6819e51df4a1cd54f4105c619d392520065c88ae
[platform/upstream/libzypp.git] / zypp / sat / detail / PoolMember.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/sat/detail/PoolMember.h
10  *
11 */
12 #ifndef ZYPP_SAT_DETAIL_POOLMEMBER_H
13 #define ZYPP_SAT_DETAIL_POOLMEMBER_H
14
15 #include <solv/solvversion.h>
16
17 #include "zypp/base/Tr1hash.h"
18 #include "zypp/base/Iterator.h"
19 #include "zypp/base/String.h"
20 #include "zypp/base/Easy.h"
21
22 extern "C"
23 {
24   // Those _Type names are exposed as sat::detail::CType below!
25 #if ( LIBSOLV_VERSION >= 700 )
26   struct s_Dataiterator;
27   struct s_Datamatcher;
28   struct s_Map;
29   struct s_Pool;
30   struct s_Queue;
31   struct s_Repo;
32   struct s_Solvable;
33   struct s_Solver;
34   struct s_Transaction;
35 #else
36   struct _Dataiterator;
37   struct _Datamatcher;
38   struct _Map;
39   struct _Pool;
40   struct _Queue;
41   struct _Repo;
42   struct _Solvable;
43   struct _Solver;
44   struct _Transaction;
45 #endif
46 }
47
48 ///////////////////////////////////////////////////////////////////
49 namespace zypp
50 { /////////////////////////////////////////////////////////////////
51
52   class IdString;
53   class Capability;
54   class Capabilities;
55   class Repository;
56   class RepoInfo;
57
58   ///////////////////////////////////////////////////////////////////
59   namespace detail
60   {
61     class RepoIterator;
62     class ByRepository;
63   }
64
65   ///////////////////////////////////////////////////////////////////
66   namespace sat
67   { /////////////////////////////////////////////////////////////////
68
69     ///////////////////////////////////////////////////////////////////
70     namespace detail
71     {
72 #if ( LIBSOLV_VERSION >= 700 )
73       typedef ::s_Dataiterator  CDataiterator;  ///< Wrapped libsolv C data type exposed as backdoor
74       typedef ::s_Datamatcher   CDatamatcher;   ///< Wrapped libsolv C data type exposed as backdoor
75       typedef ::s_Map           CMap;           ///< Wrapped libsolv C data type exposed as backdoor
76       typedef ::s_Pool          CPool;          ///< Wrapped libsolv C data type exposed as backdoor
77       typedef ::s_Queue         CQueue;         ///< Wrapped libsolv C data type exposed as backdoor
78       typedef ::s_Repo          CRepo;          ///< Wrapped libsolv C data type exposed as backdoor
79       typedef ::s_Solvable      CSolvable;      ///< Wrapped libsolv C data type exposed as backdoor
80       typedef ::s_Solver        CSolver;        ///< Wrapped libsolv C data type exposed as backdoor
81       typedef ::s_Transaction   CTransaction;   ///< Wrapped libsolv C data type exposed as backdoor
82 #else
83       typedef ::_Dataiterator   CDataiterator;  ///< Wrapped libsolv C data type exposed as backdoor
84       typedef ::_Datamatcher    CDatamatcher;   ///< Wrapped libsolv C data type exposed as backdoor
85       typedef ::_Map            CMap;           ///< Wrapped libsolv C data type exposed as backdoor
86       typedef ::_Pool           CPool;          ///< Wrapped libsolv C data type exposed as backdoor
87       typedef ::_Queue          CQueue;         ///< Wrapped libsolv C data type exposed as backdoor
88       typedef ::_Repo           CRepo;          ///< Wrapped libsolv C data type exposed as backdoor
89       typedef ::_Solvable       CSolvable;      ///< Wrapped libsolv C data type exposed as backdoor
90       typedef ::_Solver         CSolver;        ///< Wrapped libsolv C data type exposed as backdoor
91       typedef ::_Transaction    CTransaction;   ///< Wrapped libsolv C data type exposed as backdoor
92 #endif
93     } // namespace detail
94     ///////////////////////////////////////////////////////////////////
95
96     class Pool;
97     class Solvable;
98
99     ///////////////////////////////////////////////////////////////////
100     namespace detail
101     { /////////////////////////////////////////////////////////////////
102
103       class PoolImpl;
104
105       ///////////////////////////////////////////////////////////////////
106       //
107       //        CLASS NAME : PoolMember
108       //
109       /** Backlink to the associated \ref PoolImpl.
110        * Simple as we currently use one global PoolImpl. If we change our
111        * minds this is where we'd store and do the \c Id to \ref PoolImpl
112        * mapping.
113        */
114       struct PoolMember
115       {
116         static PoolImpl & myPool();
117       };
118       ///////////////////////////////////////////////////////////////////
119
120       /////////////////////////////////////////////////////////////////
121     } // namespace detail
122     ///////////////////////////////////////////////////////////////////
123
124
125     ///////////////////////////////////////////////////////////////////
126     namespace detail
127     { /////////////////////////////////////////////////////////////////
128
129       /** Generic Id type. */
130       typedef int IdType;
131       static const IdType noId( 0 );
132       static const IdType emptyId( 1 );
133
134       /** Internal ids satlib includes in dependencies.
135        * MPL check in PoolImpl.cc
136       */
137       static const IdType solvablePrereqMarker( 15 );
138       static const IdType solvableFileMarker  ( 16 );
139       /** Test for internal ids satlib includes in dependencies. */
140       inline bool isDepMarkerId( IdType id_r )
141       { return( id_r == solvablePrereqMarker || id_r == solvableFileMarker ); }
142
143       /** Id type to connect \ref Solvable and sat-solvable.
144        * Indext into solvable array.
145       */
146       typedef unsigned SolvableIdType;
147       typedef SolvableIdType size_type;
148       /** Id to denote \ref Solvable::noSolvable. */
149       static const SolvableIdType noSolvableId( 0 );
150       /** Id to denote the usually hidden \ref Solvable::systemSolvable. */
151       static const SolvableIdType systemSolvableId( 1 );
152
153       /** Id type to connect \ref Repo and sat-repo. */
154       typedef CRepo * RepoIdType;
155       /** Id to denote \ref Repo::noRepository. */
156       static const RepoIdType noRepoId( 0 );
157
158       /////////////////////////////////////////////////////////////////
159     } // namespace detail
160     ///////////////////////////////////////////////////////////////////
161
162
163     ///////////////////////////////////////////////////////////////////
164     namespace detail
165     { /////////////////////////////////////////////////////////////////
166
167       class SolvableIterator;
168
169       /////////////////////////////////////////////////////////////////
170     } // namespace detail
171     ///////////////////////////////////////////////////////////////////
172
173     /////////////////////////////////////////////////////////////////
174   } // namespace sat
175   ///////////////////////////////////////////////////////////////////
176   /////////////////////////////////////////////////////////////////
177 } // namespace zypp
178 ///////////////////////////////////////////////////////////////////
179 #endif // ZYPP_SAT_DETAIL_POOLMEMBER_H