| 1 |
/* --------------------------------------------------------------------- */ |
| 2 |
/* NeuroManager - A spike train analysis tool */ |
| 3 |
/* Copyright (c) 2005-2006 RIKEN, Japan. All rights reserved. */ |
| 4 |
/* http://satellite.sourceforge.jp/ */ |
| 5 |
/* --------------------------------------------------------------------- */ |
| 6 |
/* This program is free software; you can redistribute it and/or */ |
| 7 |
/* modify it under the terms of the GNU General Public License */ |
| 8 |
/* as published by the Free Software Foundation; either version 2 */ |
| 9 |
/* of the License, or (at your option) any later version. */ |
| 10 |
/* */ |
| 11 |
/* This program is distributed in the hope that it will be useful, */ |
| 12 |
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 13 |
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 14 |
/* GNU General Public License for more details. */ |
| 15 |
/* */ |
| 16 |
/* You should have received a copy of the GNU General Public License */ |
| 17 |
/* along with this program; see the file COPYING.txt. If not, write */ |
| 18 |
/* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth */ |
| 19 |
/* Floor, Boston, MA 02110-1301, USA. */ |
| 20 |
/* --------------------------------------------------------------------- */ |
| 21 |
|
| 22 |
/* $Id: MultiChannelData.h,v 1.11 2006/01/24 01:59:57 orrisroot Exp $ */ |
| 23 |
|
| 24 |
// MultiChannelData.h : interface of the CMultiChannelData class |
| 25 |
// |
| 26 |
|
| 27 |
#pragma once |
| 28 |
|
| 29 |
class CMultiChannelData |
| 30 |
{ |
| 31 |
protected: |
| 32 |
// data infomation |
| 33 |
CString m_strDataFile; |
| 34 |
double m_dSamplingRate; |
| 35 |
UINT m_uiChannelNumber; |
| 36 |
QWORD m_qwLength; |
| 37 |
UINT m_uiBitLength; |
| 38 |
BOOL m_bByteSwap; |
| 39 |
CDWordArray m_dwaOffset; |
| 40 |
CArray<double> m_daGain; |
| 41 |
// dynamic changing variable |
| 42 |
CArray<double> m_dYAxisRange; |
| 43 |
// user defined value |
| 44 |
DWORD m_qwYRangeCalcPoint; // data point number for calcurate of y axis range |
| 45 |
private: |
| 46 |
// for performance tuning |
| 47 |
UINT m_uiAttachedChannel; |
| 48 |
double m_dAttachedGain; |
| 49 |
// for file mapping |
| 50 |
BOOL m_bIsMapped; |
| 51 |
DWORD m_dwMapSizeHigh; |
| 52 |
DWORD m_dwMapSizeLow; |
| 53 |
HANDLE m_hDataFile; |
| 54 |
HANDLE m_hMapping; |
| 55 |
void *m_pMappingView; |
| 56 |
CMutex *m_pMutex; |
| 57 |
DWORD m_dwMapViewOffsetHigh; |
| 58 |
DWORD m_dwMapViewOffsetLow; |
| 59 |
SIZE_T m_sizetMapViewPageCurrent; // current page number |
| 60 |
SIZE_T m_sizetMapViewPageMax; // max page number |
| 61 |
SIZE_T m_sizetMapViewSize; // current memory size |
| 62 |
SIZE_T m_sizetMapViewSizeLastPage; // last page memory size |
| 63 |
SIZE_T m_sizetMapViewSizePage; // page memory size |
| 64 |
SIZE_T m_sizetMapViewSizeLimit; // limit memory size |
| 65 |
private: |
| 66 |
void InitValues(); |
| 67 |
double _getdata( QWORD pos ); |
| 68 |
protected: |
| 69 |
void CalcYAxisRange(); |
| 70 |
BOOL MappingBinaryFile(); |
| 71 |
BOOL UnmappingBinaryFile(); |
| 72 |
virtual CString FormatDataInfo(); |
| 73 |
void SwapData( char *data, int siz ); |
| 74 |
public: |
| 75 |
CMultiChannelData(); |
| 76 |
virtual ~CMultiChannelData(); |
| 77 |
virtual BOOL LoadDataFile( const char *fname ) = 0; |
| 78 |
void PrintDataInfo(); |
| 79 |
BOOL IsMapped() const |
| 80 |
{ |
| 81 |
return m_bIsMapped; |
| 82 |
} |
| 83 |
void AttachData( UINT ch ); |
| 84 |
void DetachData(); |
| 85 |
double GetData( QWORD pos ); |
| 86 |
double GetPosTime( QWORD pos ) const; |
| 87 |
double GetYAxisRange( UINT ch ); |
| 88 |
double GetSamplingRate() const |
| 89 |
{ |
| 90 |
return m_dSamplingRate; |
| 91 |
} |
| 92 |
UINT GetChannelNumber() const |
| 93 |
{ |
| 94 |
return m_uiChannelNumber; |
| 95 |
} |
| 96 |
QWORD GetDataLength() const |
| 97 |
{ |
| 98 |
return m_qwLength; |
| 99 |
} |
| 100 |
UINT GetBitLength() const |
| 101 |
{ |
| 102 |
return m_uiBitLength; |
| 103 |
} |
| 104 |
BOOL GetByteSwap() const |
| 105 |
{ |
| 106 |
return m_bByteSwap; |
| 107 |
} |
| 108 |
}; |