fa708ee723fb2c6cc260191d5b1b1e9ffb71f781
[platform/upstream/libzypp.git] / zypp / ResPool.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/ResPool.cc
10  *
11 */
12 #include <iostream>
13 //#include "zypp/base/Logger.h"
14
15 #include "zypp/base/SerialNumber.h"
16
17 #include "zypp/ZYppFactory.h"
18 #include "zypp/ResPool.h"
19 #include "zypp/pool/PoolImpl.h"
20 #include "zypp/pool/PoolStats.h"
21
22 using std::endl;
23
24 ///////////////////////////////////////////////////////////////////
25 namespace zypp
26 { /////////////////////////////////////////////////////////////////
27
28   ///////////////////////////////////////////////////////////////////
29   //
30   //    METHOD NAME : ResPool::instance
31   //    METHOD TYPE : ResPool
32   //
33   ResPool ResPool::instance()
34   {
35     static ResPool _val( pool::PoolTraits::Impl_Ptr( new pool::PoolImpl ) );
36     return _val;
37   }
38
39   ///////////////////////////////////////////////////////////////////
40   //
41   //    METHOD NAME : ResPool::ResPool
42   //    METHOD TYPE : Ctor
43   //
44   ResPool::ResPool( pool::PoolTraits::Impl_Ptr impl_r )
45   : _pimpl( impl_r )
46   {}
47
48   ///////////////////////////////////////////////////////////////////
49   //
50   // Forward to impementation:
51   //
52   ///////////////////////////////////////////////////////////////////
53
54   ResPoolProxy ResPool::proxy() const
55   { return _pimpl->proxy( *this ); }
56
57   Resolver & ResPool::resolver() const
58   { return *getZYpp()->resolver(); }
59
60   const SerialNumber & ResPool::serial() const
61   { return _pimpl->serial(); }
62
63   bool ResPool::empty() const
64   { return _pimpl->empty(); }
65
66   ResPool::size_type ResPool::size() const
67   { return _pimpl->size(); }
68
69
70   PoolItem ResPool::find( const sat::Solvable & slv_r ) const
71   { return _pimpl->find( slv_r ); }
72
73
74   ResPool::size_type ResPool::knownRepositoriesSize() const
75   { return _pimpl->knownRepositoriesSize(); }
76
77   ResPool::repository_iterator ResPool::knownRepositoriesBegin() const
78   { return _pimpl->knownRepositoriesBegin(); }
79
80   ResPool::repository_iterator ResPool::knownRepositoriesEnd() const
81   { return _pimpl->knownRepositoriesEnd(); }
82
83   Repository ResPool::reposFind( const std::string & alias_r ) const
84   { return _pimpl->reposFind( alias_r ); }
85
86   bool ResPool::hardLockQueriesEmpty() const
87   { return _pimpl->hardLockQueries().empty(); }
88
89   ResPool::size_type ResPool::hardLockQueriesSize() const
90   { return _pimpl->hardLockQueries().size(); }
91
92   ResPool::hardLockQueries_iterator ResPool::hardLockQueriesBegin() const
93   { return _pimpl->hardLockQueries().begin(); }
94
95   ResPool::hardLockQueries_iterator ResPool::hardLockQueriesEnd() const
96   { return _pimpl->hardLockQueries().end(); }
97
98   void ResPool::setHardLockQueries( const HardLockQueries & newLocks_r )
99   { _pimpl->setHardLockQueries( newLocks_r ); }
100
101   void ResPool::getHardLockQueries( HardLockQueries & activeLocks_r )
102   { _pimpl->getHardLockQueries( activeLocks_r ); }
103
104
105   const pool::PoolTraits::ItemContainerT & ResPool::store() const
106   { return _pimpl->store(); }
107
108   const pool::PoolTraits::Id2ItemT & ResPool::id2item() const
109   { return _pimpl->id2item(); }
110
111   ///////////////////////////////////////////////////////////////////
112   //
113   // Forward to sat::Pool:
114   //
115   ///////////////////////////////////////////////////////////////////
116   void ResPool::setRequestedLocales( const LocaleSet & locales_r )
117   { sat::Pool::instance().setRequestedLocales( locales_r ); }
118
119   bool ResPool::addRequestedLocale( const Locale & locale_r )
120   { return sat::Pool::instance().addRequestedLocale( locale_r ); }
121
122   bool ResPool::eraseRequestedLocale( const Locale & locale_r )
123   { return sat::Pool::instance().eraseRequestedLocale( locale_r ); }
124
125   const LocaleSet & ResPool::getRequestedLocales() const
126   { return sat::Pool::instance().getRequestedLocales(); }
127
128   bool ResPool::isRequestedLocale( const Locale & locale_r ) const
129   { return sat::Pool::instance().isRequestedLocale( locale_r ); }
130
131   const LocaleSet & ResPool::getAvailableLocales() const
132   { return sat::Pool::instance().getAvailableLocales(); }
133
134   bool ResPool::isAvailableLocale( const Locale & locale_r ) const
135   { return sat::Pool::instance().isAvailableLocale( locale_r ); }
136
137   /******************************************************************
138   **
139   **    FUNCTION NAME : operator<<
140   **    FUNCTION TYPE : std::ostream &
141   */
142   std::ostream & operator<<( std::ostream & str, const ResPool & obj )
143   {
144     return dumpPoolStats( str << "ResPool " << sat::Pool::instance() << endl << "  ",
145                           obj.begin(), obj.end() );
146   }
147
148   /////////////////////////////////////////////////////////////////
149 } // namespace zypp
150 ///////////////////////////////////////////////////////////////////