source: box/trunk/lib/raidfile/RaidFileRead.h @ 2493

Revision 2493, 1.9 KB checked in by chris, 3 years ago (diff)

gcc 4.3 and 4.4 compile fixes, thanks to Reinhard Tartler and the Debian
project. See also:

 http://patch-tracking.debian.net/package/boxbackup/0.11~rc2+r2072-1
 http://lists.warhead.org.uk/pipermail/boxbackup/2009-April/005159.html

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    RaidFileRead.h
5//              Purpose: Read Raid like Files
6//              Created: 2003/07/13
7//
8// --------------------------------------------------------------------------
9
10#ifndef RAIDFILEREAD__H
11#define RAIDFILEREAD__H
12
13#include <cstring>
14#include <cstdlib>
15#include <memory>
16#include <vector>
17
18#include "IOStream.h"
19
20class RaidFileDiscSet;
21
22
23// --------------------------------------------------------------------------
24//
25// Class
26//              Name:    RaidFileRead
27//              Purpose: Read RAID like files
28//              Created: 2003/07/13
29//
30// --------------------------------------------------------------------------
31class RaidFileRead : public IOStream
32{
33protected:
34        RaidFileRead(int SetNumber, const std::string &Filename);
35public:
36        virtual ~RaidFileRead();
37private:
38        RaidFileRead(const RaidFileRead &rToCopy);
39       
40public:
41        // Open a raid file
42        static std::auto_ptr<RaidFileRead> Open(int SetNumber, const std::string &Filename, int64_t *pRevisionID = 0, int BufferSizeHint = 4096);
43
44        // Extra info
45        virtual pos_type GetFileSize() const = 0;
46
47        // Utility functions
48        static bool FileExists(int SetNumber, const std::string &rFilename, int64_t *pRevisionID = 0);
49        static bool DirectoryExists(const RaidFileDiscSet &rSet, const std::string &rDirName);
50        static bool DirectoryExists(int SetNumber, const std::string &rDirName);
51        enum
52        {
53                DirReadType_FilesOnly = 0,
54                DirReadType_DirsOnly = 1
55        };
56        static bool ReadDirectoryContents(int SetNumber, const std::string &rDirName, int DirReadType, std::vector<std::string> &rOutput);
57
58        // Common IOStream interface implementation
59        virtual void Write(const void *pBuffer, int NBytes);
60        virtual bool StreamClosed();
61        virtual pos_type BytesLeftToRead();
62
63        pos_type GetDiscUsageInBlocks();
64
65        typedef int64_t FileSizeType;
66
67protected:
68        int mSetNumber;
69        std::string mFilename;
70};
71
72#endif // RAIDFILEREAD__H
73
Note: See TracBrowser for help on using the repository browser.