From 053306f2934e6ac61f03783c36eeff6b2c5ffe0f Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 23 Jul 2019 10:12:41 -0700 Subject: rfnoc: actions: Add dictionary to all actions This can be used to set arbitrary key/value pairs on the action object. Easier to use than serialization, but doesn't require custom types, either. --- host/lib/rfnoc/actions.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'host/lib') diff --git a/host/lib/rfnoc/actions.cpp b/host/lib/rfnoc/actions.cpp index c441c52b3..d4ed4559f 100644 --- a/host/lib/rfnoc/actions.cpp +++ b/host/lib/rfnoc/actions.cpp @@ -15,20 +15,25 @@ namespace { std::atomic action_counter{0}; } -action_info::action_info(const std::string& key_) : id(action_counter++), key(key_) +action_info::action_info(const std::string& key, const uhd::device_addr_t& args) + : id(action_counter++), key(key), args(args) { // nop } //! Factory function -action_info::sptr action_info::make(const std::string& key) +action_info::sptr action_info::make( + const std::string& key, const uhd::device_addr_t& args) { + struct action_info_make_shared : public action_info + { + }; if (key == ACTION_KEY_STREAM_CMD) { return stream_cmd_action_info::make( uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS); } - //return std::make_shared(key); - return sptr(new action_info(key)); + // return std::make_shared(key, args); + return sptr(new action_info(key, args)); } /*** Stream Command Action Info **********************************************/ -- cgit v1.2.3