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