From 5a79a708a1a7a17a7908a651d3f1f759e064b609 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 11 Apr 2014 22:13:41 +0200 Subject: [PATCH] Soem advances in the flowgraph --- src/core/receiver/gnss_flowgraph.cc | 39 +++++++++++++++++------------ src/core/receiver/gnss_flowgraph.h | 4 ++- src/utils/front-end-cal/main.cc | 6 ++--- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index ea4a3e058..26f5d6023 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -130,10 +130,7 @@ void GNSSFlowgraph::connect() try { - std::cout << "helllllo" << std::endl; - //signal_source()->connect(top_block_); - blocks_->at(0)->connect(top_block_); - std::cout << "helllllo" << std::endl; + signal_source()->connect(top_block_); } catch (std::exception& e) { @@ -200,6 +197,7 @@ void GNSSFlowgraph::connect() try { output_filter()->connect(top_block_); + std::cout << "helllllout" << std::endl; } catch (std::exception& e) { @@ -213,7 +211,7 @@ void GNSSFlowgraph::connect() // Signal Source > Signal conditioner > - + std::cout<< *signal_source()->implementation().c_str() <implementation().compare("Raw_Array_Signal_Source") == 0) @@ -229,7 +227,7 @@ void GNSSFlowgraph::connect() else { //single channel - // std::cout<<"NORMAL MODE"<connect(signal_source()->get_right_block(), 0, signal_conditioner()->get_left_block(), 0); } @@ -449,8 +447,10 @@ std::shared_ptr GNSSFlowgraph::signal_source() //std::shared_ptr cond_ { blocks_->at(0) }; //return cond_; //return blocks_->at(0); - std::shared_ptr source_ = std::move(blocks_->at(0)); - return source_; + //std::shared_ptr source_ = std::make_shared>(); + auto source_ = std::move(blocks_->at(0)); + //std::cout << source_->implementation().c_str() << std::endl; + return std::move(source_); } @@ -458,7 +458,10 @@ std::shared_ptr GNSSFlowgraph::signal_source() std::shared_ptr GNSSFlowgraph::signal_conditioner() { - return blocks_->at(1); + //return blocks_->at(1); + auto cond_ = std::move(blocks_->at(1)); + //std::cout << source_->implementation().c_str() << std::endl; + return std::move(cond_); } @@ -468,7 +471,7 @@ std::shared_ptr GNSSFlowgraph::channel(unsigned int index) //return (ChannelInterface*) blocks_->at(index + 5); //std::shared_ptr sptr = std::make_shared(blocks_->at(index + 5)); //return blocks_->at(index + 5); - std::shared_ptr chan_ = blocks_->at(index + 5); + auto chan_ = std::move(blocks_->at(index + 5)); std::shared_ptr chan = std::dynamic_pointer_cast(chan_); @@ -480,21 +483,24 @@ std::shared_ptr GNSSFlowgraph::channel(unsigned int index) std::shared_ptr GNSSFlowgraph::observables() { - return blocks_->at(2); + auto obs_ = std::move(blocks_->at(2)); + return std::move(obs_); } std::shared_ptr GNSSFlowgraph::pvt() { - return blocks_->at(3); + auto pvt_ = std::move(blocks_->at(3)); + return std::move(pvt_); } std::shared_ptr GNSSFlowgraph::output_filter() { - return blocks_->at(4); + auto output_ = std::move(blocks_->at(4)); + return std::move(output_); } @@ -505,15 +511,16 @@ void GNSSFlowgraph::init() * Instantiates the receiver blocks */ std::shared_ptr block_factory_ = std::make_shared(); - std::shared_ptr>> blocks_ = std::make_shared>>(); + //std::shared_ptr>> blocks_ = std::make_shared>>(); + + std::shared_ptr signal_source_ = block_factory_->GetSignalSource(configuration_, queue_); - std::unique_ptr signal_source_ = block_factory_->GetSignalSource(configuration_, queue_); std::shared_ptr cond_ = block_factory_->GetSignalConditioner(configuration_, queue_); std::shared_ptr obs_ = block_factory_->GetObservables(configuration_, queue_); std::shared_ptr pvt_ = block_factory_->GetPVT(configuration_, queue_); std::shared_ptr output_ = block_factory_->GetOutputFilter(configuration_, queue_); - blocks_->push_back(std::move(signal_source_)); + blocks_->push_back(signal_source_); blocks_->push_back(cond_); blocks_->push_back(obs_); blocks_->push_back(pvt_); diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index ff793df26..fe788db97 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -132,7 +132,9 @@ private: std::string config_file_; std::shared_ptr configuration_; std::shared_ptr block_factory_; - std::shared_ptr>> blocks_; + //std::shared_ptr>> blocks_; + std::shared_ptr>> blocks_ = std::make_shared>>(); + //std::shared_ptr>> channels_; gr::top_block_sptr top_block_; boost::shared_ptr queue_; diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index ec67dac00..ce4a64149 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -155,10 +155,10 @@ bool front_end_capture(std::shared_ptr configuration) queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - GNSSBlockInterface *source; + std::shared_ptr source; source = block_factory.GetSignalSource(configuration, queue); - GNSSBlockInterface *conditioner = block_factory.GetSignalConditioner(configuration,queue); + std::shared_ptr conditioner = block_factory.GetSignalConditioner(configuration,queue); gr::block_sptr sink; sink = gr::blocks::file_sink::make(sizeof(gr_complex), "tmp_capture.dat"); @@ -192,7 +192,7 @@ bool front_end_capture(std::shared_ptr configuration) } //delete conditioner; - delete source; + //delete source; return true; }