Spike
Loading...
Searching...
No Matches
Signal.h
Go to the documentation of this file.
1
6#ifndef SPIKE_SIGNAL_H
7#define SPIKE_SIGNAL_H
8
9#include <memory>
10#include <ostream>
11#include <string>
12
13#include "Spike/TimeFrame/TimeFrame.h"
14
15namespace Spike {
16
20class Signal {
21protected:
23 std::vector<double> signal_values;
24
25public:
30 explicit Signal(const TimeFrame &time_frame);
31
37 [[nodiscard]] double get_value(size_t i) const;
38
43 virtual void print(std::ostream &out) const = 0;
44
51 friend std::ostream &operator<<(std::ostream &out, const Signal &signal);
52};
53
54} // namespace Spike
55
56#endif // SPIKE_SIGNAL_H
An abstract base class for signals.
Definition Signal.h:20
friend std::ostream & operator<<(std::ostream &out, const Signal &signal)
Overloads the << operator so we can print signal to out.
Definition Signal.cpp:12
Signal(const TimeFrame &time_frame)
Constructs signal from given time frame.
Definition Signal.cpp:5
const TimeFrame & time_frame
reference to time frame
Definition Signal.h:22
std::vector< double > signal_values
array containing the signal values
Definition Signal.h:23
virtual void print(std::ostream &out) const =0
Prints the signal to out stream.
double get_value(size_t i) const
Returns the signal value at index i.
Definition Signal.cpp:10
A time frame with discrete time steps.
Definition TimeFrame.h:13