mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
Replacing some raw pointers by smart pointers
This commit is contained in:
parent
6e20c9f8c6
commit
15dd3f98bf
@ -66,18 +66,15 @@ protected:
|
|||||||
{
|
{
|
||||||
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");
|
||||||
factory = new GNSSBlockFactory();
|
factory = std::make_shared<GNSSBlockFactory>();
|
||||||
config = new InMemoryConfiguration();
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
item_size = sizeof(gr_complex);
|
item_size = sizeof(gr_complex);
|
||||||
stop = false;
|
stop = false;
|
||||||
message = 0;
|
message = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
~GalileoE1PcpsAmbiguousAcquisitionGSoCTest()
|
~GalileoE1PcpsAmbiguousAcquisitionGSoCTest()
|
||||||
{
|
{}
|
||||||
delete factory;
|
|
||||||
delete config;
|
|
||||||
}
|
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void start_queue();
|
void start_queue();
|
||||||
@ -86,8 +83,8 @@ protected:
|
|||||||
|
|
||||||
gr::msg_queue::sptr queue;
|
gr::msg_queue::sptr queue;
|
||||||
gr::top_block_sptr top_block;
|
gr::top_block_sptr top_block;
|
||||||
GNSSBlockFactory* factory;
|
std::shared_ptr<GNSSBlockFactory> factory;
|
||||||
InMemoryConfiguration* config;
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
Gnss_Synchro gnss_synchro;
|
Gnss_Synchro gnss_synchro;
|
||||||
size_t item_size;
|
size_t item_size;
|
||||||
concurrent_queue<int> channel_internal_queue;
|
concurrent_queue<int> channel_internal_queue;
|
||||||
@ -98,7 +95,6 @@ protected:
|
|||||||
|
|
||||||
void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::init()
|
void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
gnss_synchro.Channel_ID = 0;
|
gnss_synchro.Channel_ID = 0;
|
||||||
gnss_synchro.System = 'E';
|
gnss_synchro.System = 'E';
|
||||||
std::string signal = "1C";
|
std::string signal = "1C";
|
||||||
@ -150,14 +146,10 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::stop_queue()
|
|||||||
|
|
||||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate)
|
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate)
|
||||||
{
|
{
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1, queue);
|
||||||
GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue);
|
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||||
EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str());
|
EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str());
|
||||||
|
|
||||||
delete acquisition;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
|
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
|
||||||
@ -169,7 +161,8 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
|
|||||||
long long int end = 0;
|
long long int end = 0;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1, queue);
|
||||||
|
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
@ -186,8 +179,6 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
|
|||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
end = tv.tv_sec*1000000 + tv.tv_usec;
|
end = tv.tv_sec*1000000 + tv.tv_usec;
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block."<< std::endl;
|
||||||
|
|
||||||
delete acquisition;
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -199,7 +190,8 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
|
|||||||
long long int end = 0;
|
long long int end = 0;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
std::unique_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition(new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue));
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1, queue);
|
||||||
|
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||||
|
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
@ -219,13 +211,11 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
|
|||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold." << std::endl;
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max",
|
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
||||||
10000));
|
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max." << std::endl;
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step",
|
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
||||||
500));
|
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step." << std::endl;
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
|
Loading…
Reference in New Issue
Block a user