Files
DRAMSys/extensions/apps/traceAnalyzer/businessObjects/dramTimeDependencies/common/timedependency.h
2025-10-10 10:21:04 +02:00

61 lines
1.5 KiB
C++

/*
* Copyright (c) 2025 Fraunhofer IESE. All rights reserved.
*
* Authors:
* Iron Prando da Silva
*/
#pragma once
#include "StringMapper.h"
#include <QString>
#include <memory>
class DBPhaseEntryBase;
#define PASSFUNCTIONDECL \
([[maybe_unused]] const std::shared_ptr<DBPhaseEntryBase> thisPhase, \
[[maybe_unused]] const std::shared_ptr<DBPhaseEntryBase> otherPhase)
struct PassFunction
{
using Fn = std::function<
bool(const std::shared_ptr<DBPhaseEntryBase>&,
const std::shared_ptr<DBPhaseEntryBase>&)>;
explicit PassFunction(Fn passFunction) : mPassFn{std::move(passFunction)} {}
bool execute PASSFUNCTIONDECL
{
return mPassFn(thisPhase, otherPhase);
}
Fn mPassFn;
};
class TimeDependency
{
public:
TimeDependency() = default;
TimeDependency(size_t timeValue,
QString phaseDep,
DependencyType depType,
QString timeDepName,
std::shared_ptr<PassFunction> pass = nullptr) :
timeValue{timeValue},
phaseDep{phaseDep},
depType{depType},
timeDepName{timeDepName},
passFunction{pass}
{
}
size_t timeValue;
StringMapper phaseDep;
DependencyType depType;
QString timeDepName;
std::shared_ptr<PassFunction> passFunction;
bool isPool() { return phaseDep.isPool(); }
};