1 |
/* |
---|
2 |
* Copyright (C) 2005-2007 by Pieter Palmers |
---|
3 |
* |
---|
4 |
* This file is part of FFADO |
---|
5 |
* FFADO = Free Firewire (pro-)audio drivers for linux |
---|
6 |
* |
---|
7 |
* FFADO is based upon FreeBoB |
---|
8 |
* |
---|
9 |
* This program is free software: you can redistribute it and/or modify |
---|
10 |
* it under the terms of the GNU General Public License as published by |
---|
11 |
* the Free Software Foundation, either version 3 of the License, or |
---|
12 |
* (at your option) any later version. |
---|
13 |
* |
---|
14 |
* This program is distributed in the hope that it will be useful, |
---|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 |
* GNU General Public License for more details. |
---|
18 |
* |
---|
19 |
* You should have received a copy of the GNU General Public License |
---|
20 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
21 |
* |
---|
22 |
*/ |
---|
23 |
|
---|
24 |
#ifndef CONTROL_ELEMENT_H |
---|
25 |
#define CONTROL_ELEMENT_H |
---|
26 |
|
---|
27 |
#include "debugmodule/debugmodule.h" |
---|
28 |
|
---|
29 |
#include <vector> |
---|
30 |
#include <string> |
---|
31 |
|
---|
32 |
namespace Control { |
---|
33 |
|
---|
34 |
/*! |
---|
35 |
@brief Base class for control elements |
---|
36 |
|
---|
37 |
This class should be subclassed to implement ffado control elements. |
---|
38 |
*/ |
---|
39 |
class Element |
---|
40 |
{ |
---|
41 |
public: |
---|
42 |
Element(); |
---|
43 |
Element(std::string n); |
---|
44 |
virtual ~Element() {}; |
---|
45 |
|
---|
46 |
virtual std::string getName() {return m_Name;}; |
---|
47 |
virtual bool setName( std::string n ) |
---|
48 |
{ m_Name=n; return true;}; |
---|
49 |
|
---|
50 |
virtual std::string getLabel() {return m_Label;}; |
---|
51 |
virtual bool setLabel( std::string n ) |
---|
52 |
{ m_Label=n; return true;}; |
---|
53 |
|
---|
54 |
virtual std::string getDescription() {return m_Description;}; |
---|
55 |
virtual bool setDescription( std::string n ) |
---|
56 |
{ m_Description=n; return true;}; |
---|
57 |
|
---|
58 |
uint64_t getId() |
---|
59 |
{return m_id;}; |
---|
60 |
|
---|
61 |
virtual void show(); |
---|
62 |
|
---|
63 |
/** |
---|
64 |
* set verbosity level |
---|
65 |
*/ |
---|
66 |
virtual void setVerboseLevel(int l); |
---|
67 |
|
---|
68 |
private: |
---|
69 |
std::string m_Name; |
---|
70 |
std::string m_Label; |
---|
71 |
std::string m_Description; |
---|
72 |
|
---|
73 |
uint64_t m_id; |
---|
74 |
|
---|
75 |
protected: |
---|
76 |
DECLARE_DEBUG_MODULE; |
---|
77 |
|
---|
78 |
}; |
---|
79 |
typedef std::vector<Element *> ElementVector; |
---|
80 |
typedef std::vector<Element *>::iterator ElementVectorIterator; |
---|
81 |
typedef std::vector<Element *>::const_iterator ConstElementVectorIterator; |
---|
82 |
|
---|
83 |
/*! |
---|
84 |
@brief Base class for control containers |
---|
85 |
|
---|
86 |
This class should be subclassed to implement ffado control container elements. |
---|
87 |
Containers are classes that can hold a set of control elements. They themselves |
---|
88 |
are control elements such that hierarchies can be defined using them. |
---|
89 |
|
---|
90 |
Special control containers that act on all of their children can also be |
---|
91 |
implemented. |
---|
92 |
*/ |
---|
93 |
class Container : public Element |
---|
94 |
{ |
---|
95 |
public: |
---|
96 |
Container(); |
---|
97 |
Container(std::string n); |
---|
98 |
virtual ~Container() {}; |
---|
99 |
|
---|
100 |
virtual bool addElement(Element *e); |
---|
101 |
virtual bool deleteElement(Element *e); |
---|
102 |
virtual bool clearElements() |
---|
103 |
{return clearElements(false);}; |
---|
104 |
virtual bool clearElements(bool delete_pointers); |
---|
105 |
|
---|
106 |
unsigned int countElements() |
---|
107 |
{return m_Children.size();}; |
---|
108 |
|
---|
109 |
const ElementVector & getElements() |
---|
110 |
{return m_Children;}; |
---|
111 |
|
---|
112 |
virtual void show(); |
---|
113 |
virtual void setVerboseLevel(int l); |
---|
114 |
|
---|
115 |
protected: |
---|
116 |
ElementVector m_Children; |
---|
117 |
}; |
---|
118 |
|
---|
119 |
|
---|
120 |
}; // namespace Control |
---|
121 |
|
---|
122 |
#endif // CONTROL_ELEMENT_H |
---|