X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fevoral%2Fevoral%2FParameter.hpp;h=35fae2dee21815bb1302dfe3356efea2a396f070;hb=460d2d067545309f103089debdd68a553af29450;hp=48701c876fbd65534cb217a3ab8e9c34d4168fdd;hpb=20342cf2644fee7b04d6cfdc4fc686897837a01b;p=ardour.git diff --git a/libs/evoral/evoral/Parameter.hpp b/libs/evoral/evoral/Parameter.hpp index 48701c876f..35fae2dee2 100644 --- a/libs/evoral/evoral/Parameter.hpp +++ b/libs/evoral/evoral/Parameter.hpp @@ -2,16 +2,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -24,8 +24,6 @@ #include #include #include -#include -#include namespace Evoral { @@ -45,9 +43,9 @@ public: Parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) : _type(type), _id(id), _channel(channel) {} - + virtual ~Parameter() {} - + inline uint32_t type() const { return _type; } inline uint8_t channel() const { return _channel; } inline uint32_t id() const { return _id; } @@ -60,26 +58,26 @@ public: inline bool operator==(const Parameter& id) const { return (_type == id._type && _channel == id._channel && _id == id._id ); } - + /** Strict weak ordering * See: http://www.sgi.com/tech/stl/StrictWeakOrdering.html * Sort Parameters first according to type then to id and lastly to channel. - * + * * Proof: *
    *
  1. Irreflexivity: f(x, x) is false because of the irreflexivity of \c < in each branch.
  2. - *
  3. Antisymmetry: given x != y, f(x, y) implies !f(y, x) because of the same + *
  4. Antisymmetry: given x != y, f(x, y) implies !f(y, x) because of the same * property of \c < in each branch and the symmetry of operator==.
  5. *
  6. Transitivity: let f(x, y) and f(y, z) => f(x, z) be true. * We prove by contradiction, assuming the contrary: - * f(x, y) and f(x, z) hold => !f(x, z) - * + * f(x, y) and f(x, z) hold => !f(x, z) + * * That implies one of the following: - *
      + *
        *
      1. x == z which contradicts the assumption f(x, y) and f(y, x) * because of antisymmetry. *
      2. - *
      3. f(z, x) is true. That would imply that one of the ivars (we call it i) + *
      4. f(z, x) is true. That would imply that one of the ivars (we call it i) * of x is greater than the same ivar in z while all "previous" ivars * are equal. That would imply that also in y all those "previous" * ivars are equal and because if x.i > z.i it is impossible @@ -87,7 +85,7 @@ public: * time which contradicts the assumption. *
      5. * Therefore f(x, z) is true (transitivity) - *
      + *
    *
  7. *
*/ @@ -99,12 +97,12 @@ public: } else if (_type == other._type && _channel == other._channel && _id < other._id ) { return true; } - + return false; } - + inline operator bool() const { return (_type != 0); } - + /** Not used in indentity/comparison */ struct Metadata { Metadata(double low=0.0, double high=1.0, double mid=0.0) @@ -114,11 +112,11 @@ public: double max; double normal; }; - + inline static void set_range(uint32_t type, double min, double max, double normal) { _type_metadata[type] = Metadata(min, max, normal); } - + inline void set_range(double min, double max, double normal) { _metadata = boost::shared_ptr(new Metadata(min, max, normal)); } @@ -136,12 +134,12 @@ public: protected: // Default copy constructor is ok - + // ID (used in comparison) uint32_t _type; uint32_t _id; uint8_t _channel; - + boost::shared_ptr _metadata; typedef std::map TypeMetadata;