RTXI  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
generator.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Georgia Institute of Technology
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the Free
6  * Software Foundation, either version 3 of the License, or (at your option)
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef GENERATOR_H_
19 #define GENERATOR_H_
20 
21 #include <math.h>
22 #include <vector>
23 
24 class Generator
25 {
26 
27 public:
28  // default constructor
29  Generator();
30  ~Generator();
31 
32  // clear the waveform
33  void clear();
34 
35  // initialize waveform
36  void init();
37 
38  // get readout for continuous signal, repeating cycle
39  double get();
40 
41  // get readout for single cycle
42  double getOne();
43 
44  // get number of samples
45  int numSamples() const;
46 
47  // get current index for readout
48  int getIndex() const;
49 
50  // set index
51  void setIndex(int value);
52 
53 protected:
54  std::vector<double> wave;
55  int index;
57  double dt;
58 };
59 
60 #endif /* GENERATOR_H_ */
double dt
Definition: generator.h:57
int numsamples
Definition: generator.h:56
int getIndex() const
Definition: generator.cpp:78
double getOne()
Definition: generator.cpp:62
int numSamples() const
Definition: generator.cpp:72
int index
Definition: generator.h:55
void setIndex(int value)
Definition: generator.cpp:84
std::vector< double > wave
Definition: generator.h:54
void clear()
Definition: generator.cpp:34
void init()
Definition: generator.cpp:43