Ardour  9.0-pre0-350-gf17a656217
session_configuration.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
3  * Copyright (C) 2009-2014 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2009 Carl Hetherington <carl@carlh.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
23 #include <map>
24 #include <string>
25 
26 #include "ardour/types.h"
27 #include "pbd/configuration.h"
28 
29 namespace ARDOUR {
30 
32 {
33 public:
35 
36  void map_parameters (std::function<void (std::string)>&);
37  int set_state (XMLNode const &, int version);
38  XMLNode& get_state () const;
39  XMLNode& get_variables (std::string const & nodename) const;
40  void set_variables (XMLNode const &);
41 
42  bool load_state ();
43  bool save_state ();
44 
45  /* define accessor methods */
46 
47  /* clang-format off */
48 #undef CONFIG_VARIABLE
49 #undef CONFIG_VARIABLE_SPECIAL
50 #define CONFIG_VARIABLE(Type,var,name,value) \
51  Type get_##var () const { return var.get(); } \
52  bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
53 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
54  Type get_##var () const { return var.get(); } \
55  bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
57 #undef CONFIG_VARIABLE
58 #undef CONFIG_VARIABLE_SPECIAL
59  /* clang-format on */
60 
61  private:
62 
63  /* declare variables */
64 
65  /* clang-format off */
66 #undef CONFIG_VARIABLE
67 #undef CONFIG_VARIABLE_SPECIAL
68 #define CONFIG_VARIABLE(Type,var,name,value) PBD::ConfigVariable<Type> var;
69 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) PBD::ConfigVariableWithMutation<Type> var;
71 #undef CONFIG_VARIABLE
72 #undef CONFIG_VARIABLE_SPECIAL
73  /* clang-format on */
74 
75  int foo;
76 
77  std::map<std::string,PBD::ConfigVariableBase*> _my_variables;
78 };
79 
80 }
81 
void set_variables(XMLNode const &)
XMLNode & get_variables(std::string const &nodename) const
void map_parameters(std::function< void(std::string)> &)
XMLNode & get_state() const
std::map< std::string, PBD::ConfigVariableBase * > _my_variables
int set_state(XMLNode const &, int version)
Definition: xml++.h:114
#define LIBARDOUR_API