Mobile API Reference  MicroStrategy 2019
ReadableFile.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : ReadableFile.h
3 // AUTHOR : vovechkin
4 // CREATION : 2004-09-28
5 // Copyright (C) MicroStrategy Incorporated 2004
6 // All Rights Reserved
7 //==============================================================================================
8 #ifndef MFileSystem_ReadableFile_h
9 #define MFileSystem_ReadableFile_h
10 
11 #include "Base/Base/Timer.h"
12 
13 #include "FileSystem.h" // for FILE_SYSTEM_DLL_EXPORT
14 
15 #include "GenericFile.h"
16 
17 namespace MDataType
18 {
19  // forward declarations
20  class Binary;
21 }
22 
23 namespace MFileSystem
24 {
28  class ReadableFile:
29  virtual public GenericFile
30  {
31  public:
32 
35 
36  // virtual destructor is a must
37  virtual ~ReadableFile() throw()
38  {
39  }
40 
44  virtual void Read(void* ipBuffer, size_t iBufferSize) = 0;
45 
52  virtual void Read(MDataType::Binary& irBinary, size_t iMaxSize = 0) = 0;
53 
57  virtual void ReadLittleEndian(unsigned Int32& orValue) = 0;
58 
64  virtual void ReadLine(MDataType::Binary& irBinary) = 0;
65 
69  virtual const MBase::TotalTimer& GetReadTimer() const = 0;
70 
74  virtual const MBase::TotalTimer& GetReadLockTimer() const = 0;
75 
80  {
81  public:
82 
83  ReadSmartLock(ReadableFile& irReadableFile);
84  ~ReadSmartLock() throw();
85 
86  void Unlock() throw();
87 
88  protected:
89 
90  ReadSmartLock();
91 
93  bool mIsLocked;
94  };
95 
113  public ReadSmartLock
114  {
115  public:
116 
117  ReadSmartLock_NoWait(ReadableFile& irReadableFile);
118 
119  bool IsLocked() const throw()
120  {
121  return mIsLocked;
122  }
123  };
124 
125  protected:
126 
127  friend class ReadSmartLock;
128  friend class ReadSmartLock_NoWait;
129 
130  virtual bool ReadLock(bool iNoWait) = 0;
131  virtual void ReadUnlock() throw() = 0;
132  };
133 
140 
147 }
148 
149 #endif // MFileSystem_ReadableFile_h
bool IsLocked() const
Definition: ReadableFile.h:119
virtual void ReadLine(MDataType::Binary &irBinary)=0
Definition: Timer.h:91
MDataType::Binary represents binary data.
Definition: Binary.h:33
virtual ~ReadableFile()
Definition: ReadableFile.h:37
virtual bool ReadLock(bool iNoWait)=0
bool mIsLocked
Definition: ReadableFile.h:93
virtual const MBase::TotalTimer & GetReadLockTimer() const =0
friend class ReadSmartLock_NoWait
Definition: ReadableFile.h:128
DLL_FILE_SYSTEM_EXIM ReadableFile::ReturnPtr OpenReadableFile(const char *ipPath)
friend class ReadSmartLock
Definition: ReadableFile.h:127
Definition: ReadableFile.h:28
Definition: BigDecimal.h:18
#define Int32
Definition: BasicTypes.h:20
MBase::ReturnPtr< ReadableFile > ReturnPtr
Definition: ReadableFile.h:34
virtual void Read(void *ipBuffer, size_t iBufferSize)=0
virtual const MBase::TotalTimer & GetReadTimer() const =0
Definition: GenericFile.h:22
virtual void ReadLittleEndian(unsigned Int32 &orValue)=0
virtual void ReadUnlock()=0
ReadableFile * mpReadableFile
Definition: ReadableFile.h:92
DLL_FILE_SYSTEM_EXIM ReadableFile::ReturnPtr OpenReadableFile_InProcessLockNoWait(const char *ipPath)
MBase::StrongPtr< ReadableFile > Ptr
Definition: ReadableFile.h:33
Definition: ReadableFile.h:79
Definition: StrongObjects.h:21
Definition: ReturnPtr.h:22
#define DLL_FILE_SYSTEM_EXIM
Definition: FileSystem.h:11