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