Mobile API Reference  MicroStrategy 2019
WriteableFileImpl.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : WriteableFileImpl.h
3 // AUTHOR : vovechkin
4 // CREATION : 2004-09-28
5 // Copyright (C) MicroStrategy Incorporated 2004
6 // All Rights Reserved
7 //==============================================================================================
8 #ifndef MFileSystem_WriteableFileImpl_h
9 #define MFileSystem_WriteableFileImpl_h
10 
11 
12 #include "../WriteableFile.h"
13 #include "FileImpl.h"
14 
15 
16 #ifndef WIN32
17 #include "InprocessFileLocker.h"
18 #endif // WIN32
19 
20 namespace MFileSystem
21 {
23  virtual public WriteableFile
24  {
25  public:
26 
28  const char* ipPath,
29  IF_COMMIT_AND_CLOSE_WAS_NOT_CALLED iWhatToDoIfCommitAndCloseWasNotCalled);
30 
31  virtual ~WriteableFileImpl() throw();
32 
33  protected:
34 
36  virtual const char* GetPath() const;
37 
39  virtual bool IsAccessibleViaPath() const;
40 
42  virtual Int64 GetSize() const;
43 
45  virtual Int64 GetPosition() const;
46 
48  virtual void MovePosition(Int64 iOffset);
49 
51  virtual void SetPosition(Int64 iOffset);
52 
54  virtual Int64 SetPositionToEnd();
55 
56  protected:
57 
59  virtual void Write(const char* ipString, size_t iLength);
60 
62  virtual void Write(const void* ipData, size_t iByteLength);
63 
65  virtual void WriteLittleEndian(const unsigned Int32& irValue);
66 
68  virtual void Flush();
69 
71  virtual void Truncate();
72 
74  virtual void CommitAndClose();
75 
77  virtual const MBase::TotalTimer& GetWriteTimer() const;
78 
80  virtual const MBase::TotalTimer& GetWriteLockTimer() const;
81 
83  virtual bool WriteLock(bool iNoWait);
84 
86  virtual void WriteUnlock() throw();
87 
88  private:
89 
90  const IF_COMMIT_AND_CLOSE_WAS_NOT_CALLED mWhatToDoIfCommitAndCloseWasNotCalled;
91 
92  const std::string mPath;
93 
94  MFileSystem::FileHandle mFileHandle;
95 
96  // flags
97  bool mPendingFlush;
98  bool mPositionUndefined;
99  bool mWriteLocked;
100 
101  MBase::TotalTimer mWriteTimer;
102  MBase::TotalTimer mWriteLockTimer;
103 
104 #ifndef WIN32
105  InprocessFileLocker::LockPtr mInprocessFileLockerPtr;
106 #endif // WIN32
107  };
108 }
109 
110 #endif // MFileSystem_WriteableFileImpl_h
virtual void SetPosition(Int64 iOffset)
Definition: Timer.h:91
Definition: WriteableFile.h:32
virtual void WriteLittleEndian(const unsigned Int32 &irValue)
virtual void Write(const char *ipString, size_t iLength)
#define Int64
Definition: BasicTypes.h:36
virtual const MBase::TotalTimer & GetWriteTimer() const
virtual void MovePosition(Int64 iOffset)
Definition: InprocessFileLocker.h:41
#define Int32
Definition: BasicTypes.h:20
virtual bool IsAccessibleViaPath() const
virtual bool WriteLock(bool iNoWait)
IF_COMMIT_AND_CLOSE_WAS_NOT_CALLED
Definition: WriteableFile.h:19
virtual Int64 GetPosition() const
virtual Int64 SetPositionToEnd()
virtual const MBase::TotalTimer & GetWriteLockTimer() const
virtual Int64 GetSize() const
WriteableFileImpl(const char *ipPath, IF_COMMIT_AND_CLOSE_WAS_NOT_CALLED iWhatToDoIfCommitAndCloseWasNotCalled)
virtual const char * GetPath() const
Definition: WriteableFileImpl.h:22
int FileHandle
Definition: FileImpl.h:21
Definition: StrongObjects.h:21