USRP Hardware Driver and USRP Manual  Version: 004.000.000.HEAD-0-g8773fb2c
UHD and USRP Manual
stream_sig.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2014-2015 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_LIBUHD_RFNOC_STREAMSIG_HPP
19 #define INCLUDED_LIBUHD_RFNOC_STREAMSIG_HPP
20 
21 #include <iostream>
22 #include <uhd/config.hpp>
23 
24 namespace uhd { namespace rfnoc {
25 
34  public:
35  /***********************************************************************
36  * Structors
37  ***********************************************************************/
38  stream_sig_t();
39 
40  /***********************************************************************
41  * The stream signature attributes
42  ***********************************************************************/
44  // to empty.
45  std::string item_type;
46 
48  size_t vlen;
49 
51  size_t packet_size;
52 
53  bool is_bursty;
54 
55  /***********************************************************************
56  * Helpers
57  ***********************************************************************/
59  std::string to_string();
61  std::string to_pp_string();
62 
64  // Note: The vector length is *not* considered here.
65  //
66  // \returns Number of bytes per item or 0 if the item type is
67  // undefined.
68  // \throws uhd::key_error if the item type is invalid.
69  size_t get_bytes_per_item() const;
70 
76  static bool is_compatible(const stream_sig_t &output_sig, const stream_sig_t &input_sig);
77 };
78 
80 UHD_INLINE std::ostream& operator<< (std::ostream& out, stream_sig_t stream_sig) {
81  out << stream_sig.to_string().c_str();
82  return out;
83 }
84 
85 }} /* namespace uhd::rfnoc */
86 
87 #endif /* INCLUDED_LIBUHD_RFNOC_STREAMSIG_HPP */
88 // vim: sw=4 et:
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:45
size_t vlen
The vector length in multiples of items. If undefined, set to zero.
Definition: stream_sig.hpp:48
Definition: build_info.hpp:25
std::ostream & operator<<(std::ostream &out, block_id_t block_id)
Shortcut for << block_id.to_string()
Definition: block_id.hpp:203
#define UHD_RFNOC_API
Definition: config.hpp:103
#define UHD_INLINE
Definition: config.h:63
bool is_bursty
Definition: stream_sig.hpp:53
size_t packet_size
Packet size in bytes. If undefined, set to zero.
Definition: stream_sig.hpp:51
Definition: stream_sig.hpp:33