summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-26 12:16:37 -0700
committerJosh Blum <josh@joshknows.com>2010-04-26 12:16:37 -0700
commit1217b8d67c3bef98195836fe10ab39576642b340 (patch)
tree97c8e964b38a27db66fcb2f68a646e483b3de436 /host/include
parent0c609b96574095affe12d9aaa53bead98faba4f3 (diff)
downloaduhd-1217b8d67c3bef98195836fe10ab39576642b340.tar.gz
uhd-1217b8d67c3bef98195836fe10ab39576642b340.tar.bz2
uhd-1217b8d67c3bef98195836fe10ab39576642b340.zip
Got eeprom read/write dboard ids working.
Moved named prop implementation into cpp, and made named prop a struct (tuples are trouble).
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/utils/props.hpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/host/include/uhd/utils/props.hpp b/host/include/uhd/utils/props.hpp
index bfbca4273..768655e36 100644
--- a/host/include/uhd/utils/props.hpp
+++ b/host/include/uhd/utils/props.hpp
@@ -29,24 +29,35 @@
namespace uhd{
- //typedef for handling named properties
+ //! The type for a vector of property names
typedef std::vector<std::string> prop_names_t;
- typedef boost::tuple<wax::obj, std::string> named_prop_t;
+
+ /*!
+ * A named prop struct holds a key and a name.
+ * Allows properties to be sub-sectioned by name.
+ */
+ struct UHD_API named_prop_t{
+ wax::obj key;
+ std::string name;
+
+ /*!
+ * Create a new named prop from key and name.
+ * \param key the property key
+ * \param name the string name
+ */
+ named_prop_t(const wax::obj &key, const std::string &name);
+ };
/*!
* Utility function to separate a named property into its components.
* \param key a reference to the prop object
* \param name a reference to the name object
+ * \return a tuple that can be used with boost::tie
*/
- inline UHD_API named_prop_t extract_named_prop(
+ UHD_API boost::tuple<wax::obj, std::string> extract_named_prop(
const wax::obj &key,
const std::string &name = ""
- ){
- if (key.type() == typeid(named_prop_t)){
- return key.as<named_prop_t>();
- }
- return named_prop_t(key, name);
- }
+ );
//! The exception to throw for property errors
struct UHD_API prop_error : virtual std::exception, virtual boost::exception{};