39 lines
749 B
C++
Executable File
39 lines
749 B
C++
Executable File
/**
|
|
* Handler to publish (project) static data to dds
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Christian Ehrlicher, SLSE, 2017-07-20
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "dds_handler.h"
|
|
#include "pdm_db.h"
|
|
#include "logger.h"
|
|
|
|
namespace ProjectDataManagement
|
|
{
|
|
|
|
template <typename DB>
|
|
bool publishData(const std::shared_ptr<DatabaseInterface> &db,
|
|
const std::shared_ptr<ProjectDataManagement::Interface::Dts> &dts,
|
|
NGL::INGLLogger &logger)
|
|
{
|
|
const auto cb = [dts](const DB & data)
|
|
{
|
|
dts->publish(convert(data));
|
|
};
|
|
|
|
// read from db
|
|
if (!db->select(cb))
|
|
{
|
|
ERROR_LOG(logger) << "Error reading data from database!";
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
} // namespace ProjectDataManagement
|