summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-10-20 15:32:41 -0700
committerJosh Blum <josh@joshknows.com>2010-10-20 15:32:41 -0700
commit26aef3bae98aae5364deb40a62b52ba65b9aa16a (patch)
tree00b40426474768298322275b7c81c01b24120c6a /host/include
parente0c48ba5cc1033cd330e2ce73ceb03740923e954 (diff)
downloaduhd-26aef3bae98aae5364deb40a62b52ba65b9aa16a.tar.gz
uhd-26aef3bae98aae5364deb40a62b52ba65b9aa16a.tar.bz2
uhd-26aef3bae98aae5364deb40a62b52ba65b9aa16a.zip
uhd: added name parameter to gain group, get range, set/get value by name
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/utils/gain_group.hpp43
1 files changed, 33 insertions, 10 deletions
diff --git a/host/include/uhd/utils/gain_group.hpp b/host/include/uhd/utils/gain_group.hpp
index 3955dfa9a..c863248ce 100644
--- a/host/include/uhd/utils/gain_group.hpp
+++ b/host/include/uhd/utils/gain_group.hpp
@@ -23,6 +23,8 @@
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <boost/utility.hpp>
+#include <vector>
+#include <string>
namespace uhd{
@@ -40,36 +42,57 @@ public:
typedef boost::shared_ptr<gain_group> sptr;
/*!
- * Get the overall gain range for this group.
+ * Get the gain range for the gain element specified by name.
+ * For an empty name, get the overall gain range for this group.
* Overall step is defined as the minimum step size.
+ * \param name name of the gain element (optional)
* \return a gain range with overall min, max, step
*/
- virtual gain_range_t get_range(void) = 0;
+ virtual gain_range_t get_range(const std::string &name = "") = 0;
/*!
- * Get the overall gain value for this group.
- * \return a summation of all the gain values
+ * Get the gain value for the gain element specified by name.
+ * For an empty name, get the overall gain value for this group.
+ * \param name name of the gain element (optional)
+ * \return a gain value of the element or all elements
*/
- virtual float get_value(void) = 0;
+ virtual float get_value(const std::string &name = "") = 0;
/*!
- * Set the overall gain value for this group.
+ * Set the gain value for the gain element specified by name.
+ * For an empty name, set the overall gain value for this group.
* The power will be distributed across individual gain elements.
* The semantics of how to do this are determined by the priority.
- * \param gain the gain to set across the group
+ * \param gain the gain to set for the lement or across the group
+ * \param name name of the gain element (optional)
*/
- virtual void set_value(float gain) = 0;
+ virtual void set_value(float gain, const std::string &name = "") = 0;
/*!
- * Register a set of gain functions into this group.
+ * Get a list of names of registered gain elements.
+ * The names are in the order that they were registered.
+ * \return a vector of gain name strings
+ */
+ virtual const std::vector<std::string> get_names(void) = 0;
+
+ /*!
+ * Register a set of gain functions into this group:
+ *
+ * The name should be a unique and non-empty name.
+ * Othwerwise, the implementation will rename it.
+ *
* Priority determines how power will be distributed
* with higher priorities getting the power first,
* and lower priorities getting the remainder power.
+ *
+ * \param name the name of the gain element
* \param gain_fcns the set of gain functions
* \param priority the priority of the gain element
*/
virtual void register_fcns(
- const gain_fcns_t &gain_fcns, size_t priority = 0
+ const std::string &name,
+ const gain_fcns_t &gain_fcns,
+ size_t priority = 0
) = 0;
/*!