| 141 | }; |
| 142 | |
| 143 | class FileBlock : public Block |
| 144 | { |
| 145 | public: |
| 146 | FileBlock(Firebird::TempFile* f, Block* tail, size_t length) |
| 147 | : Block(tail, length), file(f) |
| 148 | { |
| 149 | fb_assert(file); |
| 150 | |
| 151 | // FileBlock is created after file was extended by length (look at |
| 152 | // TempSpace::extend) so this FileBlock is already inside the file |
| 153 | seek = file->getSize() - length; |
| 154 | } |
| 155 | |
| 156 | ~FileBlock() {} |
| 157 | |
| 158 | FB_SIZE_T read(offset_t offset, void* buffer, FB_SIZE_T length); |
| 159 | FB_SIZE_T write(offset_t offset, const void* buffer, FB_SIZE_T length); |
| 160 | |
| 161 | UCHAR* inMemory(offset_t /*offset*/, size_t /*a_size*/) const |
| 162 | { |
| 163 | return NULL; |
| 164 | } |
| 165 | |
| 166 | bool sameFile(const Firebird::TempFile* aFile) const |
| 167 | { |
| 168 | return (aFile == this->file); |
| 169 | } |
| 170 | |
| 171 | private: |
| 172 | Firebird::TempFile* file; |
| 173 | offset_t seek; |
| 174 | }; |
| 175 | |
| 176 | Block* findBlock(offset_t& offset) const; |
| 177 | Firebird::TempFile* setupFile(FB_SIZE_T size); |