added preliminary commit function for target
[platform/upstream/libzypp.git] / zypp / Target.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Target.h
10  *
11 */
12 #ifndef ZYPP_TARGET_H
13 #define ZYPP_TARGET_H
14
15 #include <iosfwd>
16
17 #include "zypp/base/PtrTypes.h"
18
19 #include "zypp/ResStore.h"
20 #include "zypp/Pathname.h"
21 #include "zypp/ResPool.h"
22
23 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26   namespace target
27   {
28     class TargetImpl;
29     namespace rpm {
30       class RpmDb;
31     }
32   }
33
34   DEFINE_PTR_TYPE(Target);
35
36   ///////////////////////////////////////////////////////////////////
37   //
38   //    CLASS NAME : Target
39   //
40   /**
41   */
42   class Target : public base::ReferenceCounted, public base::NonCopyable
43   {
44   public:
45     typedef target::TargetImpl  Impl;
46     typedef intrusive_ptr<Impl> Impl_Ptr;
47
48   public:
49
50     /** All resolvables provided by the target. */
51     const ResStore & resolvables();
52     /** Null implementation */
53     static Target_Ptr nullimpl();
54     /** Refference to the RPM database */
55     target::rpm::RpmDb & rpmDb();
56     /** Comomit changes in the pool */
57     void commit(ResPool & pool_r);
58
59   public:
60     /** Ctor */
61     Target( const Pathname & root = "/" );
62     /** Ctor */
63     explicit
64     Target( const Impl_Ptr & impl_r );
65
66   private:
67     friend std::ostream & operator<<( std::ostream & str, const Target & obj );
68     /** Stream output. */
69     std::ostream & dumpOn( std::ostream & str ) const;
70
71   private:
72     /** Pointer to implementation */
73     RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
74
75     static Target_Ptr _nullimpl;
76
77   public:
78   };
79   ///////////////////////////////////////////////////////////////////
80
81   /** \relates Target Stream output. */
82   inline std::ostream & operator<<( std::ostream & str, const Target & obj )
83   { return obj.dumpOn( str ); }
84
85
86   /////////////////////////////////////////////////////////////////
87 } // namespace zypp
88 ///////////////////////////////////////////////////////////////////
89 #endif // ZYPP_TARGET_H