From 6a8ae2de4261fecd0281685b9eea66bbd82bd7fb Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 1 Aug 2023 08:27:01 +0200 Subject: A4: WIP --- a4/octave.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 a4/octave.h (limited to 'a4/octave.h') diff --git a/a4/octave.h b/a4/octave.h new file mode 100644 index 0000000..3c814c5 --- /dev/null +++ b/a4/octave.h @@ -0,0 +1,45 @@ +// -*- c++ -*- +#pragma once + +#include +#include +#include +#include +#include + +class Plot +{ +public: + Plot(const std::string& title) : title(title) {} + + const std::string& getTitle() const; + void add(const std::pair& point); + void add(double y); + void setX(double x); + + friend const Plot& operator<<(std::ostream& out, const Plot& plot); + +private: + std::vector> data; + std::string title; + double x{}; +}; + +class Octave +{ +public: + Octave(const std::string& file); + ~Octave(); + + Plot& add(const std::string& title); + void setAxis(const std::string& x_axis, const std::string& y_axis); + +private: + std::deque plots; + std::ofstream out; + + std::string x_axis; + std::string y_axis; + + std::string file; +}; -- cgit v1.2.3