1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/target/TargetImpl.h
12 #ifndef ZYPP_TARGET_TARGETIMPL_H
13 #define ZYPP_TARGET_TARGETIMPL_H
17 #include "zypp/base/ReferenceCounted.h"
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/ResStore.h"
22 #include "zypp/Pathname.h"
23 #include "zypp/media/MediaAccess.h"
24 #include "zypp/Target.h"
25 #include "zypp/target/rpm/RpmDb.h"
26 #include "zypp/solver/detail/Types.h"
28 ///////////////////////////////////////////////////////////////////
30 { /////////////////////////////////////////////////////////////////
31 ///////////////////////////////////////////////////////////////////
33 { /////////////////////////////////////////////////////////////////
35 DEFINE_PTR_TYPE(TargetImpl);
37 ///////////////////////////////////////////////////////////////////
39 // CLASS NAME : TargetImpl
41 /** Base class for concrete Target implementations.
43 * Constructed by \ref TargetFactory. Public access via \ref Target
46 class TargetImpl : public base::ReferenceCounted, private base::NonCopyable
48 friend std::ostream & operator<<( std::ostream & str, const TargetImpl & obj );
52 TargetImpl(const Pathname & root_r = "/");
54 virtual ~TargetImpl();
56 /** Null implementation */
57 static TargetImpl_Ptr nullimpl();
61 /** All resolvables in the target. */
62 const ResStore & resolvables();
64 /** Sort according to prereqs and media numbers */
65 void getResolvablesToInsDel ( ResPool pool_r,
66 PoolItemList & dellist_r,
67 PoolItemList & instlist_r,
68 PoolItemList & srclist_r );
70 /** Commit changes in the pool */
71 #warning Add support for multiple medias - eg. limit only to CD1
72 void commit(ResPool pool_r);
74 /** Commit ordered changes */
75 void commit(const PoolItemList & items_r);
77 /** Overload to realize stream output. */
78 virtual std::ostream & dumpOn( std::ostream & str ) const
79 { return str << "TargetImpl"; }
81 /** The RPM database */
84 /** If the package is installed and provides the file
85 Needed to evaluate split provides during Resolver::Upgrade() */
86 bool providesFile (const std::string & path_str, const std::string & name_str) const;
88 /** Return the resolvable which provides path_str (rpm -qf)
89 return NULL if no resolvable provides this file */
90 ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
93 /** All resolvables provided by the target. */
95 /** Path to the target */
100 /** Null implementation */
101 static TargetImpl_Ptr _nullimpl;
103 ///////////////////////////////////////////////////////////////////
105 /** \relates TargetImpl Stream output */
106 inline std::ostream & operator<<( std::ostream & str, const TargetImpl & obj )
107 { return obj.dumpOn( str ); }
109 /////////////////////////////////////////////////////////////////
110 } // namespace target
111 ///////////////////////////////////////////////////////////////////
112 /////////////////////////////////////////////////////////////////
114 ///////////////////////////////////////////////////////////////////
115 #endif // ZYPP_TARGET_TARGETIMPL_H