- eliminated Source(typedef) which is in fact Source_Ref.
[platform/upstream/libzypp.git] / zypp / zypp_detail / ZYppImpl.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/zypp_detail/ZYppImpl.cc
10  *
11 */
12 #include <iostream>
13 //#include "zypp/base/Logger.h"
14
15 #include "zypp/zypp_detail/ZYppImpl.h"
16
17 using std::endl;
18
19 ///////////////////////////////////////////////////////////////////
20 namespace zypp
21 { /////////////////////////////////////////////////////////////////
22   ///////////////////////////////////////////////////////////////////
23   namespace zypp_detail
24   { /////////////////////////////////////////////////////////////////
25
26     ///////////////////////////////////////////////////////////////////
27     //
28     //  METHOD NAME : ZYppImpl::ZYppImpl
29     //  METHOD TYPE : Constructor
30     //
31     ZYppImpl::ZYppImpl()
32     : _pool()
33     , _sourceFeed( _pool )
34     {
35     }
36
37     ///////////////////////////////////////////////////////////////////
38     //
39     //  METHOD NAME : ZYppImpl::~ZYppImpl
40     //  METHOD TYPE : Destructor
41     //
42     ZYppImpl::~ZYppImpl()
43     {
44     }
45
46     void ZYppImpl::addResolvables (const ResStore& store, bool installed)
47     {
48         _pool.insert(store.begin(), store.end(), installed);
49     }
50
51     void ZYppImpl::removeResolvables (const ResStore& store)
52     {
53         for (ResStore::iterator it = store.begin(); it != store.end(); it++)
54         {
55             _pool.erase(*it);
56         }
57     }
58
59     Target_Ptr ZYppImpl::target() const
60     {
61       if (! _target)
62         ZYPP_THROW(Exception("Target not initialized."));
63       return _target;
64      }
65
66     void ZYppImpl::initTarget(const Pathname & root)
67     {
68        if (_target)
69          _target = Target_Ptr();
70 #warning FIXME does this release the memory? _target is intrusive_ptr<Target>. Once more below...
71        _target = new Target(root);
72      }
73
74     void ZYppImpl::finishTarget()
75     {
76 //      if (_target)
77 //      _target = 0;
78       _target = 0;
79     }
80
81     /******************************************************************
82      **
83      ** FUNCTION NAME : operator<<
84      ** FUNCTION TYPE : std::ostream &
85     */
86     std::ostream & operator<<( std::ostream & str, const ZYppImpl & obj )
87     {
88       return str << "ZYppImpl";
89     }
90
91     /////////////////////////////////////////////////////////////////
92   } // namespace zypp_detail
93   ///////////////////////////////////////////////////////////////////
94   /////////////////////////////////////////////////////////////////
95 } // namespace zypp
96 ///////////////////////////////////////////////////////////////////