1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-10 20:10:05 +00:00

Make private member metadata_ a std::shared_pointer

This commit is contained in:
Carles Fernandez 2024-08-22 14:49:33 +02:00
parent 8702f9dfc7
commit d7885036b6
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 7 additions and 4 deletions

View File

@ -20,6 +20,7 @@
#include "gnss_sdr_valve.h"
#include <gnuradio/blocks/copy.h>
#include <cstdlib>
#include <iostream>
#include <unordered_set>
#if USE_GLOG_AND_GFLAGS
@ -92,10 +93,11 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura
void IONGSMSSignalSource::load_metadata()
{
metadata_ = std::make_shared<GnssMetadata::Metadata>();
try
{
GnssMetadata::XmlProcessor xml_proc;
if (!xml_proc.Load(metadata_filepath_.c_str(), false, metadata_))
if (!xml_proc.Load(metadata_filepath_.c_str(), false, *metadata_))
{
LOG(WARNING) << "Could not load XML metadata file " << metadata_filepath_;
std::cerr << "Could not load XML metadata file " << metadata_filepath_ << std::endl;
@ -123,9 +125,9 @@ void IONGSMSSignalSource::load_metadata()
std::vector<IONGSMSFileSource::sptr> IONGSMSSignalSource::make_stream_sources(const std::vector<std::string>& stream_ids) const
{
std::vector<IONGSMSFileSource::sptr> sources{};
for (const auto& file : metadata_.Files())
for (const auto& file : metadata_->Files())
{
for (const auto& lane : metadata_.Lanes())
for (const auto& lane : metadata_->Lanes())
{
if (lane.Id() == file.Lane().Id())
{

View File

@ -24,6 +24,7 @@
#include "ion_gsms.h"
#include <GnssMetadata.h>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
@ -69,7 +70,7 @@ private:
std::vector<gnss_shared_ptr<gr::block>> valves_;
std::string metadata_filepath_;
GnssMetadata::Metadata metadata_;
std::shared_ptr<GnssMetadata::Metadata> metadata_;
gnss_shared_ptr<Gnss_Sdr_Timestamp> timestamp_block_;
std::string timestamp_file_;