00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_SOURCE_MEDIASET_H 00013 #define ZYPP_SOURCE_MEDIASET_H 00014 00015 #include <iosfwd> 00016 #include <string> 00017 00018 #include "zypp/base/ReferenceCounted.h" 00019 #include "zypp/base/NonCopyable.h" 00020 #include "zypp/base/PtrTypes.h" 00021 #include "zypp/Source.h" 00022 00023 #include "zypp/media/MediaManager.h" 00024 00026 namespace zypp 00027 { 00028 00029 namespace source 00030 { 00031 00032 DEFINE_PTR_TYPE(MediaSet); 00033 00035 // 00036 // CLASS NAME : MediaSet 00037 // 00038 class MediaSet : public base::ReferenceCounted, private base::NonCopyable 00039 { 00040 friend std::ostream & operator<<( std::ostream & str, const MediaSet & obj ); 00041 00042 public: 00043 MediaSet(const Source_Ref & source_r); 00044 00045 ~MediaSet(); 00046 00048 media::MediaAccessId getMediaAccessId (media::MediaNr medianr, bool no_attach = false); 00050 void redirect (media::MediaNr medianr, media::MediaAccessId media_id); 00057 void reattach(const Pathname &attach_point); 00059 void reset(); 00063 void release(); 00064 00065 protected: 00066 00068 virtual std::ostream & dumpOn( std::ostream & str ) const; 00069 00070 typedef std::map<media::MediaNr, media::MediaAccessId> MediaMap; 00072 MediaMap medias; 00074 Source_Ref _source; 00075 00077 Url rewriteUrl (const Url & url_r, const media::MediaNr medianr); 00078 00079 }; 00081 00083 inline std::ostream & operator<<( std::ostream & str, const MediaSet & obj ) 00084 { return obj.dumpOn( str ); } 00085 00086 00088 } // namespace source 00091 } // namespace zypp 00093 #endif // ZYPP_SOURCE_MEDIASET_H