blob: 611cb787cfd12648fcf21ea74d5a0b03b288729b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
//
// Copyright 2019 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#ifndef INCLUDED_LIBUHD_RFNOC_ACTIONS_HPP
#define INCLUDED_LIBUHD_RFNOC_ACTIONS_HPP
#include <uhd/config.hpp>
#include <uhd/rfnoc/defaults.hpp>
#include <uhd/types/stream_cmd.hpp>
#include <string>
#include <vector>
#include <memory>
namespace uhd { namespace rfnoc {
/*! Container for an action
*
* In the RFNoC context, an action is comparable to a command. Nodes in the
* graph can send each other actions. action_info is the payload of such an
* action message. Nodes pass shared pointers to action_info objects between
* each other to avoid costly copies of large action_info objects.
*/
struct UHD_API action_info
{
public:
virtual ~action_info() {}
using sptr = std::shared_ptr<action_info>;
//! A unique counter for this action
const size_t id;
//! A string identifier for this action
std::string key;
//! An arbitrary payload. It is up to consumers and producers to
// (de-)serialize it.
std::vector<uint8_t> payload;
//! Factory function
static sptr make(const std::string& key="");
protected:
action_info(const std::string& key);
};
struct UHD_API stream_cmd_action_info : public action_info
{
public:
using sptr = std::shared_ptr<stream_cmd_action_info>;
uhd::stream_cmd_t stream_cmd;
//! Factory function
static sptr make(const uhd::stream_cmd_t::stream_mode_t stream_mode);
private:
stream_cmd_action_info(const uhd::stream_cmd_t::stream_mode_t stream_mode);
};
}} /* namespace uhd::rfnoc */
#endif /* INCLUDED_LIBUHD_RFNOC_ACTIONS_HPP */
|