UHD  003.004.002-0-unknown
include/uhd/stream.hpp
Go to the documentation of this file.
00001 //
00002 // Copyright 2011-2012 Ettus Research LLC
00003 //
00004 // This program is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 #ifndef INCLUDED_UHD_STREAM_HPP
00019 #define INCLUDED_UHD_STREAM_HPP
00020 
00021 #include <uhd/config.hpp>
00022 #include <uhd/types/metadata.hpp>
00023 #include <uhd/types/device_addr.hpp>
00024 #include <uhd/types/ref_vector.hpp>
00025 #include <boost/utility.hpp>
00026 #include <boost/shared_ptr.hpp>
00027 #include <vector>
00028 #include <string>
00029 
00030 namespace uhd{
00031 
00039 struct UHD_API stream_args_t{
00040 
00042     stream_args_t(
00043         const std::string &cpu = "",
00044         const std::string &otw = ""
00045     ){
00046         cpu_format = cpu;
00047         otw_format = otw;
00048     }
00049 
00064     std::string cpu_format;
00065 
00076     std::string otw_format;
00077 
00107     device_addr_t args;
00108 
00115     std::vector<size_t> channels;
00116 };
00117 
00123 class UHD_API rx_streamer : boost::noncopyable{
00124 public:
00125     typedef boost::shared_ptr<rx_streamer> sptr;
00126 
00128     virtual size_t get_num_channels(void) const = 0;
00129 
00131     virtual size_t get_max_num_samps(void) const = 0;
00132 
00134     typedef ref_vector<void *> buffs_type;
00135 
00166     virtual size_t recv(
00167         const buffs_type &buffs,
00168         const size_t nsamps_per_buff,
00169         rx_metadata_t &metadata,
00170         const double timeout = 0.1,
00171         const bool one_packet = false
00172     ) = 0;
00173 };
00174 
00180 class UHD_API tx_streamer : boost::noncopyable{
00181 public:
00182     typedef boost::shared_ptr<tx_streamer> sptr;
00183 
00185     virtual size_t get_num_channels(void) const = 0;
00186 
00188     virtual size_t get_max_num_samps(void) const = 0;
00189 
00191     typedef ref_vector<const void *> buffs_type;
00192 
00214     virtual size_t send(
00215         const buffs_type &buffs,
00216         const size_t nsamps_per_buff,
00217         const tx_metadata_t &metadata,
00218         const double timeout = 0.1
00219     ) = 0;
00220 };
00221 
00222 } //namespace uhd
00223 
00224 #endif /* INCLUDED_UHD_STREAM_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines