Mobile API Reference  MicroStrategy 2019
ReadableFileImpl.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : ReadableFileImpl.h
3 // AUTHOR : vovechkin
4 // CREATION : 2004-09-28
5 // Copyright (C) MicroStrategy Incorporated 2004
6 // All Rights Reserved
7 //==============================================================================================
8 #ifndef MFileSystem_ReadableFileImpl_h
9 #define MFileSystem_ReadableFileImpl_h
10 
11 #include "Base/Base/String.h"
12 
13 #include "../ReadableFile.h"
14 #include "FileImpl.h"
15 
16 #ifndef WIN32
17 #include "InprocessFileLocker.h"
18 #endif // WIN32
19 
20 namespace MFileSystem
21 {
23  virtual public ReadableFile
24  {
25  public:
26 
27  ReadableFileImpl(const char* ipPath, bool bInProcessLock_NoWait);
28 
29  virtual ~ReadableFileImpl() throw();
30 
31  protected:
32 
34  virtual const char* GetPath() const;
35 
37  virtual bool IsAccessibleViaPath() const;
38 
40  virtual Int64 GetSize() const;
41 
43  virtual Int64 GetPosition() const;
44 
46  virtual void MovePosition(Int64 iOffset);
47 
49  virtual void SetPosition(Int64 iOffset);
50 
52  virtual Int64 SetPositionToEnd();
53 
54  protected:
55 
57  virtual void Read(void* ipBuffer, size_t iBufferSize);
58 
60  virtual void Read(MDataType::Binary& irBinary, size_t iMaxSize);
61 
63  virtual void ReadLittleEndian(unsigned Int32& orValue);
64 
66  virtual void ReadLine(MDataType::Binary& irBinary);
67 
69  virtual const MBase::TotalTimer& GetReadTimer() const;
70 
72  virtual const MBase::TotalTimer& GetReadLockTimer() const;
73 
75  virtual bool ReadLock(bool iNoWait);
76 
78  virtual void ReadUnlock() throw();
79 
80  private:
81 
82  const std::string mPath;
83 
84  MFileSystem::FileHandle mFileHandle;
85 
86  // flags
87  bool mPositionUndefined;
88  bool mReadLocked;
89 
90  MBase::TotalTimer mReadTimer;
91  MBase::TotalTimer mReadLockTimer;
92 
93 #ifndef WIN32
94  InprocessFileLocker::LockPtr mInprocessFileLockerPtr;
95 #endif // WIN32
96  };
97 }
98 
99 #endif // MFileSystem_ReadableFileImpl_h
ReadableFileImpl(const char *ipPath, bool bInProcessLock_NoWait)
Definition: Timer.h:91
MDataType::Binary represents binary data.
Definition: Binary.h:33
virtual void Read(void *ipBuffer, size_t iBufferSize)
virtual bool IsAccessibleViaPath() const
virtual const MBase::TotalTimer & GetReadLockTimer() const
virtual void ReadLine(MDataType::Binary &irBinary)
#define Int64
Definition: BasicTypes.h:36
Definition: ReadableFileImpl.h:22
virtual void ReadLittleEndian(unsigned Int32 &orValue)
Definition: ReadableFile.h:28
virtual const char * GetPath() const
Definition: InprocessFileLocker.h:41
virtual bool ReadLock(bool iNoWait)
#define Int32
Definition: BasicTypes.h:20
virtual Int64 GetSize() const
virtual const MBase::TotalTimer & GetReadTimer() const
virtual void SetPosition(Int64 iOffset)
virtual Int64 SetPositionToEnd()
virtual Int64 GetPosition() const
virtual void MovePosition(Int64 iOffset)
int FileHandle
Definition: FileImpl.h:21
Definition: StrongObjects.h:21