Đang chuẩn bị liên kết để tải về tài liệu:
C++ Timesaving Techniques for Dummies phần 7

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Tham khảo tài liệu 'c++ timesaving techniques for dummies phần 7', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Technique 48 Implementing Virtual Files Listing 48-1 continued void setOffset long offset _offset _offset void setLength long length _length length void setChunk const string chunk _chunk chunk long AccessCount void return _accesses bool Load ifstream in long offset long length Clear return Read in offset length const int kChunkSize 128 class FileChunkManager - 2 private int _numChunks FileChunk _chunks ifstream _in string _fileName protected FileChunk findChunk long theOffset for int i 0 i _numChunks i if _chunks i .InUse true long offset _chunks i .Offset long length _chunks i .Length if theOffset offset theOffset offset length return _chunks i return NULL FileChunk addChunk long theOffset Creating a Virtual File Class 287 for int i 0 i _numChunks i if _chunks i .InUse false if _chunks i .Load _in theOffset kChunkSize return _chunks i return NULL FileChunk getLeastRecentlyAccessed int idx 0 long access _chunks 0 .AccessCount for int i 0 i _numChunks i if _chunks i .InUse true if _chunks i .AccessCount access idx i access _chunks i .AccessCount return _chunks idx public FileChunkManager void _numChunks 0 _chunks NULL FileChunkManager const char fileName int nMaxChunks _numChunks nMaxChunks _chunks new FileChunk nMaxChunks _fileName fileName _in.open fileName FileChunkManager const FileChunkManager aCopy _numChunks aCopy._numChunks _chunks new FileChunk _numChunks for int i 0 i _numChunks i _chunks i aCopy._chunks i _fileName aCopy._fileName _in.open _fileName.c_str continued Technique 48 Implementing Virtual Files Listing 48-1 continued virtual FileChunkManager void delete _chunks char operator long offset Find which chunk this offset is in. FileChunk chunk findChunk offset if chunk NULL There are none. See whether we can add one. chunk addChunk offset If we have one just get the data from it. Otherwise we have to go dump one. if chunk chunk getLeastRecentlyAccessed chunk- Load _in offset kChunkSize Finally extract the piece we need. int pos offset - chunk- Offset

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.