add const-ness: Evaluating a curve does not change it.
authorRobin Gareus <robin@gareus.org>
Sat, 3 Jun 2017 10:30:26 +0000 (12:30 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 3 Jun 2017 11:55:02 +0000 (13:55 +0200)
Note that the ControlList's lock and cache are already mutable.

libs/evoral/evoral/Curve.hpp
libs/evoral/src/Curve.cpp

index bf2de520a09d715d2280e5431a33600e78ad54b8..85158cbc5467da781200dfe7b1ea31ff9969a038 100644 (file)
@@ -33,17 +33,17 @@ class LIBEVORAL_API Curve : public boost::noncopyable
 public:
        Curve (const ControlList& cl);
 
-       bool rt_safe_get_vector (double x0, double x1, float *arg, int32_t veclen);
-       void get_vector (double x0, double x1, float *arg, int32_t veclen);
+       bool rt_safe_get_vector (double x0, double x1, float *arg, int32_t veclen) const;
+       void get_vector (double x0, double x1, float *arg, int32_t veclen) const;
 
-       void solve ();
+       void solve () const;
 
        void mark_dirty() const { _dirty = true; }
 
 private:
-       double multipoint_eval (double x);
+       double multipoint_eval (double x) const;
 
-       void _get_vector (double x0, double x1, float *arg, int32_t veclen);
+       void _get_vector (double x0, double x1, float *arg, int32_t veclen) const;
 
        mutable bool       _dirty;
        const ControlList& _list;
index a8605c6f1de8bb8624bcb1b714e3f72bcfa3ff6f..83fd0756bde95e9e9e2e8522f7db21f78414ea3b 100644 (file)
@@ -42,7 +42,7 @@ Curve::Curve (const ControlList& cl)
 }
 
 void
-Curve::solve ()
+Curve::solve () const
 {
        uint32_t npoints;
 
@@ -169,7 +169,7 @@ Curve::solve ()
 }
 
 bool
-Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen)
+Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen) const
 {
        Glib::Threads::RWLock::ReaderLock lm(_list.lock(), Glib::Threads::TRY_LOCK);
 
@@ -182,14 +182,14 @@ Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen)
 }
 
 void
-Curve::get_vector (double x0, double x1, float *vec, int32_t veclen)
+Curve::get_vector (double x0, double x1, float *vec, int32_t veclen) const
 {
        Glib::Threads::RWLock::ReaderLock lm(_list.lock());
        _get_vector (x0, x1, vec, veclen);
 }
 
 void
-Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen)
+Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen) const
 {
        double rx, lx, hx, max_x, min_x;
        int32_t i;
@@ -329,7 +329,7 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen)
 }
 
 double
-Curve::multipoint_eval (double x)
+Curve::multipoint_eval (double x) const
 {
        pair<ControlList::EventList::const_iterator,ControlList::EventList::const_iterator> range;