equal
deleted
inserted
replaced
34 Usage notes: |
34 Usage notes: |
35 @code |
35 @code |
36 - an object of RFileBuf64 type must be defined first, specifying the max size (capacity) of the buffer as a parameter |
36 - an object of RFileBuf64 type must be defined first, specifying the max size (capacity) of the buffer as a parameter |
37 of the constructor: |
37 of the constructor: |
38 |
38 |
39 RFileBuf64 fbuf(<N>);//<N> is the buffer capacity in bytes |
39 RFileBuf64 fbuf(<N>);//<N> is the minimal buffer capacity in bytes |
40 |
40 |
41 - the second step is to initialize the just defined RFileBuf64 object by calling one of the "resource acquisition" |
41 - the second step is to initialize the just defined RFileBuf64 object by calling one of the "resource acquisition" |
42 methods: RFileBuf64::Create(), RFileBuf64::Open(), RFileBuf64::Temp() or RFileBuf64::AdoptFromClient(). |
42 methods: RFileBuf64::Create(), RFileBuf64::Open(), RFileBuf64::Temp() or RFileBuf64::AdoptFromClient(). |
43 |
43 |
44 In details, to create a file and access it through a RFileBuf64 object: |
44 In details, to create a file and access it through a RFileBuf64 object: |
139 friend void SetReadAheadSizeTest(); |
139 friend void SetReadAheadSizeTest(); |
140 |
140 |
141 enum {KDefaultReadAheadSize = 1024};//Default size in bytes of the read-ahead buffer |
141 enum {KDefaultReadAheadSize = 1024};//Default size in bytes of the read-ahead buffer |
142 |
142 |
143 public: |
143 public: |
144 RFileBuf64(TInt aSize); |
144 RFileBuf64(TInt aMinCapacity); |
145 |
145 |
146 TInt Create(RFs& aFs, const TDesC& aFileName, TUint aFileMode); |
146 TInt Create(RFs& aFs, const TDesC& aFileName, TUint aFileMode); |
147 TInt Open(RFs& aFs, const TDesC& aFileName, TUint aFileMode); |
147 TInt Open(RFs& aFs, const TDesC& aFileName, TUint aFileMode); |
148 TInt Temp(RFs& aFs, const TDesC& aPath, TFileName& aFileName, TUint aFileMode); |
148 TInt Temp(RFs& aFs, const TDesC& aPath, TFileName& aFileName, TUint aFileMode); |
149 TInt AdoptFromClient(const RMessage2& aMsg, TInt aFsIndex, TInt aFileIndex); |
149 TInt AdoptFromClient(const RMessage2& aMsg, TInt aFsIndex, TInt aFileIndex); |
169 TInt DoFileFlush(); |
169 TInt DoFileFlush(); |
170 TInt DoFileWrite(); |
170 TInt DoFileWrite(); |
171 TInt DoFileWrite1(TInt64 aNewFilePos); |
171 TInt DoFileWrite1(TInt64 aNewFilePos); |
172 TInt DoFileWrite2(TInt64 aNewFilePos = 0LL); |
172 TInt DoFileWrite2(TInt64 aNewFilePos = 0LL); |
173 void DoDiscardBufferedReadData(); |
173 void DoDiscardBufferedReadData(); |
|
174 TInt DoSetCapacity(TInt aRwDataLength); |
174 |
175 |
175 private: |
176 private: |
176 //Buffer related |
177 //Buffer related |
177 const TInt iCapacity; //The buffer size. Indicates how much data can be put in. |
178 TInt iCapacity; //The buffer size. Indicates how much data can be put in. |
178 TUint8* iBase; //Pointer to the beginning of the buffer. |
179 TUint8* iBase; //Pointer to the beginning of the buffer. |
179 TInt iLength; //The length of the data currently held in the buffer. |
180 TInt iLength; //The length of the data currently held in the buffer. |
180 //File related |
181 //File related |
181 TInt64 iFilePos; //The file position associated with the beginning of the buffer. |
182 TInt64 iFilePos; //The file position associated with the beginning of the buffer. |
182 TInt64 iFileSize; //The file size. |
183 TInt64 iFileSize; //The file size. |
184 //Read-ahead related |
185 //Read-ahead related |
185 TBool iDirty; //The buffer contains pending data to be written to the file |
186 TBool iDirty; //The buffer contains pending data to be written to the file |
186 TInt64 iNextReadFilePos; //The guessed file position of the next "file read" operation |
187 TInt64 iNextReadFilePos; //The guessed file position of the next "file read" operation |
187 TInt iNextReadFilePosHits; //How many times the guessed file position of the "file read" operation was correct |
188 TInt iNextReadFilePosHits; //How many times the guessed file position of the "file read" operation was correct |
188 TInt iReadAheadSize; |
189 TInt iReadAheadSize; |
|
190 // |
|
191 TBool iOptimized; //True if the file buffer capacity has been optimized already |
189 |
192 |
190 //Profiler related |
193 //Profiler related |
191 #ifdef _SQLPROFILER |
194 #ifdef _SQLPROFILER |
192 public: |
195 public: |
193 void ProfilerReset(); |
196 void ProfilerReset(); |