83 lines
2.1 KiB
C++
Executable File
83 lines
2.1 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* ProxyBuilding to handle access to HandlerBuildingModelInterface
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Norbert Thoden, ESVG, 2024-09-09
|
|
*/
|
|
|
|
#include "proxy_building.h"
|
|
|
|
|
|
|
|
|
|
namespace CentralEffectSimulation
|
|
{
|
|
|
|
#define LOG_ERROR_NO_HNDL_BLDG_MDL ERROR_LOG(m_logger) << LOGFUNCTION << " no handlerBuildingModel"
|
|
#define CHECK_HNDL_BLDG_MDL_RETVAL if (!(isSet_handlerBuildingModel())) { LOG_ERROR_NO_HNDL_BLDG_MDL; return {}; }
|
|
|
|
|
|
class ProxyBuilding::Private
|
|
{
|
|
public:
|
|
Private()
|
|
{}
|
|
|
|
~Private()
|
|
{}
|
|
|
|
std::weak_ptr<CesBuildings::HandlerBuildingModelInterface> m_handlerBuildingModel_wPtr;
|
|
|
|
}; // class ProxyBuilding::Private
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
ProxyBuilding::ProxyBuilding(QObject *parent)
|
|
: BaseClass(parent)
|
|
, d(new Private)
|
|
, m_logger(CentralEffectSimulation::getLogger("ProxyBuilding"))
|
|
{
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
|
}
|
|
//-----------------------------------------------------------------------------
|
|
|
|
ProxyBuilding::~ProxyBuilding()
|
|
{
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
|
delete d;
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
|
}
|
|
|
|
void ProxyBuilding::set_handlerBuildingModel(std::shared_ptr<CesBuildings::HandlerBuildingModelInterface> handlerBuildingModel)
|
|
{
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
|
INFO_LOG(m_logger) << LOGFUNCTION << " set handlerBuildingModel to: " << handlerBuildingModel;
|
|
d->m_handlerBuildingModel_wPtr = handlerBuildingModel;
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
|
}
|
|
|
|
void ProxyBuilding::clear_handlerBuildingModel()
|
|
{
|
|
d->m_handlerBuildingModel_wPtr.reset();
|
|
}
|
|
|
|
bool ProxyBuilding::isSet_handlerBuildingModel() const
|
|
{
|
|
auto sp = d->m_handlerBuildingModel_wPtr.lock();
|
|
return sp.get(); // return sp; no viable conversion
|
|
}
|
|
|
|
std::shared_ptr<CesBuildings::HandlerBuildingModelInterface> ProxyBuilding::handlerBuildingModelInterface()
|
|
{
|
|
auto sp = d->m_handlerBuildingModel_wPtr.lock();
|
|
return sp;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
}
|
|
|