libzypp  11.13.5
CommitPackageCacheImpl.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_TARGET_COMMITPACKAGECACHEIMPL_H
13 #define ZYPP_TARGET_COMMITPACKAGECACHEIMPL_H
14 
15 #include <iosfwd>
16 
17 #include "zypp/base/Logger.h"
18 #include "zypp/base/Exception.h"
19 
21 
23 namespace zypp
24 {
25 
26  namespace target
27  {
28 
30  //
31  // CLASS NAME : CommitPackageCache::Impl
32  //
40  {
41  public:
43 
44  public:
45  Impl( const PackageProvider & packageProvider_r )
46  : _packageProvider( packageProvider_r )
47  {}
48 
49  virtual ~Impl()
50  {}
51 
52  public:
56  virtual ManagedFile get( const PoolItem & citem_r )
57  {
58  return sourceProvidePackage( citem_r );
59  }
60 
61  void setCommitList( std::vector<sat::Solvable> commitList_r )
62  { _commitList = commitList_r; }
63 
64  protected:
66  virtual ManagedFile sourceProvidePackage( const PoolItem & pi ) const
67  {
68  if ( ! _packageProvider )
69  {
70  ZYPP_THROW( Exception("No package provider configured.") );
71  }
72 
73  ManagedFile ret( _packageProvider( pi ) );
74  if ( ret.value().empty() )
75  {
76  ZYPP_THROW( Exception("Package provider failed.") );
77  }
78 
79  return ret;
80  }
81 
82  protected:
83  std::vector<sat::Solvable> _commitList;
84 
85  private:
87  };
89 
91  inline std::ostream & operator<<( std::ostream & str, const CommitPackageCache::Impl & obj )
92  {
93  return str << "CommitPackageCache::Impl";
94  }
95 
97  } // namespace target
100 } // namespace zypp
102 #endif // ZYPP_TARGET_COMMITPACKAGECACHEIMPL_H