BigFile/Sasquatch #1
@@ -45,34 +45,6 @@ class AssetLibrary
|
||||
return inserted.second;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AssetContainer for a given Asset type
|
||||
*
|
||||
* \tparam ASSET The Asset type
|
||||
* \return The AssetContainer for the Asset type. Nullptr if not found
|
||||
*/
|
||||
template<class ASSET>
|
||||
[[nodiscard]]
|
||||
AssetContainer<ASSET>* GetAssetContainer()
|
||||
{
|
||||
static const AssetTypeID typeID = ASSET::GetTypeID();
|
||||
return static_cast<AssetContainer<ASSET>*>(GetAssetContainer(typeID));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AssetContainer for a given Asset type
|
||||
*
|
||||
* \tparam ASSET The Asset type
|
||||
* \return The AssetContainer for the Asset type. Nullptr if not found
|
||||
*/
|
||||
template<class ASSET>
|
||||
[[nodiscard]]
|
||||
const AssetContainer<ASSET>* GetAssetContainer() const
|
||||
{
|
||||
static const AssetTypeID typeID = ASSET::GetTypeID();
|
||||
return static_cast<const AssetContainer<ASSET>*>(GetAssetContainer(typeID));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AssetContainer for a given AssetType
|
||||
*
|
||||
|
||||
@@ -51,18 +51,12 @@ TEST_F(AssetLibraryFixture, GetAssetContainer_ShouldReturnTheAssetContainerIfAva
|
||||
std::ignore = m_library.Insert(&m_containerB);
|
||||
std::ignore = m_library.Insert(&m_containerC);
|
||||
|
||||
EXPECT_EQ(m_library.GetAssetContainer<AssetA>(), &m_containerA);
|
||||
EXPECT_EQ(m_library.GetAssetContainer(GetAssetTypeID<AssetA>()), &m_containerA);
|
||||
EXPECT_EQ(m_library.GetAssetContainer<AssetB>(), &m_containerB);
|
||||
EXPECT_EQ(m_library.GetAssetContainer(GetAssetTypeID<AssetB>()), &m_containerB);
|
||||
EXPECT_EQ(m_library.GetAssetContainer<AssetC>(), &m_containerC);
|
||||
EXPECT_EQ(m_library.GetAssetContainer(GetAssetTypeID<AssetC>()), &m_containerC);
|
||||
|
||||
EXPECT_EQ(std::as_const(m_library).GetAssetContainer<AssetA>(), &m_containerA);
|
||||
EXPECT_EQ(std::as_const(m_library).GetAssetContainer(GetAssetTypeID<AssetA>()), &m_containerA);
|
||||
EXPECT_EQ(std::as_const(m_library).GetAssetContainer<AssetB>(), &m_containerB);
|
||||
EXPECT_EQ(std::as_const(m_library).GetAssetContainer(GetAssetTypeID<AssetB>()), &m_containerB);
|
||||
EXPECT_EQ(std::as_const(m_library).GetAssetContainer<AssetC>(), &m_containerC);
|
||||
EXPECT_EQ(std::as_const(m_library).GetAssetContainer(GetAssetTypeID<AssetC>()), &m_containerC);
|
||||
}
|
||||
|
||||
@@ -72,10 +66,7 @@ TEST_F(AssetLibraryFixture, GetAssetContainer_ShouldReturnNullptrIfTheContainerD
|
||||
{
|
||||
std::ignore = m_library.Insert(&m_containerB);
|
||||
|
||||
EXPECT_EQ(m_library.GetAssetContainer<AssetA>(), nullptr);
|
||||
EXPECT_EQ(m_library.GetAssetContainer(GetAssetTypeID<AssetA>()), nullptr);
|
||||
|
||||
EXPECT_EQ(std::as_const(m_library).GetAssetContainer<AssetA>(), nullptr);
|
||||
EXPECT_EQ(std::as_const(m_library).GetAssetContainer(GetAssetTypeID<AssetA>()), nullptr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user