diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2013-03-26 20:18:53 -0700 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2013-03-26 20:18:53 -0700 |
commit | 26dceecc80390f10cedb94bd9e4fd655827d7f17 (patch) | |
tree | f88cb2995133048b4a2191bae688fa09b33a19ae /gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.cc | |
parent | 9bbbda510c265b211b5b571db79ba259c67ee049 (diff) |
runtime: migrate remaining gnuradio-core contents into gnuradio-runtime
Diffstat (limited to 'gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.cc')
-rw-r--r-- | gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.cc | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.cc b/gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.cc deleted file mode 100644 index 7c8b6041e9..0000000000 --- a/gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.cc +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <rpcpmtconverters_ice.h> -#include <Ice/Ice.h> -#include <gnuradio.h> - -GNURadio::KnobPtr -rpcpmtconverter::from_pmt(const pmt::pmt_t& knob, const Ice::Current& c) -{ - if(pmt::is_real(knob)) { - return new GNURadio::KnobD(Ice::Double(pmt::to_double(knob))); - } - else if(pmt::is_symbol(knob)) { - std::string stuff = pmt::symbol_to_string(knob); - return new GNURadio::KnobS(stuff); - } - else if(pmt::is_integer(knob)) { - return new GNURadio::KnobI(pmt::to_long(knob)); - } - else if(pmt::is_bool(knob)) { - return new GNURadio::KnobB(pmt::to_bool(knob)); - } - else if(pmt::is_uint64(knob)) { - return new GNURadio::KnobL(pmt::to_uint64(knob)); - //const std::complex<float> *c32vector_elements(pmt_t v, size_t &len); //< len is in elements - } - else if(pmt::is_c32vector(knob)) { // c32 sent as interleaved floats - size_t size(pmt::length(knob)); - const float* start((const float*) pmt::c32vector_elements(knob,size)); - return new GNURadio::KnobVecF(std::vector<float>(start,start+size*2)); - } - else if (pmt::is_s32vector(knob)) { - size_t size(pmt::length(knob)); - const int* start((const int*) pmt::s32vector_elements(knob,size)); - return new GNURadio::KnobVecI(std::vector<int>(start,start+size)); - } - else if(pmt::is_f32vector(knob)) { - size_t size(pmt::length(knob)); - const float* start((const float*) pmt::f32vector_elements(knob,size)); - return new GNURadio::KnobVecF(std::vector<float>(start,start+size)); - } - else if (pmt::is_u8vector(knob)) { - size_t size(pmt::length(knob)); - const uint8_t* start((const uint8_t*) pmt::u8vector_elements(knob,size)); - return new GNURadio::KnobVecC(std::vector<Ice::Byte>(start,start+size)); - } - else { - std::cerr << "Error: Don't know how to handle Knob Type (from): " << std::endl; assert(0);} - //TODO: VECTORS!!! - return new GNURadio::Knob(); -} - -pmt::pmt_t -rpcpmtconverter::to_pmt(const GNURadio::KnobPtr& knob, const Ice::Current& c) -{ - std::string id(knob->ice_id(c).substr(12)); - if(id == "KnobD") { - GNURadio::KnobDPtr k(GNURadio::KnobDPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobF") { - GNURadio::KnobFPtr k(GNURadio::KnobFPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobI") { - GNURadio::KnobIPtr k(GNURadio::KnobIPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobS") { - GNURadio::KnobSPtr k(GNURadio::KnobSPtr::dynamicCast(knob)); - return pmt::string_to_symbol(k->value); - } - else if(id == "KnobB") { - GNURadio::KnobBPtr k(GNURadio::KnobBPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobC") { - GNURadio::KnobCPtr k(GNURadio::KnobCPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobL") { - GNURadio::KnobLPtr k(GNURadio::KnobLPtr::dynamicCast(knob)); - return pmt::mp((long)k->value); - } - else if(id == "KnobVecC") { - GNURadio::KnobVecCPtr k(GNURadio::KnobVecCPtr::dynamicCast(knob)); - return pmt::init_u8vector(k->value.size(), &k->value[0]); - } - else if(id == "KnobVecI") { - GNURadio::KnobVecIPtr k(GNURadio::KnobVecIPtr::dynamicCast(knob)); - return pmt::init_s32vector(k->value.size(), &k->value[0]); - } - //else if(id == "KnobVecF") { - // GNURadio::KnobVecFPtr k(GNURadio::KnobVecFPtr::dynamicCast(knob)); - // return pmt::mp(k->value); - //TODO: FLOAT!!! - //TODO: VECTORS!!! - else { - std::cerr << "Error: Don't know how to handle Knob Type: " << id << std::endl; assert(0); - } - - return pmt::pmt_t(); -} |