Stimfit @PACKAGE_VERSION@
Loading...
Searching...
No Matches
abffiles.h
Go to the documentation of this file.
1//***********************************************************************************************
2//
3// Copyright (c) 1993-2003 Axon Instruments.
4// All rights reserved.
5// Permission is granted to freely to use, modify and copy the code in this file.
6//
7//***********************************************************************************************
8
9#ifndef INC_ABFFILES_H
10#define INC_ABFFILES_H
11
13
14// Include the description of the ABFFileHeader structure
15#ifndef RC_INVOKED
18#endif
19#include <vector>
20#include "./../../../stfio.h"
21
22// #include "../AxAbfFio32/filedesc.hpp" // File descriptors for ABF files.
23
24#ifdef __cplusplus
25extern "C" {
26#endif /* __cplusplus */
27
28// This is ABFFILES.H; a companion file to ABFFILES.C
29
30#define ABF_INVALID_HANDLE NULL
31//-1
32
33// Error numbers for routines in this module.
34// Only positive numbers are used.
35
36#define ABF_SUCCESS 0
37#define ABF_EUNKNOWNFILETYPE 1001
38#define ABF_EBADFILEINDEX 1002
39#define ABF_TOOMANYFILESOPEN 1003
40#define ABF_EOPENFILE 1004
41#define ABF_EBADPARAMETERS 1005
42#define ABF_EREADDATA 1006
43#define ABF_OUTOFMEMORY 1008
44#define ABF_EREADSYNCH 1009
45#define ABF_EBADSYNCH 1010
46#define ABF_EEPISODERANGE 1011
47#define ABF_EINVALIDCHANNEL 1012
48#define ABF_EEPISODESIZE 1013
49#define ABF_EREADONLYFILE 1014
50#define ABF_EDISKFULL 1015
51#define ABF_ENOTAGS 1016
52#define ABF_EREADTAG 1017
53#define ABF_ENOSYNCHPRESENT 1018
54#define ABF_EREADDACEPISODE 1019
55#define ABF_ENOWAVEFORM 1020
56#define ABF_EBADWAVEFORM 1021
57#define ABF_BADMATHCHANNEL 1022
58#define ABF_BADTEMPFILE 1023
59#define ABF_NODOSFILEHANDLES 1025
60#define ABF_ENOSCOPESPRESENT 1026
61#define ABF_EREADSCOPECONFIG 1027
62#define ABF_EBADCRC 1028
63#define ABF_ENOCOMPRESSION 1029
64#define ABF_EREADDELTA 1030
65#define ABF_ENODELTAS 1031
66#define ABF_EBADDELTAID 1032
67#define ABF_EWRITEONLYFILE 1033
68#define ABF_ENOSTATISTICSCONFIG 1034
69#define ABF_EREADSTATISTICSCONFIG 1035
70#define ABF_EWRITERAWDATAFILE 1036
71#define ABF_EWRITEMATHCHANNEL 1037
72#define ABF_EWRITEANNOTATION 1038
73#define ABF_EREADANNOTATION 1039
74#define ABF_ENOANNOTATIONS 1040
75#define ABF_ECRCVALIDATIONFAILED 1041
76
77// Notifications that can be passed to the registered callback function.
78#define ABF_NVOICETAGSTART 2000
79#define ABF_NWRITEVOICETAG 2001
80#define ABF_NVOICETAGEND 2002
81
82// Constants for the ABF_ReadOpen and ABF_WriteOpen functions
83#define ABF_DATAFILE 0
84#define ABF_PARAMFILE 1
85#define ABF_ALLOWOVERLAP 2 // If this flag is not set, overlapping data in fixed-length
86 // event-detected data will be edited out by adjustment of
87 // the synch array. (ABF_ReadOpen only!)
88
89// Constants for ABF_MultiplexWrite
90#define ABF_APPEND 2 // Episodes may be appended to the current
91 // episode when writing ABF_VARLNEEVENTS files
92
93// Constant for ABF_FormatTag
94#define ABF_MAXTAGFORMATLEN 84
95
96// Start time saved in the synch array for the oscilloscope mode average sweep
97#define ABF_AVERAGESWEEPSTART DWORD(-1)
98
99//---------------------- Exported Function Definitions -------------------------
100
101// Definitions of the procedures provided by Module ABFFILES.BAS
102
104/*
105void ABF_Cleanup(void);
106*/
107BOOL WINAPI ABF_ReadOpen( LPCTSTR szFileName, int *phFile, UINT fFlags, ABFFileHeader *pFH,
108 UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError );
109/*
110BOOL WINAPI ABF_WriteOpen( LPCSTR szFileName, int *phFile, UINT fFlags, ABFFileHeader *pFH, int *pnError );
111
112BOOL WINAPI ABF_UpdateHeader(int nFile, ABFFileHeader *pFH, int *pnError);
113
114BOOL WINAPI ABF_IsABFFile(const char *szFileName, int *pnDataFormat, int *pnError);
115*/
116
117BOOL WINAPI ABF_HasData(int nFile, const ABFFileHeader *pFH);
118
119BOOL WINAPI ABF_Close(int nFile, int *pnError);
120
121BOOL WINAPI ABF_MultiplexRead(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode,
122 void *pvBuffer, UINT uBufferSize, UINT *puSizeInSamples, int *pnError);
123BOOL WINAPI ABF2_MultiplexRead(int nFile, const ABF2FileHeader *pFH, DWORD dwEpisode,
124 void *pvBuffer, UINT uBufferSize, UINT *puSizeInSamples, int *pnError);
125/*
126BOOL WINAPI ABF_MultiplexWrite(int nFile, ABFFileHeader *pFH, UINT uFlags, const void *pvBuffer,
127 DWORD dwEpiStart, UINT uSizeInSamples, int *pnError);
128
129BOOL WINAPI ABF_WriteRawData(int nFile, const void *pvBuffer, DWORD dwSizeInBytes, int *pnError);
130*/
131BOOL WINAPI ABF_ReadChannel(int nFile, const ABFFileHeader *pFH, int nChannel, DWORD dwEpisode,
132 Vector_float& pfBuffer, UINT *puNumSamples, int *pnError);
133BOOL WINAPI ABF2_ReadChannel(int nFile, const ABF2FileHeader *pFH, int nChannel, DWORD dwEpisode,
134 Vector_float& pfBuffer, UINT *puNumSamples, int *pnError);
135/*
136BOOL WINAPI ABF_ReadRawChannel(int nFile, const ABFFileHeader *pFH, int nChannel, DWORD dwEpisode,
137 void *pvBuffer, UINT *puNumSamples, int *pnError);
138
139BOOL WINAPI ABF_ReadDACFileEpi(int nFile, const ABFFileHeader *pFH, short *pnDACArray,
140 DWORD dwEpisode, int *pnError);
141
142BOOL WINAPI ABF_ReadDACFileEpiEx(int nFile, const ABFFileHeader *pFH, short *pnDACArray,
143 UINT nChannel, DWORD dwEpisode, int *pnError);
144
145BOOL WINAPI ABF_WriteDACFileEpi(int nFile, ABFFileHeader *pFH, const short *pnDACArray, int *pnError);
146
147BOOL WINAPI ABF_WriteDACFileEpiEx(int nFile, ABFFileHeader *pFH, UINT uDACChannel, const short *pnDACArray, int *pnError);
148
149BOOL WINAPI ABF_GetWaveform(int nFile, const ABFFileHeader *pFH, int nADCChannel, DWORD dwEpisode,
150 float *pfBuffer, int *pnError);
151
152BOOL WINAPI ABF_GetWaveformEx(int nFile, const ABFFileHeader *pFH, UINT uDACChannel, DWORD dwEpisode,
153 float *pfBuffer, int *pnError);
154
155BOOL WINAPI ABF_WriteTag(int nFile, ABFFileHeader *pFH, const ABFTag *pTag, int *pnError);
156
157BOOL WINAPI ABF_UpdateTag(int nFile, UINT uTag, const ABFTag *pTag, int *pnError);
158
159BOOL WINAPI ABF_ReadTags(int nFile, const ABFFileHeader *pFH, DWORD dwFirstTag, ABFTag *pTagArray,
160 UINT uNumTags, int *pnError);
161
162BOOL WINAPI ABF_FormatTag(int nFile, const ABFFileHeader *pFH, ABFLONG lTagNumber,
163 char *pszBuffer, UINT uSize, int *pnError);
164
165BOOL WINAPI ABF_EpisodeFromSynchCount(int nFile, const ABFFileHeader *pFH, DWORD *pdwSynchCount,
166 DWORD *pdwEpisode, int *pnError);
167
168BOOL WINAPI ABF_SynchCountFromEpisode(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode,
169 DWORD *pdwSynchCount, int *pnError);
170
171BOOL WINAPI ABF_GetEpisodeFileOffset(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode,
172 DWORD *pdwFileOffset, int *pnError);
173
174BOOL WINAPI ABF_GetMissingSynchCount(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode,
175 DWORD *pdwMissingSynchCount, int *pnError);
176
177BOOL WINAPI ABF_HasOverlappedData(int nFile, BOOL *pbHasOverlapped, int *pnError);
178*/
179BOOL WINAPI ABF_GetNumSamples(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode,
180 UINT *puNumSamples, int *pnError);
181BOOL WINAPI ABF2_GetNumSamples(int nFile, const ABF2FileHeader *pFH, DWORD dwEpisode,
182 UINT *puNumSamples, int *pnError);
183/*
184BOOL WINAPI ABF_GetStartTime(int nFile, const ABFFileHeader *pFH, int nChannel, DWORD dwEpisode,
185 double *pdStartTime, int *pnError);
186
187BOOL WINAPI ABF_GetEpisodeDuration(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode,
188 double *pdDuration, int *pnError);
189
190BOOL WINAPI ABF_GetTrialDuration(int nFile, const ABFFileHeader *pFH,
191 double *pdDuration, int *pnError);
192
193BOOL WINAPI ABF_WriteScopeConfig( int nFile, ABFFileHeader *pFH, int nScopes,
194 const ABFScopeConfig *pCfg, int *pnError);
195
196BOOL WINAPI ABF_ReadScopeConfig( int nFile, ABFFileHeader *pFH, ABFScopeConfig *pCfg,
197 UINT uMaxScopes, int *pnError);
198
199BOOL WINAPI ABF_WriteStatisticsConfig( int nFile, ABFFileHeader *pFH,
200 const ABFScopeConfig *pCfg, int *pnError);
201
202BOOL WINAPI ABF_ReadStatisticsConfig( int nFile, const ABFFileHeader *pFH, ABFScopeConfig *pCfg, int *pnError);
203
204BOOL WINAPI ABF_SaveVoiceTag( int nFile, LPCSTR pszFileName, ABFLONG lDataOffset,
205 ABFVoiceTagInfo *pVTI, int *pnError);
206
207BOOL WINAPI ABF_GetVoiceTag( int nFile, const ABFFileHeader *pFH, UINT uTag, LPCSTR pszFileName,
208 ABFLONG lDataOffset, ABFVoiceTagInfo *pVTI, int *pnError);
209
210BOOL WINAPI ABF_PlayVoiceTag( int nFile, const ABFFileHeader *pFH, UINT uTag, int *pnError);
211
212BOOL WINAPI ABF_WriteDelta(int nFile, ABFFileHeader *pFH, const ABFDelta *pDelta, int *pnError);
213BOOL WINAPI ABF_ReadDeltas(int nFile, const ABFFileHeader *pFH, DWORD dwFirstDelta,
214 ABFDelta *pDeltaArray, UINT uNumDeltas, int *pnError);
215BOOL WINAPI ABF_FormatDelta(const ABFFileHeader *pFH, const ABFDelta *pDelta,
216 char *pszText, UINT uTextLen, int *pnError);
217
218BOOL WINAPI ABF_GetFileHandle(int nFile, HANDLE *phHandle, int *pnError);
219
220BOOL WINAPI ABF_GetFileName( int nFile, LPSTR pszFilename, UINT uTextLen, int *pnError );
221*/
222BOOL WINAPI ABF_BuildErrorText(int nErrorNum, const char *szFileName, char *sTxtBuf, UINT uMaxLen);
223/*
224typedef BOOL (CALLBACK *ABFCallback)(void *pvThisPointer, int nError);
225BOOL WINAPI ABF_SetErrorCallback(int nFile, ABFCallback fnCallback, void *pvThisPointer, int *pnError);
226
227// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
228
229BOOL WINAPI ABF_AppendOpen(LPCSTR szFileName, int *phFile, ABFFileHeader *pFH,
230 UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError);
231
232BOOL WINAPI ABF_UpdateEpisodeSamples(int nFile, const ABFFileHeader *pFH, int nChannel, UINT uEpisode,
233 UINT uStartSample, UINT uNumSamples, float *pfBuffer, int *pnError);
234*/
235BOOL WINAPI ABF2_SetChunkSize( int hFile, ABF2FileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError );
236 /*
237BOOL WINAPI ABF_SetOverlap(int nFile, const ABFFileHeader *pFH, BOOL bAllowOverlap, int *pnError);
238
239BOOL WINAPI ABF_SetEpisodeStart(int nFile, UINT uEpisode, UINT uEpiStart, int *pnError);
240
241// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
242
243void *WINAPI ABF_GetSynchArray(int nFile, int *pnError);
244
245BOOL WINAPI ABF_WriteAnnotation( int nFile, ABFFileHeader *pFH, LPCSTR pszText, int *pnError );
246BOOL WINAPI ABF_ReadAnnotation( int nFile, const ABFFileHeader *pFH, DWORD dwIndex,
247 LPSTR pszText, DWORD dwBufSize, int *pnError );
248DWORD WINAPI ABF_GetMaxAnnotationSize( int nFile, const ABFFileHeader *pFH );
249
250BOOL WINAPI ABF_WriteStringAnnotation( int nFile, ABFFileHeader *pFH, LPCSTR pszName, LPCSTR pszData, int *pnError );
251BOOL WINAPI ABF_WriteIntegerAnnotation( int nFile, ABFFileHeader *pFH, LPCSTR pszName, int nData, int *pnError );
252
253BOOL WINAPI ABF_ReadStringAnnotation( int nFile, const ABFFileHeader *pFH, DWORD dwIndex,
254 LPSTR pszName, UINT uSizeName, LPSTR pszValue, UINT uSizeValue,
255 int *pnError );
256BOOL WINAPI ABF_ReadIntegerAnnotation( int nFile, const ABFFileHeader *pFH, DWORD dwIndex,
257 LPSTR pszName, UINT uSizeName, int *pnValue, int *pnError );
258
259BOOL WINAPI ABF_ParseStringAnnotation( LPCSTR pszAnn, LPSTR pszName, UINT uSizeName,
260 LPSTR pszValue, UINT uSizeValue, int *pnError);
261
262BOOL WINAPI ABF_ValidateFileCRC( int nFile, int *pnError );
263*/
264
265//===============================================================================================
266// Macros and functions to deal with returning error return codes through a pointer if given.
267
268#define ERRORRETURN(p, e) return ErrorReturn(p, e);
269 // BOOL ErrorReturn(int *pnError, int nErrorNum);
270
271//===============================================================================================
272// FUNCTION: GetNewFileDescriptor
273// PURPOSE: Allocate a new file descriptor and return it.
274//
275
276#ifdef __cplusplus
277}
278#endif
279
280#endif // INC_ABFFILES_H
281
BOOL WINAPI ABF2_SetChunkSize(int hFile, ABF2FileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError)
BOOL WINAPI ABF_MultiplexRead(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, void *pvBuffer, UINT uBufferSize, UINT *puSizeInSamples, int *pnError)
BOOL WINAPI ABF2_MultiplexRead(int nFile, const ABF2FileHeader *pFH, DWORD dwEpisode, void *pvBuffer, UINT uBufferSize, UINT *puSizeInSamples, int *pnError)
BOOL WINAPI ABF2_ReadChannel(int nFile, const ABF2FileHeader *pFH, int nChannel, DWORD dwEpisode, Vector_float &pfBuffer, UINT *puNumSamples, int *pnError)
BOOL WINAPI ABF_BuildErrorText(int nErrorNum, const char *szFileName, char *sTxtBuf, UINT uMaxLen)
BOOL WINAPI ABF_GetNumSamples(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, UINT *puNumSamples, int *pnError)
BOOL WINAPI ABF2_GetNumSamples(int nFile, const ABF2FileHeader *pFH, DWORD dwEpisode, UINT *puNumSamples, int *pnError)
BOOL WINAPI ABF_ReadOpen(LPCTSTR szFileName, int *phFile, UINT fFlags, ABFFileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError)
BOOL WINAPI ABF_HasData(int nFile, const ABFFileHeader *pFH)
BOOL ABF_Initialize()
BOOL WINAPI ABF_ReadChannel(int nFile, const ABFFileHeader *pFH, int nChannel, DWORD dwEpisode, Vector_float &pfBuffer, UINT *puNumSamples, int *pnError)
BOOL WINAPI ABF_Close(int nFile, int *pnError)
std::vector< float > Vector_float
Definition core.h:56
header file for libstfio
int BOOL
Definition unix.h:49
unsigned int UINT
Definition unix.h:47
#define WINAPI
Definition unix.h:198
unsigned ABFLONG DWORD
Definition unix.h:45
LPCSTR LPCTSTR
Definition unix.h:130