Ardour  8.12
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 #ifndef __ardour_session_configuration_h__
22 #define __ardour_session_configuration_h__
23 
24 #include <map>
25 #include <string>
26 
27 #include "ardour/types.h"
28 #include "pbd/configuration.h"
29 
30 namespace ARDOUR {
31 
33 {
34 public:
36 
37  void map_parameters (boost::function<void (std::string)>&);
38  int set_state (XMLNode const &, int version);
39  XMLNode& get_state () const;
40  XMLNode& get_variables (std::string const & nodename) const;
41  void set_variables (XMLNode const &);
42 
43  bool load_state ();
44  bool save_state ();
45 
46  /* define accessor methods */
47 
48  /* clang-format off */
49 #undef CONFIG_VARIABLE
50 #undef CONFIG_VARIABLE_SPECIAL
51 #define CONFIG_VARIABLE(Type,var,name,value) \
52  Type get_##var () const { return var.get(); } \
53  bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
54 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
55  Type get_##var () const { return var.get(); } \
56  bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
58 #undef CONFIG_VARIABLE
59 #undef CONFIG_VARIABLE_SPECIAL
60  /* clang-format on */
61 
62  private:
63 
64  /* declare variables */
65 
66  /* clang-format off */
67 #undef CONFIG_VARIABLE
68 #undef CONFIG_VARIABLE_SPECIAL
69 #define CONFIG_VARIABLE(Type,var,name,value) PBD::ConfigVariable<Type> var;
70 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) PBD::ConfigVariableWithMutation<Type> var;
72 #undef CONFIG_VARIABLE
73 #undef CONFIG_VARIABLE_SPECIAL
74  /* clang-format on */
75 
76  int foo;
77 
78  std::map<std::string,PBD::ConfigVariableBase*> _my_variables;
79 };
80 
81 }
82 
83 #endif
void set_variables(XMLNode const &)
XMLNode & get_variables(std::string const &nodename) const
void map_parameters(boost::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