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 );
51 /** Sort according to prereqs and media numbers */
52 void getResolvablesToInsDel ( const ResPool pool_r,
53 PoolItemList & dellist_r,
54 PoolItemList & instlist_r,
55 PoolItemList & srclist_r );
60 TargetImpl(const Pathname & root_r = "/");
62 virtual ~TargetImpl();
64 /** Null implementation */
65 static TargetImpl_Ptr nullimpl();
69 /** All resolvables in the target. */
70 const ResStore & resolvables();
72 /** Commit changes in the pool
73 media = 0 means any/all medias
74 media > 0 means limit commits to this media */
75 void commit( ResPool pool_r, unsigned int medianr, PoolItemList & errors_r, PoolItemList & remaining_r, PoolItemList & srcremaining_r );
77 /** Commit ordered changes
78 return uncommitted ones (due to error) */
79 PoolItemList commit( const PoolItemList & items_r );
81 /** Overload to realize stream output. */
82 virtual std::ostream & dumpOn( std::ostream & str ) const
83 { return str << "TargetImpl"; }
85 /** The RPM database */
88 /** If the package is installed and provides the file
89 Needed to evaluate split provides during Resolver::Upgrade() */
90 bool providesFile (const std::string & path_str, const std::string & name_str) const;
92 /** Return the resolvable which provides path_str (rpm -qf)
93 return NULL if no resolvable provides this file */
94 ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
97 /** All resolvables provided by the target. */
99 /** Path to the target */
104 /** Null implementation */
105 static TargetImpl_Ptr _nullimpl;
107 /** wrapper with callback around getPlainRpm */
108 Pathname getRpmFile(Package::constPtr package);
110 ///////////////////////////////////////////////////////////////////
112 /** \relates TargetImpl Stream output */
113 inline std::ostream & operator<<( std::ostream & str, const TargetImpl & obj )
114 { return obj.dumpOn( str ); }
116 /////////////////////////////////////////////////////////////////
117 } // namespace target
118 ///////////////////////////////////////////////////////////////////
119 /////////////////////////////////////////////////////////////////
121 ///////////////////////////////////////////////////////////////////
122 #endif // ZYPP_TARGET_TARGETIMPL_H