added preliminary commit function for target
[platform/upstream/libzypp.git] / zypp / Target.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Target.cc
10  *
11 */
12 #include <cassert>
13
14 #include <iostream>
15
16 #include "zypp/Target.h"
17 #include "zypp/target/TargetImpl.h"
18
19 using namespace std;
20
21 ///////////////////////////////////////////////////////////////////
22 namespace zypp
23 { /////////////////////////////////////////////////////////////////
24
25   IMPL_PTR_TYPE(Target);
26
27   ///////////////////////////////////////////////////////////////////
28   //
29   //    METHOD NAME : Target::Target
30   //    METHOD TYPE : Ctor
31   //
32   Target::Target( const Pathname & root )
33   {
34     _pimpl = RW_pointer<Impl, rw_pointer::Intrusive<Impl> >(new Impl(root));
35   }
36
37   ///////////////////////////////////////////////////////////////////
38   //
39   //    METHOD NAME : Target::Target
40   //    METHOD TYPE : Ctor
41   //
42   Target::Target( const Impl_Ptr & impl_r )
43   : _pimpl( impl_r )
44   {
45     assert( impl_r );
46   }
47
48   Target_Ptr Target::_nullimpl;
49
50   /** Null implementation */
51   Target_Ptr Target::nullimpl()
52   {
53     if (! _nullimpl)
54     {
55       _nullimpl = new Target(target::TargetImpl::nullimpl());
56     }
57     return _nullimpl;
58   }
59
60
61   ///////////////////////////////////////////////////////////////////
62   //
63   //    Forward to TargetImpl:
64   //
65   ///////////////////////////////////////////////////////////////////
66
67   const ResStore & Target::resolvables()
68   { return _pimpl->resolvables(); }
69
70   target::rpm::RpmDb & Target::rpmDb()
71   { return _pimpl->rpm(); }
72
73   void Target::commit(ResPool & pool_r)
74   { return _pimpl->commit(pool_r); }
75
76   std::ostream & Target::dumpOn( std::ostream & str ) const
77   { return _pimpl->dumpOn( str ); }
78
79
80   /////////////////////////////////////////////////////////////////
81 } // namespace zypp
82 ///////////////////////////////////////////////////////////////////