summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/property_tree.hpp9
-rw-r--r--host/include/uhd/property_tree.ipp22
2 files changed, 7 insertions, 24 deletions
diff --git a/host/include/uhd/property_tree.hpp b/host/include/uhd/property_tree.hpp
index 630e86bba..63cd76a56 100644
--- a/host/include/uhd/property_tree.hpp
+++ b/host/include/uhd/property_tree.hpp
@@ -19,7 +19,6 @@
#define INCLUDED_UHD_PROPERTY_TREE_HPP
#include <uhd/config.hpp>
-#include <boost/any.hpp>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
@@ -34,14 +33,10 @@ namespace uhd{
*/
template <typename T> class UHD_API property : boost::noncopyable{
public:
- typedef boost::shared_ptr<property> sptr;
typedef boost::function<void(const T &)> subscriber_type;
typedef boost::function<T(void)> publisher_type;
typedef boost::function<T(const T &)> master_type;
- //! Make a new property object
- static sptr make(void);
-
/*!
* Register a master subscriber into the property.
* A master is a special subscriber that coerces the value.
@@ -107,10 +102,10 @@ public:
protected:
//! Internal create property with wild-card type
- virtual void _create(const path_type &path, const boost::any &prop) = 0;
+ virtual void _create(const path_type &path, const boost::shared_ptr<void> &prop) = 0;
//! Internal access property with wild-card type
- virtual boost::any &_access(const path_type &path) = 0;
+ virtual boost::shared_ptr<void> &_access(const path_type &path) = 0;
};
diff --git a/host/include/uhd/property_tree.ipp b/host/include/uhd/property_tree.ipp
index e4520df58..1c61d4937 100644
--- a/host/include/uhd/property_tree.ipp
+++ b/host/include/uhd/property_tree.ipp
@@ -18,15 +18,14 @@
#ifndef INCLUDED_UHD_PROPERTY_TREE_IPP
#define INCLUDED_UHD_PROPERTY_TREE_IPP
-#include <uhd/exception.hpp>
#include <boost/foreach.hpp>
+#include <boost/any.hpp>
#include <vector>
/***********************************************************************
* Implement templated property impl
**********************************************************************/
-namespace uhd{
-namespace /*anon*/{
+namespace uhd{ namespace /*anon*/{
template <typename T> class UHD_API property_impl : public property<T>{
public:
@@ -71,13 +70,7 @@ private:
boost::any _value; //any type so we can assign structs w/ const members
};
-} //namespace /*anon*/
-
-template <typename T> typename property<T>::sptr property<T>::make(void){
- return sptr(new property_impl<T>());
-}
-
-} //namespace uhd
+}} //namespace uhd::/*anon*/
/***********************************************************************
* Implement templated methods for the property tree
@@ -85,17 +78,12 @@ template <typename T> typename property<T>::sptr property<T>::make(void){
namespace uhd{
template <typename T> property<T> &property_tree::create(const path_type &path){
- this->_create(path, property<T>::make());
+ this->_create(path, typename boost::shared_ptr<property<T> >(new property_impl<T>()));
return this->access<T>(path);
}
template <typename T> property<T> &property_tree::access(const path_type &path){
- try{
- return *boost::any_cast<typename property<T>::sptr>(this->_access(path));
- }
- catch(const boost::bad_any_cast &){
- throw uhd::type_error("Cannot cast the property at: " + path.string());
- }
+ return *boost::static_pointer_cast<property<T> >(this->_access(path));
}
} //namespace uhd