]> sigrok.org Git - pulseview.git/blobdiff - pv/views/trace/signal.hpp
Implement MathSignal
[pulseview.git] / pv / views / trace / signal.hpp
index 1c53d8b2260a960669261c056f069a9e35883bfb..ca8eea2e4a85f3820de0c6b883bed9f8e69d6812 100644 (file)
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNAL_HPP
-#define PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNAL_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACE_SIGNAL_HPP
+#define PULSEVIEW_PV_VIEWS_TRACE_SIGNAL_HPP
 
 #include <memory>
 
 #include <QComboBox>
+#include <QString>
+#include <QVariant>
 #include <QWidgetAction>
 
 #include <cstdint>
 
+#include <pv/data/logicsegment.hpp>
+
 #include "trace.hpp"
 #include "viewitemowner.hpp"
 
@@ -58,7 +62,7 @@ class Signal : public Trace, public ViewItemOwner
        Q_OBJECT
 
 protected:
-       Signal(pv::Session &session, shared_ptr<data::SignalBase> channel);
+       Signal(pv::Session &session, shared_ptr<data::SignalBase> signal);
 
 public:
        /**
@@ -68,6 +72,15 @@ public:
 
        virtual shared_ptr<pv::data::SignalData> data() const = 0;
 
+       /**
+        * Determines the closest level change (i.e. edge) to a given sample, which
+        * is useful for e.g. the "snap to edge" functionality.
+        *
+        * @param sample_pos Sample to use
+        * @return The changes left and right of the given position
+        */
+       virtual vector<data::LogicSegment::EdgePair> get_nearest_level_changes(uint64_t sample_pos) = 0;
+
        /**
         * Returns true if the trace is visible and enabled.
         */
@@ -76,8 +89,10 @@ public:
        shared_ptr<data::SignalBase> base() const;
 
        virtual void save_settings(QSettings &settings) const;
+       virtual std::map<QString, QVariant> save_settings() const;
 
        virtual void restore_settings(QSettings &settings);
+       virtual void restore_settings(std::map<QString, QVariant> settings);
 
        void paint_back(QPainter &p, ViewItemPaintParams &pp);
 
@@ -104,4 +119,4 @@ protected:
 } // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNAL_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACE_SIGNAL_HPP