Imported Upstream version 16.3.2
[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 "zypp/base/Hash.h"
16 #include "zypp/base/Iterator.h"
17 #include "zypp/base/String.h"
18 #include "zypp/base/Easy.h"
19
20 extern "C"
21 {
22   // Those _Type names are exposed as sat::detail::CType below!
23   struct _Dataiterator;
24   struct _Datamatcher;
25   struct _Map;
26   struct _Pool;
27   struct _Queue;
28   struct _Repo;
29   struct _Solvable;
30   struct _Solver;
31   struct _Transaction;
32 }
33
34 ///////////////////////////////////////////////////////////////////
35 namespace zypp
36 { /////////////////////////////////////////////////////////////////
37
38   class IdString;
39   class Capability;
40   class Capabilities;
41   class Repository;
42   class RepoInfo;
43
44   ///////////////////////////////////////////////////////////////////
45   namespace detail
46   {
47     class RepoIterator;
48     class ByRepository;
49   }
50
51   ///////////////////////////////////////////////////////////////////
52   namespace sat
53   { /////////////////////////////////////////////////////////////////
54
55     ///////////////////////////////////////////////////////////////////
56     namespace detail
57     {
58       typedef ::_Dataiterator   CDataiterator;  ///< Wrapped libsolv C data type exposed as backdoor
59       typedef ::_Datamatcher    CDatamatcher;   ///< Wrapped libsolv C data type exposed as backdoor
60       typedef ::_Map            CMap;           ///< Wrapped libsolv C data type exposed as backdoor
61       typedef ::_Pool           CPool;          ///< Wrapped libsolv C data type exposed as backdoor
62       typedef ::_Queue          CQueue;         ///< Wrapped libsolv C data type exposed as backdoor
63       typedef ::_Repo           CRepo;          ///< Wrapped libsolv C data type exposed as backdoor
64       typedef ::_Solvable       CSolvable;      ///< Wrapped libsolv C data type exposed as backdoor
65       typedef ::_Solver         CSolver;        ///< Wrapped libsolv C data type exposed as backdoor
66       typedef ::_Transaction    CTransaction;   ///< Wrapped libsolv C data type exposed as backdoor
67     } // namespace detail
68     ///////////////////////////////////////////////////////////////////
69
70     class Pool;
71     class Solvable;
72
73     ///////////////////////////////////////////////////////////////////
74     namespace detail
75     { /////////////////////////////////////////////////////////////////
76
77       class PoolImpl;
78
79       ///////////////////////////////////////////////////////////////////
80       //
81       //        CLASS NAME : PoolMember
82       //
83       /** Backlink to the associated \ref PoolImpl.
84        * Simple as we currently use one global PoolImpl. If we change our
85        * minds this is where we'd store and do the \c Id to \ref PoolImpl
86        * mapping.
87        */
88       struct PoolMember
89       {
90         static PoolImpl & myPool();
91       };
92       ///////////////////////////////////////////////////////////////////
93
94       /////////////////////////////////////////////////////////////////
95     } // namespace detail
96     ///////////////////////////////////////////////////////////////////
97
98
99     ///////////////////////////////////////////////////////////////////
100     namespace detail
101     { /////////////////////////////////////////////////////////////////
102
103       /** Generic Id type. */
104       typedef int IdType;
105       static const IdType noId( 0 );
106       static const IdType emptyId( 1 );
107
108       /** Internal ids satlib includes in dependencies.
109        * MPL check in PoolImpl.cc
110       */
111       static const IdType solvablePrereqMarker( 15 );
112       static const IdType solvableFileMarker  ( 16 );
113
114       static const IdType namespaceModalias     ( 18 );
115       static const IdType namespaceLanguage     ( 20 );
116       static const IdType namespaceFilesystem   ( 21 );
117
118       /** Test for internal ids satlib includes in dependencies. */
119       inline bool isDepMarkerId( IdType id_r )
120       { return( id_r == solvablePrereqMarker || id_r == solvableFileMarker ); }
121
122       /** Id type to connect \ref Solvable and sat-solvable.
123        * Indext into solvable array.
124       */
125       typedef unsigned SolvableIdType;
126       typedef SolvableIdType size_type;
127       /** Id to denote \ref Solvable::noSolvable. */
128       static const SolvableIdType noSolvableId( 0 );
129       /** Id to denote the usually hidden \ref Solvable::systemSolvable. */
130       static const SolvableIdType systemSolvableId( 1 );
131
132       /** Id type to connect \ref Repo and sat-repo. */
133       typedef ::_Repo * RepoIdType;
134       /** Id to denote \ref Repo::noRepository. */
135       static const RepoIdType noRepoId( 0 );
136
137       /////////////////////////////////////////////////////////////////
138     } // namespace detail
139     ///////////////////////////////////////////////////////////////////
140
141
142     ///////////////////////////////////////////////////////////////////
143     namespace detail
144     { /////////////////////////////////////////////////////////////////
145
146       class SolvableIterator;
147
148       /////////////////////////////////////////////////////////////////
149     } // namespace detail
150     ///////////////////////////////////////////////////////////////////
151
152     /////////////////////////////////////////////////////////////////
153   } // namespace sat
154   ///////////////////////////////////////////////////////////////////
155   /////////////////////////////////////////////////////////////////
156 } // namespace zypp
157 ///////////////////////////////////////////////////////////////////
158 #endif // ZYPP_SAT_DETAIL_POOLMEMBER_H