From f9be69cae7c0fd9bca8b310ff79dd6aad958dc2b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 30 Mar 2010 14:07:19 -0700 Subject: Added io type and otw type for describing types. --- host/lib/types.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'host/lib/types.cpp') diff --git a/host/lib/types.cpp b/host/lib/types.cpp index 3fde40596..bf9f8b895 100644 --- a/host/lib/types.cpp +++ b/host/lib/types.cpp @@ -23,10 +23,14 @@ #include #include #include +#include +#include #include #include #include +#include #include +#include using namespace uhd; @@ -210,3 +214,34 @@ std::string mac_addr_t::to_string(void) const{ % int(to_bytes()[3]) % int(to_bytes()[4]) % int(to_bytes()[5]) ); } + +/*********************************************************************** + * otw type + **********************************************************************/ +otw_type_t::otw_type_t(void){ + width = 0; + shift = 0; + byteorder = BO_NATIVE; +} + +/*********************************************************************** + * io type + **********************************************************************/ +static size_t tid_to_size(io_type_t::tid_t tid){ + switch(tid){ + case io_type_t::COMPLEX_FLOAT32: return sizeof(std::complex); + case io_type_t::COMPLEX_INT16: return sizeof(std::complex); + case io_type_t::COMPLEX_INT8: return sizeof(std::complex); + default: throw std::runtime_error("unknown io type tid"); + } +} + +io_type_t::io_type_t(tid_t tid) +: size(tid_to_size(tid)), tid(tid){ + /* NOP */ +} + +io_type_t::io_type_t(size_t size) +: size(size), tid(CUSTOM_TYPE){ + /* NOP */ +} -- cgit v1.2.3