-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprotocol.h
More file actions
106 lines (88 loc) · 3.79 KB
/
protocol.h
File metadata and controls
106 lines (88 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
* Copyright (C) 2011 Weill Medical College of Cornell University
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef CP_PROTOCOL_H
#define CP_PROTOCOL_H
#include <boost/shared_ptr.hpp>
#include <vector>
#include <qdom.h>
namespace ClampProtocolModule {
class Protocol;
class ProtocolStep;
class ProtocolSegment;
typedef boost::shared_ptr<ProtocolStep> Step; // Step pointer
typedef std::vector<Step> SegmentContainer; // Vector of steps: segment
typedef std::vector<Step>::iterator SegmentContainerIt; // Iterator for segment container
typedef boost::shared_ptr<ProtocolSegment> Segment; // Segment pointer
typedef std::vector<Segment> ProtocolContainer; // Vector of segments: protocol
typedef std::vector<Segment>::iterator ProtocolContainerIt; // Iterator for protocol containter
class ProtocolStep { // Individual step within a protocol
public:
ProtocolStep();
~ProtocolStep() { };
double retrieve( int );
enum ampMode_t{VOLTAGE,CURRENT} ampMode;
enum stepType_t{STEP,RAMP,TRAIN,CURVE} stepType;
double stepDuration;
double deltaStepDuration;
double delayBefore;
double delayAfter;
double holdingLevel1;
double deltaHoldingLevel1;
double holdingLevel2;
double deltaHoldingLevel2;
double pulseWidth;
int pulseRate;
}; // class ProtocolStep
class ProtocolSegment { // A segment within a protocol, made up of ProtocolSteps
friend class Protocol;
public:
ProtocolSegment();
~ProtocolSegment() { };
SegmentContainer segmentContainer;
private:
int numSweeps;
};
class Protocol {
friend class ClampProtocolEditor;
public:
Protocol();
~Protocol() { };
// These should be private
Segment getSegment( int ); // Return a segment
int numSegments( void ); // Number of segments in a protocol
int numSweeps( int ); // Number of sweeps in a segment
int segmentLength( int, double, bool ); // Points in a segment (w/ or w/o sweeps), length / period
void setSweeps( int, int ); // Set sweeps for a segment
Step getStep( int, int ); // Return step in a segment
int numSteps( int ); // Return number of steps in segment
void toDoc( void ); // Convert protocol to QDomDocument
void fromDoc( QDomDocument ); // Load protocol from a QDomDocument
void clear( void ); // Clears container
std::vector<std::vector<double>> run( double ); // Runs the protocol, returns a time and output vector
ProtocolContainer protocolContainer;
QDomDocument protocolDoc;
private:
int addSegment( int ); // Add a segment to container
int deleteSegment( int ); // Delete a segment from container
int addStep( int, int ); // Add a step to a segment in container
int deleteStep( int, int ); // Delete a step from segment in container
QDomElement segmentToNode( QDomDocument &, int );
QDomElement stepToNode( QDomDocument &, int, int );
}; // class Protocol
}
#endif // CP_protocol.h