DmraidCo.h

Go to the documentation of this file.
00001 #ifndef DMRAID_CO_H
00002 #define DMRAID_CO_H
00003 
00004 #include <list>
00005 
00006 #include "y2storage/DmPartCo.h"
00007 #include "y2storage/Dmraid.h"
00008 
00009 namespace storage
00010 {
00011 
00012 class Storage;
00013 class SystemCmd;
00014 class ProcPart;
00015 class Region;
00016 
00017 class DmraidCo : public DmPartCo
00018     {
00019     friend class Storage;
00020 
00021     public:
00022         DmraidCo( Storage * const s, const string& Name, ProcPart& ppart );
00023         DmraidCo( Storage * const s, const string& Name, unsigned num, 
00024                   unsigned long long Size, ProcPart& ppart );
00025         DmraidCo( const DmraidCo& rhs );
00026         virtual ~DmraidCo();
00027 
00028         static storage::CType const staticType() { return storage::DMRAID; }
00029         friend std::ostream& operator<< (std::ostream&, const DmraidCo& );
00030         void getInfo( storage::DmraidCoInfo& info ) const;
00031         void setUdevData( const string& id );
00032 
00033         bool equalContent( const Container& rhs ) const;
00034         string getDiffString( const Container& d ) const;
00035         DmraidCo& operator= ( const DmraidCo& rhs );
00036 
00037     protected:
00038 
00039         // iterators over partitions
00040         // protected typedefs for iterators over partitions
00041         typedef CastIterator<VIter, Dmraid *> DmraidInter;
00042         typedef CastIterator<CVIter, const Dmraid *> DmraidCInter;
00043         template< class Pred >
00044             struct DmraidPI { typedef ContainerIter<Pred, DmraidInter> type; };
00045         template< class Pred >
00046             struct DmraidCPI { typedef ContainerIter<Pred, DmraidCInter> type; };
00047         typedef CheckFnc<const Dmraid> CheckFncDmraid;
00048         typedef CheckerIterator< CheckFncDmraid, DmraidPI<CheckFncDmraid>::type,
00049                                  DmraidInter, Dmraid > DmraidPIterator;
00050         typedef CheckerIterator< CheckFncDmraid, DmraidCPI<CheckFncDmraid>::type,
00051                                  DmraidCInter, const Dmraid > DmraidCPIterator;
00052         typedef DerefIterator<DmraidPIterator,Dmraid> DmraidIter;
00053         typedef DerefIterator<DmraidCPIterator,const Dmraid> ConstDmraidIter;
00054         typedef IterPair<DmraidIter> DmraidPair;
00055         typedef IterPair<ConstDmraidIter> ConstDmraidPair;
00056 
00057         DmraidPair dmraidPair( bool (* CheckDmraid)( const Dmraid& )=NULL)
00058             {
00059             return( DmraidPair( dmraidBegin( CheckDmraid ), dmraidEnd( CheckDmraid ) ));
00060             }
00061         DmraidIter dmraidBegin( bool (* CheckDmraid)( const Dmraid& )=NULL)
00062             {
00063             IterPair<DmraidInter> p( (DmraidInter(begin())), (DmraidInter(end())) );
00064             return( DmraidIter( DmraidPIterator( p, CheckDmraid )) );
00065             }
00066         DmraidIter dmraidEnd( bool (* CheckDmraid)( const Dmraid& )=NULL)
00067             {
00068             IterPair<DmraidInter> p( (DmraidInter(begin())), (DmraidInter(end())) );
00069             return( DmraidIter( DmraidPIterator( p, CheckDmraid, true )) );
00070             }
00071 
00072         ConstDmraidPair dmraidPair( bool (* CheckDmraid)( const Dmraid& )=NULL) const
00073             {
00074             return( ConstDmraidPair( dmraidBegin( CheckDmraid ), dmraidEnd( CheckDmraid ) ));
00075             }
00076         ConstDmraidIter dmraidBegin( bool (* CheckDmraid)( const Dmraid& )=NULL) const
00077             {
00078             IterPair<DmraidCInter> p( (DmraidCInter(begin())), (DmraidCInter(end())) );
00079             return( ConstDmraidIter( DmraidCPIterator( p, CheckDmraid )) );
00080             }
00081         ConstDmraidIter dmraidEnd( bool (* CheckDmraid)( const Dmraid& )=NULL) const
00082             {
00083             IterPair<DmraidCInter> p( (DmraidCInter(begin())), (DmraidCInter(end())) );
00084             return( ConstDmraidIter( DmraidCPIterator( p, CheckDmraid, true )) );
00085             }
00086 
00087         DmraidCo( Storage * const s, const string& File );
00088         virtual void print( std::ostream& s ) const { s << *this; }
00089         virtual Container* getCopy() const { return( new DmraidCo( *this ) ); }
00090         static void activate( bool val );
00091         void getRaidData( const string& name );
00092         void addRaid( const string& name );
00093         void addPv( Pv*& p );
00094         void newP( DmPart*& dm, unsigned num, Partition* p );
00095         string removeText( bool doing ) const;
00096         string setDiskLabelText( bool doing ) const;
00097 
00098         static string undevName( const string& name );
00099 
00100         static void getRaids( std::list<string>& l );
00101         static bool raidNotDeleted( const Dmraid&d ) { return( !d.deleted() ); }
00102 
00103         int doRemove();
00104 
00105         void logData( const string& Dir );
00106 
00107         string raidtype;
00108         string controller;
00109 
00110         static bool active;
00111     };
00112 
00113 }
00114 
00115 #endif

Generated on Tue Sep 25 21:19:22 2007 for yast2-storage by  doxygen 1.5.3