root/trunk/libffado/src/libcontrol/Element.h

Revision 581, 3.0 kB (checked in by ppalmers, 17 years ago)

- First attempt at mixer control (still disfunctional)
- moved vendor specific code in bebob/*

Line 
1 /*
2  * Copyright (C) 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 library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1, as published by the Free Software Foundation;
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301 USA
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         {m_Children.clear(); return true;};
104
105     unsigned int countElements()
106         {return m_Children.size();};
107
108     const ElementVector & getElements()
109         {return m_Children;};
110
111     virtual void show();
112 protected:
113     ElementVector m_Children;
114 };
115
116
117 }; // namespace Control
118
119 #endif // CONTROL_ELEMENT_H
Note: See TracBrowser for help on using the browser.