Imported Upstream version 14.45.0
[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/Tr1hash.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 struct _Solvable;
23 struct _Repo;
24 struct _Pool;
25 }
26
27 ///////////////////////////////////////////////////////////////////
28 namespace zypp
29 { /////////////////////////////////////////////////////////////////
30
31   class IdString;
32   class Capability;
33   class Capabilities;
34   class Repository;
35   class RepoInfo;
36
37   ///////////////////////////////////////////////////////////////////
38   namespace detail
39   {
40     class RepoIterator;
41     class ByRepository;
42   }
43
44   ///////////////////////////////////////////////////////////////////
45   namespace sat
46   { /////////////////////////////////////////////////////////////////
47
48     class Pool;
49     class Solvable;
50
51     ///////////////////////////////////////////////////////////////////
52     namespace detail
53     { /////////////////////////////////////////////////////////////////
54
55       class PoolImpl;
56
57       ///////////////////////////////////////////////////////////////////
58       //
59       //        CLASS NAME : PoolMember
60       //
61       /** Backlink to the associated \ref PoolImpl.
62        * Simple as we currently use one global PoolImpl. If we change our
63        * minds this is where we'd store and do the \c Id to \ref PoolImpl
64        * mapping.
65        */
66       struct PoolMember
67       {
68         static PoolImpl & myPool();
69       };
70       ///////////////////////////////////////////////////////////////////
71
72       /////////////////////////////////////////////////////////////////
73     } // namespace detail
74     ///////////////////////////////////////////////////////////////////
75
76
77     ///////////////////////////////////////////////////////////////////
78     namespace detail
79     { /////////////////////////////////////////////////////////////////
80
81       /** Generic Id type. */
82       typedef int IdType;
83       static const IdType noId( 0 );
84       static const IdType emptyId( 1 );
85
86       /** Internal ids satlib includes in dependencies.
87        * MPL check in PoolImpl.cc
88       */
89       static const IdType solvablePrereqMarker( 15 );
90       static const IdType solvableFileMarker  ( 16 );
91       /** Test for internal ids satlib includes in dependencies. */
92       inline bool isDepMarkerId( IdType id_r )
93       { return( id_r == solvablePrereqMarker || id_r == solvableFileMarker ); }
94
95       /** Id type to connect \ref Solvable and sat-solvable.
96        * Indext into solvable array.
97       */
98       typedef unsigned SolvableIdType;
99       typedef SolvableIdType size_type;
100       /** Id to denote \ref Solvable::noSolvable. */
101       static const SolvableIdType noSolvableId( 0 );
102       /** Id to denote the usually hidden \ref Solvable::systemSolvable. */
103       static const SolvableIdType systemSolvableId( 1 );
104
105       /** Id type to connect \ref Repo and sat-repo. */
106       typedef ::_Repo * RepoIdType;
107       /** Id to denote \ref Repo::noRepository. */
108       static const RepoIdType noRepoId( 0 );
109
110       /////////////////////////////////////////////////////////////////
111     } // namespace detail
112     ///////////////////////////////////////////////////////////////////
113
114
115     ///////////////////////////////////////////////////////////////////
116     namespace detail
117     { /////////////////////////////////////////////////////////////////
118
119       class SolvableIterator;
120
121       /////////////////////////////////////////////////////////////////
122     } // namespace detail
123     ///////////////////////////////////////////////////////////////////
124
125     /////////////////////////////////////////////////////////////////
126   } // namespace sat
127   ///////////////////////////////////////////////////////////////////
128   /////////////////////////////////////////////////////////////////
129 } // namespace zypp
130 ///////////////////////////////////////////////////////////////////
131 #endif // ZYPP_SAT_DETAIL_POOLMEMBER_H