backup
[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/ResPool.h"
18 #include "zypp/pool/PoolImpl.h"
19 #include "zypp/pool/PoolStats.h"
20
21 using std::endl;
22
23 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26
27   ///////////////////////////////////////////////////////////////////
28   //
29   //    METHOD NAME : ResPool::instance
30   //    METHOD TYPE : ResPool
31   //
32   ResPool ResPool::instance()
33   {
34     static ResPool _val( pool::PoolTraits::Impl_Ptr( new pool::PoolImpl ) );
35     return _val;
36   }
37
38   ///////////////////////////////////////////////////////////////////
39   //
40   //    METHOD NAME : ResPool::ResPool
41   //    METHOD TYPE : Ctor
42   //
43   ResPool::ResPool( pool::PoolTraits::Impl_Ptr impl_r )
44   : _pimpl( impl_r )
45   {}
46
47   ///////////////////////////////////////////////////////////////////
48   //
49   // Forward to impementation:
50   //
51   ///////////////////////////////////////////////////////////////////
52
53   ResPoolProxy ResPool::proxy() const
54   { return _pimpl->proxy( *this ); }
55
56   const SerialNumber & ResPool::serial() const
57   { return _pimpl->serial(); }
58
59   bool ResPool::empty() const
60   { return _pimpl->empty(); }
61
62   ResPool::size_type ResPool::size() const
63   { return _pimpl->size(); }
64
65
66   PoolItem ResPool::find( const sat::Solvable & slv_r ) const
67   { return _pimpl->find( slv_r ); }
68
69
70   ResPool::size_type ResPool::knownRepositoriesSize() const
71   { return _pimpl->knownRepositoriesSize(); }
72
73   ResPool::repository_iterator ResPool::knownRepositoriesBegin() const
74   { return _pimpl->knownRepositoriesBegin(); }
75
76   ResPool::repository_iterator ResPool::knownRepositoriesEnd() const
77   { return _pimpl->knownRepositoriesEnd(); }
78
79
80   bool ResPool::autoSoftLocksEmpty() const
81   { return _pimpl->autoSoftLocks().empty(); }
82
83   ResPool::size_type ResPool::autoSoftLocksSize() const
84   { return _pimpl->autoSoftLocks().size(); }
85
86   ResPool::autoSoftLocks_iterator ResPool::autoSoftLocksBegin() const
87   { return _pimpl->autoSoftLocks().begin(); }
88
89   ResPool::autoSoftLocks_iterator ResPool::autoSoftLocksEnd() const
90   { return _pimpl->autoSoftLocks().end(); }
91
92   void ResPool::setAutoSoftLocks( const AutoSoftLocks & newLocks_r )
93   { _pimpl->setAutoSoftLocks( newLocks_r ); }
94
95   void ResPool::getActiveSoftLocks( AutoSoftLocks & activeLocks_r )
96   { _pimpl->getActiveSoftLocks( activeLocks_r ); }
97
98
99   bool ResPool::hardLockQueriesEmpty() const
100   { return _pimpl->hardLockQueries().empty(); }
101
102   ResPool::size_type ResPool::hardLockQueriesSize() const
103   { return _pimpl->hardLockQueries().size(); }
104
105   ResPool::hardLockQueries_iterator ResPool::hardLockQueriesBegin() const
106   { return _pimpl->hardLockQueries().begin(); }
107
108   ResPool::hardLockQueries_iterator ResPool::hardLockQueriesEnd() const
109   { return _pimpl->hardLockQueries().end(); }
110
111   void ResPool::setHardLockQueries( const HardLockQueries & newLocks_r )
112   { _pimpl->setHardLockQueries( newLocks_r ); }
113
114   void ResPool::getHardLockQueries( HardLockQueries & activeLocks_r )
115   { _pimpl->getHardLockQueries( activeLocks_r ); }
116
117
118   const pool::PoolTraits::ItemContainerT & ResPool::store() const
119   { return _pimpl->store(); }
120
121   const pool::PoolTraits::Id2ItemT & ResPool::id2item() const
122   { return _pimpl->id2item(); }
123
124   ///////////////////////////////////////////////////////////////////
125   //
126   // Forward to sat::Pool:
127   //
128   ///////////////////////////////////////////////////////////////////
129   void ResPool::setRequestedLocales( const LocaleSet & locales_r )
130   { sat::Pool::instance().setRequestedLocales( locales_r ); }
131
132   bool ResPool::addRequestedLocale( const Locale & locale_r )
133   { return sat::Pool::instance().addRequestedLocale( locale_r ); }
134
135   bool ResPool::eraseRequestedLocale( const Locale & locale_r )
136   { return sat::Pool::instance().eraseRequestedLocale( locale_r ); }
137
138   const LocaleSet & ResPool::getRequestedLocales() const
139   { return sat::Pool::instance().getRequestedLocales(); }
140
141   bool ResPool::isRequestedLocale( const Locale & locale_r ) const
142   { return sat::Pool::instance().isRequestedLocale( locale_r ); }
143
144   const LocaleSet & ResPool::getAvailableLocales() const
145   { return sat::Pool::instance().getAvailableLocales(); }
146
147   bool ResPool::isAvailableLocale( const Locale & locale_r ) const
148   { return sat::Pool::instance().isAvailableLocale( locale_r ); }
149
150   /******************************************************************
151   **
152   **    FUNCTION NAME : operator<<
153   **    FUNCTION TYPE : std::ostream &
154   */
155   std::ostream & operator<<( std::ostream & str, const ResPool & obj )
156   {
157     return dumpPoolStats( str << "ResPool " << sat::Pool::instance() << endl << "  ",
158                           obj.begin(), obj.end() );
159   }
160
161   /////////////////////////////////////////////////////////////////
162 } // namespace zypp
163 ///////////////////////////////////////////////////////////////////