Rename Nz::Functor to Nz::AbstractFunctor

This commit is contained in:
SirLynix
2023-11-17 13:19:21 +01:00
parent da49b39465
commit f2e77fb8a5
8 changed files with 30 additions and 30 deletions

View File

@@ -13,15 +13,15 @@
namespace Nz
{
struct Functor
struct AbstractFunctor
{
virtual ~Functor() {}
virtual ~AbstractFunctor() {}
virtual void Run() = 0;
};
template<typename F>
struct FunctorWithoutArgs : Functor
struct FunctorWithoutArgs : AbstractFunctor
{
FunctorWithoutArgs(F func);
@@ -32,7 +32,7 @@ namespace Nz
};
template<typename F, typename... Args>
struct FunctorWithArgs : Functor
struct FunctorWithArgs : AbstractFunctor
{
FunctorWithArgs(F func, Args&&... args);
@@ -44,7 +44,7 @@ namespace Nz
};
template<typename C>
struct MemberWithoutArgs : Functor
struct MemberWithoutArgs : AbstractFunctor
{
MemberWithoutArgs(void (C::*func)(), C* object);

View File

@@ -29,7 +29,7 @@ namespace Nz
static void WaitForTasks();
private:
static void AddTaskFunctor(Functor* taskFunctor);
static void AddTaskFunctor(AbstractFunctor* taskFunctor);
};
}

View File

@@ -32,10 +32,10 @@ namespace Nz
template<typename F>
void TransientResources::PushReleaseCallback(F&& callback)
{
using Functor = ReleasableLambda<std::remove_cv_t<std::remove_reference_t<F>>>;
using ReleaseFunctor = ReleasableLambda<std::remove_cv_t<std::remove_reference_t<F>>>;
constexpr std::size_t functorSize = sizeof(Functor);
constexpr std::size_t functorAlignment = alignof(Functor);
constexpr std::size_t functorSize = sizeof(ReleaseFunctor);
constexpr std::size_t functorAlignment = alignof(ReleaseFunctor);
// Try to minimize lost space
struct
@@ -77,7 +77,7 @@ namespace Nz
Block& targetBlock = *bestBlock.block;
targetBlock.resize(bestBlock.alignedOffset + functorSize);
Functor* releasable = reinterpret_cast<Functor*>(&targetBlock[bestBlock.alignedOffset]);
ReleaseFunctor* releasable = reinterpret_cast<ReleaseFunctor*>(&targetBlock[bestBlock.alignedOffset]);
PlacementNew(releasable, std::forward<F>(callback));
m_releaseQueue.push_back(releasable);