Stimfit @PACKAGE_VERSION@
Loading...
Searching...
No Matches
FileReadCache.hpp
Go to the documentation of this file.
1//***********************************************************************************************
2//
3// Copyright (c) 1996-1997 Axon Instruments.
4// All rights reserved.
5//
6//***********************************************************************************************
7// HEADER: FileReadCache.HPP
8// PURPOSE: Contains class definition for CFileReadCache for creating and maintaining a BufferedArray array.
9// AUTHOR: BHI Dec 1996
10//
11
12#ifndef INC_FILEREADCACHE_HPP
13#define INC_FILEREADCACHE_HPP
14
16#if (__cplusplus < 201402L)
17# include <boost/shared_array.hpp>
18#else
19# include <memory>
20#endif
21//-----------------------------------------------------------------------------------------------
22// CFileReadCache class definition
23
24class CFileReadCache
25{
26private:
27 UINT m_uItemSize; // Size of all data items (structures)
28 CFileIO m_File; // DOS file handle to the read-only data.
29 UINT m_uItemCount; // Number of items available in the file
30 LONGLONG m_llFileOffset; // Start offset in the file.
31 UINT m_uCacheSize;
32 UINT m_uCacheStart;
33 UINT m_uCacheCount;
34#if (__cplusplus < 201402L)
35 boost::shared_array<BYTE> m_pItemCache;
36#else
37 std::shared_ptr<BYTE> m_pItemCache;
38#endif
39
40private: // Unimplemented default member functions.
41 // Declare but don't define copy constructors to prevent use of defaults.
42 CFileReadCache(const CFileReadCache &CS);
43 const CFileReadCache &operator=(const CFileReadCache &CS);
44
45private:
46 BOOL LoadCache(UINT uEntry);
47
48public: // Public member functions
51
52 // Call this function to initialize the DTB and the temp file.
53 BOOL Initialize(UINT uItemSize, UINT uCacheSize, FILEHANDLE hFile, LONGLONG llOffset, UINT uItems );
54
55 // Get one or more items from the array.
56 BOOL Get( UINT uFirstEntry, void *pItem, UINT uEntries );
57
58 // Get a pointer to one entry in the cache.
59 void *Get( UINT uEntry );
60
61 // Get the count of items in the file.
62 UINT GetCount() const;
63};
64
65//===============================================================================================
66// PROCEDURE: GetCount
67// PURPOSE: Returns the current count of ITEMs, both cached and written to file.
68//
70{
71// MEMBERASSERT();
72 return m_uItemCount;
73}
74
75#endif // INC_FILEREADCACHE_HPP
void * Get(UINT uEntry)
BOOL Get(UINT uFirstEntry, void *pItem, UINT uEntries)
BOOL Initialize(UINT uItemSize, UINT uCacheSize, FILEHANDLE hFile, LONGLONG llOffset, UINT uItems)
UINT GetCount() const
int BOOL
Definition unix.h:49
unsigned int UINT
Definition unix.h:47
FILE * FILEHANDLE
Definition unix.h:38
long long LONGLONG
Definition unix.h:143