1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-26 15:03:14 +00:00

Soem advances in the flowgraph

This commit is contained in:
Carles Fernandez 2014-04-11 22:13:41 +02:00
parent bb6da5f7b0
commit 5a79a708a1
3 changed files with 29 additions and 20 deletions

View File

@ -130,10 +130,7 @@ void GNSSFlowgraph::connect()
try try
{ {
std::cout << "helllllo" << std::endl; signal_source()->connect(top_block_);
//signal_source()->connect(top_block_);
blocks_->at(0)->connect(top_block_);
std::cout << "helllllo" << std::endl;
} }
catch (std::exception& e) catch (std::exception& e)
{ {
@ -200,6 +197,7 @@ void GNSSFlowgraph::connect()
try try
{ {
output_filter()->connect(top_block_); output_filter()->connect(top_block_);
std::cout << "helllllout" << std::endl;
} }
catch (std::exception& e) catch (std::exception& e)
{ {
@ -213,7 +211,7 @@ void GNSSFlowgraph::connect()
// Signal Source > Signal conditioner > // Signal Source > Signal conditioner >
std::cout<< *signal_source()->implementation().c_str() <<std::endl;
try try
{ {
if(signal_source()->implementation().compare("Raw_Array_Signal_Source") == 0) if(signal_source()->implementation().compare("Raw_Array_Signal_Source") == 0)
@ -229,7 +227,7 @@ void GNSSFlowgraph::connect()
else else
{ {
//single channel //single channel
// std::cout<<"NORMAL MODE"<<std::endl; //std::cout<<"NORMAL MODE"<<std::endl;
top_block_->connect(signal_source()->get_right_block(), 0, signal_conditioner()->get_left_block(), 0); top_block_->connect(signal_source()->get_right_block(), 0, signal_conditioner()->get_left_block(), 0);
} }
@ -449,8 +447,10 @@ std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::signal_source()
//std::shared_ptr<GNSSBlockInterface> cond_ { blocks_->at(0) }; //std::shared_ptr<GNSSBlockInterface> cond_ { blocks_->at(0) };
//return cond_; //return cond_;
//return blocks_->at(0); //return blocks_->at(0);
std::shared_ptr<GNSSBlockInterface> source_ = std::move(blocks_->at(0)); //std::shared_ptr<GNSSBlockInterface> source_ = std::make_shared<std::shared_ptr<GNSSBlockInterface>>();
return source_; 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<GNSSBlockInterface> GNSSFlowgraph::signal_source()
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::signal_conditioner() std::shared_ptr<GNSSBlockInterface> 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<ChannelInterface> GNSSFlowgraph::channel(unsigned int index)
//return (ChannelInterface*) blocks_->at(index + 5); //return (ChannelInterface*) blocks_->at(index + 5);
//std::shared_ptr<ChannelInterface> sptr = std::make_shared<GNSSBlockInterface>(blocks_->at(index + 5)); //std::shared_ptr<ChannelInterface> sptr = std::make_shared<GNSSBlockInterface>(blocks_->at(index + 5));
//return blocks_->at(index + 5); //return blocks_->at(index + 5);
std::shared_ptr<GNSSBlockInterface> chan_ = blocks_->at(index + 5); auto chan_ = std::move(blocks_->at(index + 5));
std::shared_ptr<ChannelInterface> chan = std::dynamic_pointer_cast<ChannelInterface>(chan_); std::shared_ptr<ChannelInterface> chan = std::dynamic_pointer_cast<ChannelInterface>(chan_);
@ -480,21 +483,24 @@ std::shared_ptr<ChannelInterface> GNSSFlowgraph::channel(unsigned int index)
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::observables() std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::observables()
{ {
return blocks_->at(2); auto obs_ = std::move(blocks_->at(2));
return std::move(obs_);
} }
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::pvt() std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::pvt()
{ {
return blocks_->at(3); auto pvt_ = std::move(blocks_->at(3));
return std::move(pvt_);
} }
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::output_filter() std::shared_ptr<GNSSBlockInterface> 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 * Instantiates the receiver blocks
*/ */
std::shared_ptr<GNSSBlockFactory> block_factory_ = std::make_shared<GNSSBlockFactory>(); std::shared_ptr<GNSSBlockFactory> block_factory_ = std::make_shared<GNSSBlockFactory>();
std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_ = std::make_shared<std::vector<std::shared_ptr<GNSSBlockInterface>>>(); //std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_ = std::make_shared<std::vector<std::shared_ptr<GNSSBlockInterface>>>();
std::shared_ptr<GNSSBlockInterface> signal_source_ = block_factory_->GetSignalSource(configuration_, queue_);
std::unique_ptr<GNSSBlockInterface> signal_source_ = block_factory_->GetSignalSource(configuration_, queue_);
std::shared_ptr<GNSSBlockInterface> cond_ = block_factory_->GetSignalConditioner(configuration_, queue_); std::shared_ptr<GNSSBlockInterface> cond_ = block_factory_->GetSignalConditioner(configuration_, queue_);
std::shared_ptr<GNSSBlockInterface> obs_ = block_factory_->GetObservables(configuration_, queue_); std::shared_ptr<GNSSBlockInterface> obs_ = block_factory_->GetObservables(configuration_, queue_);
std::shared_ptr<GNSSBlockInterface> pvt_ = block_factory_->GetPVT(configuration_, queue_); std::shared_ptr<GNSSBlockInterface> pvt_ = block_factory_->GetPVT(configuration_, queue_);
std::shared_ptr<GNSSBlockInterface> output_ = block_factory_->GetOutputFilter(configuration_, queue_); std::shared_ptr<GNSSBlockInterface> 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(cond_);
blocks_->push_back(obs_); blocks_->push_back(obs_);
blocks_->push_back(pvt_); blocks_->push_back(pvt_);

View File

@ -132,7 +132,9 @@ private:
std::string config_file_; std::string config_file_;
std::shared_ptr<ConfigurationInterface> configuration_; std::shared_ptr<ConfigurationInterface> configuration_;
std::shared_ptr<GNSSBlockFactory> block_factory_; std::shared_ptr<GNSSBlockFactory> block_factory_;
std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_; //std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_;
std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_ = std::make_shared<std::vector<std::shared_ptr<GNSSBlockInterface>>>();
//std::shared_ptr<std::vector<std::shared_ptr<ChannelInterface>>> channels_; //std::shared_ptr<std::vector<std::shared_ptr<ChannelInterface>>> channels_;
gr::top_block_sptr top_block_; gr::top_block_sptr top_block_;
boost::shared_ptr<gr::msg_queue> queue_; boost::shared_ptr<gr::msg_queue> queue_;

View File

@ -155,10 +155,10 @@ bool front_end_capture(std::shared_ptr<ConfigurationInterface> configuration)
queue = gr::msg_queue::make(0); queue = gr::msg_queue::make(0);
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
GNSSBlockInterface *source; std::shared_ptr<GNSSBlockInterface> source;
source = block_factory.GetSignalSource(configuration, queue); source = block_factory.GetSignalSource(configuration, queue);
GNSSBlockInterface *conditioner = block_factory.GetSignalConditioner(configuration,queue); std::shared_ptr<GNSSBlockInterface> conditioner = block_factory.GetSignalConditioner(configuration,queue);
gr::block_sptr sink; gr::block_sptr sink;
sink = gr::blocks::file_sink::make(sizeof(gr_complex), "tmp_capture.dat"); sink = gr::blocks::file_sink::make(sizeof(gr_complex), "tmp_capture.dat");
@ -192,7 +192,7 @@ bool front_end_capture(std::shared_ptr<ConfigurationInterface> configuration)
} }
//delete conditioner; //delete conditioner;
delete source; //delete source;
return true; return true;
} }