Stimfit
@PACKAGE_VERSION@
Loading...
Searching...
No Matches
src
libstfio
abf
axon
Common
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
15
#include "
./../Common/FileIO.hpp
"
16
#if (__cplusplus < 201402L)
17
# include <boost/shared_array.hpp>
18
#else
19
# include <memory>
20
#endif
21
//-----------------------------------------------------------------------------------------------
22
// CFileReadCache class definition
23
24
class
CFileReadCache
25
{
26
private
:
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
40
private
:
// 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
45
private
:
46
BOOL
LoadCache(
UINT
uEntry);
47
48
public
:
// Public member functions
49
CFileReadCache
();
50
~CFileReadCache
();
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
//
69
inline
UINT
CFileReadCache::GetCount
()
const
70
{
71
// MEMBERASSERT();
72
return
m_uItemCount;
73
}
74
75
#endif
// INC_FILEREADCACHE_HPP
FileIO.hpp
CFileIO
Definition
FileIO.hpp:23
CFileReadCache::Get
void * Get(UINT uEntry)
CFileReadCache::Get
BOOL Get(UINT uFirstEntry, void *pItem, UINT uEntries)
CFileReadCache::CFileReadCache
CFileReadCache()
CFileReadCache::~CFileReadCache
~CFileReadCache()
CFileReadCache::Initialize
BOOL Initialize(UINT uItemSize, UINT uCacheSize, FILEHANDLE hFile, LONGLONG llOffset, UINT uItems)
CFileReadCache::GetCount
UINT GetCount() const
Definition
FileReadCache.hpp:69
BOOL
int BOOL
Definition
unix.h:49
UINT
unsigned int UINT
Definition
unix.h:47
FILEHANDLE
FILE * FILEHANDLE
Definition
unix.h:38
LONGLONG
long long LONGLONG
Definition
unix.h:143
Generated by
1.14.0