ardour
Parameter.hpp
Go to the documentation of this file.
1 /* This file is part of Evoral.
2  * Copyright (C) 2008 David Robillard <http://drobilla.net>
3  * Copyright (C) 2000-2008 Paul Davis
4  *
5  * Evoral is free software; you can redistribute it and/or modify it under the
6  * terms of the GNU General Public License as published by the Free Software
7  * Foundation; either version 2 of the License, or (at your option) any later
8  * version.
9  *
10  * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef EVORAL_PARAMETER_HPP
20 #define EVORAL_PARAMETER_HPP
21 
22 #include <string>
23 #include <map>
24 #include <stdint.h>
25 #include <boost/shared_ptr.hpp>
26 
27 #include "evoral/visibility.h"
28 
29 namespace Evoral {
30 
41 {
42 public:
43  inline Parameter(uint32_t type, uint8_t channel=0, uint32_t id=0)
44  : _type(type), _id(id), _channel(channel)
45  {}
46 
47  inline uint32_t type() const { return _type; }
48  inline uint8_t channel() const { return _channel; }
49  inline uint32_t id() const { return _id; }
50 
56  inline bool operator==(const Parameter& id) const {
57  return (_type == id._type && _channel == id._channel && _id == id._id );
58  }
59 
60  inline bool operator!=(const Parameter& id) const {
61  return !operator==(id);
62  }
63 
68  inline bool operator<(const Parameter& other) const {
69  if (_type < other._type) {
70  return true;
71  } else if (_type == other._type && _channel < other._channel) {
72  return true;
73  } else if (_type == other._type && _channel == other._channel && _id < other._id ) {
74  return true;
75  }
76 
77  return false;
78  }
79 
80  inline operator bool() const { return (_type != 0); }
81 
82 private:
83  uint32_t _type;
84  uint32_t _id;
85  uint8_t _channel;
86 };
87 
88 } // namespace Evoral
89 
90 #endif // EVORAL_PARAMETER_HPP
91 
Parameter(uint32_t type, uint8_t channel=0, uint32_t id=0)
Definition: Parameter.hpp:43
bool operator<(const Parameter &other) const
Definition: Parameter.hpp:68
#define LIBEVORAL_API
Definition: visibility.h:45
bool operator==(const Parameter &id) const
Definition: Parameter.hpp:56
uint32_t id() const
Definition: Parameter.hpp:49
bool operator!=(const Parameter &id) const
Definition: Parameter.hpp:60
uint32_t type() const
Definition: Parameter.hpp:47
bool operator==(Range< T > a, Range< T > b)
Definition: Range.hpp:144
uint8_t channel() const
Definition: Parameter.hpp:48