Files
qt5-legatus-legacy/Lts/Services/AudioVideoManagement/asset.cpp
T
2026-08-13 18:33:10 +02:00

60 lines
1.1 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Asset
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Fröbel, SLSE, 2017-11-30
*/
#include "asset.h"
#include "mounting_point.h"
#include <InfrastructureManagement/ism.hpp>
#include <QtGlobal>
namespace AudioVideoManagement
{
Asset::Asset(const InfrastructureManagement::InstrumentationAsset &asset)
: m_data(new InfrastructureManagement::InstrumentationAsset(asset))
{
Q_ASSERT(asset.id() > 0);
}
Asset::~Asset() = default;
void Asset::update(const InfrastructureManagement::InstrumentationAsset &data)
{
if (*m_data == data)
return;
*m_data = data;
emit changed(this);
}
MountingPoint *Asset::mountingPoint() const
{
Q_ASSERT(isMounted());
return m_mountingPoint;
}
void Asset::mount(MountingPoint *mountingPoint)
{
Q_ASSERT(!m_mountingPoint);
Q_ASSERT(mountingPoint);
m_mountingPoint = mountingPoint;
if (m_mountingPoint)
m_mountingPoint->mount2(this);
}
void Asset::unmount()
{
Q_ASSERT(m_mountingPoint);
if (m_mountingPoint)
m_mountingPoint->unmount2(this);
m_mountingPoint = nullptr;
}
} // namespace AudioVideoManagement