Ardour  8.7-14-g57a6773833
state.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Luciano Iam <oss@lucianoiam.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef _ardour_surface_websockets_state_h_
20 #define _ardour_surface_websockets_state_h_
21 
22 #include <climits>
23 #include <cmath>
24 #include <cstring>
25 #include <stdint.h>
26 #include <vector>
27 
28 #include "typed_value.h"
29 
30 #define ADDR_NONE UINT_MAX
31 
32 namespace ArdourSurface {
33 
34 namespace Node
35 {
36  const std::string strip_description = "strip_description";
37  const std::string strip_meter = "strip_meter";
38  const std::string strip_gain = "strip_gain";
39  const std::string strip_pan = "strip_pan";
40  const std::string strip_mute = "strip_mute";
41  const std::string strip_plugin_description = "strip_plugin_description";
42  const std::string strip_plugin_enable = "strip_plugin_enable";
43  const std::string strip_plugin_param_description = "strip_plugin_param_description";
44  const std::string strip_plugin_param_value = "strip_plugin_param_value";
45  const std::string transport_tempo = "transport_tempo";
46  const std::string transport_time = "transport_time";
47  const std::string transport_bbt = "transport_bbt";
48  const std::string transport_roll = "transport_roll";
49  const std::string transport_record = "transport_record";
50 } // namespace Node
51 
52 typedef std::vector<uint32_t> AddressVector;
53 typedef std::vector<TypedValue> ValueVector;
54 
55 class NodeState
56 {
57 public:
59  NodeState (std::string);
61 
62  std::string debug_str () const;
63 
64  std::string node () const
65  {
66  return _node;
67  }
68 
69  int n_addr () const;
70  uint32_t nth_addr (int) const;
71  void add_addr (uint32_t);
72 
73  int n_val () const;
74  TypedValue nth_val (int) const;
76 
77  std::size_t node_addr_hash () const;
78 
79  bool operator== (const NodeState& other) const;
80  bool operator< (const NodeState& other) const;
81 
82 private:
83  std::string _node;
86 };
87 
88 std::size_t
90 
91 } // namespace ArdourSurface
92 
93 #endif // _ardour_surface_websockets_state_h_
bool operator==(const NodeState &other) const
TypedValue nth_val(int) const
std::string node() const
Definition: state.h:64
void add_addr(uint32_t)
NodeState(std::string, AddressVector, ValueVector=ValueVector())
AddressVector _addr
Definition: state.h:84
std::string _node
Definition: state.h:83
bool operator<(const NodeState &other) const
std::size_t node_addr_hash() const
ValueVector _val
Definition: state.h:85
void add_val(TypedValue)
std::string debug_str() const
uint32_t nth_addr(int) const
const std::string transport_record
Definition: state.h:49
const std::string strip_plugin_param_description
Definition: state.h:43
const std::string strip_plugin_description
Definition: state.h:41
const std::string strip_mute
Definition: state.h:40
const std::string strip_gain
Definition: state.h:38
const std::string strip_plugin_enable
Definition: state.h:42
const std::string transport_tempo
Definition: state.h:45
const std::string transport_bbt
Definition: state.h:47
const std::string strip_meter
Definition: state.h:37
const std::string strip_plugin_param_value
Definition: state.h:44
const std::string strip_description
Definition: state.h:36
const std::string transport_time
Definition: state.h:46
const std::string strip_pan
Definition: state.h:39
const std::string transport_roll
Definition: state.h:48
std::vector< uint32_t > AddressVector
Definition: state.h:52
std::size_t hash_value(const NodeState &)
std::vector< TypedValue > ValueVector
Definition: state.h:53
Definition: lobject.h:491