diff options
| author | Josh Blum <josh@joshknows.com> | 2011-06-28 21:26:28 -0700 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2011-06-28 21:26:28 -0700 | 
| commit | d2f79c07281604c1b48ec81f1cdb2754e97bbe65 (patch) | |
| tree | e41a2000af165384bbe03b1ff6d6ea118bbbcf1f /host/lib | |
| parent | ebd2ecc6ff2b82cb06701bbcda17d4caaa4ba8c1 (diff) | |
| download | uhd-d2f79c07281604c1b48ec81f1cdb2754e97bbe65.tar.gz uhd-d2f79c07281604c1b48ec81f1cdb2754e97bbe65.tar.bz2 uhd-d2f79c07281604c1b48ec81f1cdb2754e97bbe65.zip | |
uhd: added properties unit tests, use shared ptr<void> in tree
Diffstat (limited to 'host/lib')
| -rw-r--r-- | host/lib/property_tree.cpp | 7 | 
1 files changed, 4 insertions, 3 deletions
| diff --git a/host/lib/property_tree.cpp b/host/lib/property_tree.cpp index 4fbdbad12..4a0b1b061 100644 --- a/host/lib/property_tree.cpp +++ b/host/lib/property_tree.cpp @@ -61,7 +61,7 @@ public:          return node->keys();      } -    void _create(const path_type &path, const boost::any &prop){ +    void _create(const path_type &path, const boost::shared_ptr<void> &prop){          boost::mutex::scoped_lock lock(_mutex);          node_type *node = &_root; @@ -72,7 +72,7 @@ public:          node->prop = prop;      } -    boost::any &_access(const path_type &path){ +    boost::shared_ptr<void> &_access(const path_type &path){          boost::mutex::scoped_lock lock(_mutex);          node_type *node = &_root; @@ -80,6 +80,7 @@ public:              if (not node->has_key(leaf)) throw_path_not_found(path);              node = &(*node)[leaf];          } +        if (node->prop.get() == NULL) throw uhd::type_error("Uninitialized property at: " + path.string());          return node->prop;      } @@ -89,7 +90,7 @@ private:      }      struct node_type : uhd::dict<std::string, node_type>{ -        boost::any prop; +        boost::shared_ptr<void> prop;      } _root;      boost::mutex _mutex; | 
