Render placefile Place statement

This commit is contained in:
Dan Paulat 2023-07-20 23:38:43 -05:00
parent 1c39464228
commit 9f5de14f6b
5 changed files with 148 additions and 29 deletions

View file

@ -61,6 +61,24 @@ public:
PlacefileManager::PlacefileManager() : p(std::make_unique<Impl>(this)) {}
PlacefileManager::~PlacefileManager() = default;
std::vector<std::shared_ptr<gr::Placefile>>
PlacefileManager::GetActivePlacefiles()
{
std::vector<std::shared_ptr<gr::Placefile>> placefiles;
std::shared_lock lock {p->placefileRecordLock_};
for (const auto& record : p->placefileRecords_)
{
if (record->enabled_)
{
placefiles.emplace_back(record->placefile_);
}
}
return placefiles;
}
void PlacefileManager::LoadFile(const std::string& filename)
{
logger_->debug("LoadFile: {}", filename);

View file

@ -1,7 +1,6 @@
#pragma once
#include <memory>
#include <string>
#include <scwx/gr/placefile.hpp>
#include <QObject>
@ -20,6 +19,13 @@ public:
explicit PlacefileManager();
~PlacefileManager();
/**
* @brief Gets a list of active placefiles
*
* @return Vector of placefile pointers
*/
std::vector<std::shared_ptr<gr::Placefile>> GetActivePlacefiles();
void LoadFile(const std::string& filename);
static std::shared_ptr<PlacefileManager> Instance();