Develop and Download Open Source Software

Browse CVS Repository

Contents of /satellite/neuromanager/DataViewContext.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.11 - (show annotations) (download) (as text)
Sat Feb 4 13:38:16 2006 UTC (18 years, 2 months ago) by orrisroot
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +1 -1 lines
File MIME type: text/x-c++src
FILE REMOVED
moved main application sources to neuromanager directory.

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: DataViewContext.cpp,v 1.10 2006/01/24 01:59:57 orrisroot Exp $ */
23
24 // DataViewContext.cpp : implementation of the CDataViewContext class
25
26 #include "stdafx.h"
27 #include "NeuroManager.h"
28 #include "DataViewContext.h"
29
30 // CDataViewContext
31 CDataViewContext::CDataViewContext()
32 {
33 m_uiDataChannelSize = 0;
34 m_pbDataChannelVisibles = NULL;
35 m_pdYrangeMin = NULL;
36 m_pdYrangeMax = NULL;
37 }
38
39 CDataViewContext::~CDataViewContext()
40 {
41 DeleteContext();
42 }
43
44 BOOL CDataViewContext::CreateContext( UINT ch )
45 {
46 BOOL ret = FALSE;
47 ASSERT( m_uiDataChannelSize == 0 );
48 if ( ch != 0 )
49 {
50 m_uiDataChannelSize = ch;
51 m_pbDataChannelVisibles = new BOOL[ ch ];
52 m_pdYrangeMin = new double[ ch ];
53 m_pdYrangeMax = new double[ ch ];
54 for ( UINT i = 0; i < ch; i++ )
55 {
56 m_pbDataChannelVisibles[ i ] = FALSE;
57 m_pdYrangeMin[ i ] = 0.0;
58 m_pdYrangeMax[ i ] = 0.0;
59 }
60 ret = TRUE;
61 }
62 return ret;
63 }
64
65 BOOL CDataViewContext::DeleteContext()
66 {
67 BOOL ret = FALSE;
68 if ( m_uiDataChannelSize > 0 )
69 {
70 delete [] m_pbDataChannelVisibles;
71 delete [] m_pdYrangeMin;
72 delete [] m_pdYrangeMax;
73 m_uiDataChannelSize = 0;
74 m_pbDataChannelVisibles = NULL;
75 m_pdYrangeMin = NULL;
76 m_pdYrangeMax = NULL;
77 ret = TRUE;
78 }
79 return ret;
80 }
81
82 void CDataViewContext::InitializeContext( UINT ch )
83 {
84 DeleteContext();
85 if ( ch > 0 )
86 CreateContext( ch );
87 return ;
88 }
89
90 BOOL CDataViewContext::SetVisibleDataChannelState( UINT ch, BOOL bState )
91 {
92 ASSERT( ch < m_uiDataChannelSize );
93 BOOL bOldState = m_pbDataChannelVisibles[ ch ];
94 m_pbDataChannelVisibles[ ch ] = bState;
95 return bOldState;
96 }
97
98 void CDataViewContext::SetDataYAxisRange( UINT ch, double ymin, double ymax )
99 {
100 ASSERT( ch < m_uiDataChannelSize );
101 m_pdYrangeMin[ ch ] = ymin;
102 m_pdYrangeMax[ ch ] = ymax;
103 }
104
105 UINT CDataViewContext::GetVisibleDataChannelSize()
106 {
107 int ch = 0;
108 for ( UINT n = 0; n < m_uiDataChannelSize; n++ )
109 {
110 if ( m_pbDataChannelVisibles[ n ] == TRUE )
111 ch++;
112 }
113 return ch;
114 }
115
116 BOOL CDataViewContext::GetVisibleDataChannelState( UINT ch )
117 {
118 ASSERT( ch < m_uiDataChannelSize );
119 return m_pbDataChannelVisibles[ ch ];
120 }
121
122 void CDataViewContext::GetDataYAxisRange( UINT ch, double &ymin, double &ymax )
123 {
124 ASSERT( ch < m_uiDataChannelSize );
125 ymin = m_pdYrangeMin[ ch ];
126 ymax = m_pdYrangeMax[ ch ];
127 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26