pass initial status (installed/uninstalled) all way through
[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     {
33     }
34
35     ///////////////////////////////////////////////////////////////////
36     //
37     //  METHOD NAME : ZYppImpl::~ZYppImpl
38     //  METHOD TYPE : Destructor
39     //
40     ZYppImpl::~ZYppImpl()
41     {
42     }
43
44     void ZYppImpl::addResolvables (const ResStore& store, bool installed)
45     {
46         _pool.insert(store.begin(), store.end(), installed);
47     }
48     
49     void ZYppImpl::removeResolvables (const ResStore& store)
50     {
51         for (ResStore::iterator it = store.begin(); it != store.end(); it++)
52         {
53             _pool.erase(*it);
54         }
55     }
56
57     Target_Ptr ZYppImpl::target() const
58     {
59       if (! _target)
60         ZYPP_THROW(Exception("Target not initialized."));
61       return _target;
62      }
63   
64     void ZYppImpl::initTarget(const Pathname & root)
65     {
66        if (_target)
67          _target = Target_Ptr();
68 #warning FIXME does this release the memory? _target is intrusive_ptr<Target>. Once more below...
69        _target = new Target(root);
70      }
71   
72     void ZYppImpl::finishTarget()
73     {
74 //      if (_target)
75 //      _target = 0;
76       _target = 0;
77     }
78     
79     /******************************************************************
80      **
81      ** FUNCTION NAME : operator<<
82      ** FUNCTION TYPE : std::ostream &
83     */
84     std::ostream & operator<<( std::ostream & str, const ZYppImpl & obj )
85     {
86       return str << "ZYppImpl";
87     }
88
89     /////////////////////////////////////////////////////////////////
90   } // namespace zypp_detail
91   ///////////////////////////////////////////////////////////////////
92   /////////////////////////////////////////////////////////////////
93 } // namespace zypp
94 ///////////////////////////////////////////////////////////////////