USRP Hardware Driver and USRP Manual  Version: 3.15.0.HEAD-0-gaea0e2de
UHD and USRP Manual
stream_sig.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2014-2015 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #ifndef INCLUDED_LIBUHD_RFNOC_STREAMSIG_HPP
9 #define INCLUDED_LIBUHD_RFNOC_STREAMSIG_HPP
10 
11 #include <uhd/config.hpp>
12 #include <iostream>
13 
14 namespace uhd { namespace rfnoc {
15 
24 {
25 public:
26  /***********************************************************************
27  * Structors
28  ***********************************************************************/
29  stream_sig_t();
30 
31  /***********************************************************************
32  * The stream signature attributes
33  ***********************************************************************/
35  // to empty.
36  std::string item_type;
37 
39  size_t vlen;
40 
42  size_t packet_size;
43 
44  bool is_bursty;
45 
46  /***********************************************************************
47  * Helpers
48  ***********************************************************************/
50  std::string to_string();
52  std::string to_pp_string();
53 
55  // Note: The vector length is *not* considered here.
56  //
57  // \returns Number of bytes per item or 0 if the item type is
58  // undefined.
59  // \throws uhd::key_error if the item type is invalid.
60  size_t get_bytes_per_item() const;
61 
67  static bool is_compatible(
68  const stream_sig_t& output_sig, const stream_sig_t& input_sig);
69 };
70 
72 UHD_INLINE std::ostream& operator<<(std::ostream& out, stream_sig_t stream_sig)
73 {
74  out << stream_sig.to_string().c_str();
75  return out;
76 }
77 
78 }} /* namespace uhd::rfnoc */
79 
80 #endif /* INCLUDED_LIBUHD_RFNOC_STREAMSIG_HPP */
std::string to_string()
Compact string representation.
UHD_API size_t get_bytes_per_item(const std::string &format)
Convert an item format to a size in bytes.
std::string item_type
The data type of the individual items (e.g. &#39;sc16&#39;). If undefined, set.
Definition: stream_sig.hpp:36
size_t vlen
The vector length in multiples of items. If undefined, set to zero.
Definition: stream_sig.hpp:39
Definition: build_info.hpp:13
std::ostream & operator<<(std::ostream &out, block_id_t block_id)
Shortcut for << block_id.to_string()
Definition: block_id.hpp:227
#define UHD_RFNOC_API
Definition: config.hpp:117
#define UHD_INLINE
Definition: config.h:53
bool is_bursty
Definition: stream_sig.hpp:44
size_t packet_size
Packet size in bytes. If undefined, set to zero.
Definition: stream_sig.hpp:42
Definition: stream_sig.hpp:23