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, int medianr, PoolItemList & errors_r, PoolItemList & remaining_r, PoolItemList & srcremaining_r );
77 /** Commit ordered changes */
78 void commit( const PoolItemList & items_r );
80 /** Overload to realize stream output. */
81 virtual std::ostream & dumpOn( std::ostream & str ) const
82 { return str << "TargetImpl"; }
84 /** The RPM database */
87 /** If the package is installed and provides the file
88 Needed to evaluate split provides during Resolver::Upgrade() */
89 bool providesFile (const std::string & path_str, const std::string & name_str) const;
91 /** Return the resolvable which provides path_str (rpm -qf)
92 return NULL if no resolvable provides this file */
93 ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
96 /** All resolvables provided by the target. */
98 /** Path to the target */
103 /** Null implementation */
104 static TargetImpl_Ptr _nullimpl;
106 /** wrapper with callback around getPlainRpm */
107 Pathname getRpmFile(Package::constPtr package);
109 ///////////////////////////////////////////////////////////////////
111 /** \relates TargetImpl Stream output */
112 inline std::ostream & operator<<( std::ostream & str, const TargetImpl & obj )
113 { return obj.dumpOn( str ); }
115 /////////////////////////////////////////////////////////////////
116 } // namespace target
117 ///////////////////////////////////////////////////////////////////
118 /////////////////////////////////////////////////////////////////
120 ///////////////////////////////////////////////////////////////////
121 #endif // ZYPP_TARGET_TARGETIMPL_H