Skip to content

Commit

Permalink
Fix code scanning and clang-tidy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Capital-Asterisk committed Aug 30, 2024
1 parent 26c9570 commit 29cae46
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 46 deletions.
35 changes: 18 additions & 17 deletions src/adera_app/features/vehicles_machines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,24 +204,25 @@ FeatureDef const ftrMagicRocketThrustIndicator = feature_def("MagicRocketThrustI
ActiveEnt const partEnt = rScnParts.partToActive[part];

for (MachinePair const pair : rScnParts.partToMachines[part])
if (pair.type == gc_mtMagicRocket)
{
DrawEnt const drawEnt = rThrustIndicator.rktToDrawEnt[pair.local];
MachAnyId const anyId = rockets.localToAny[pair.local];

auto const& portSpan = floats.machToNode[anyId];
NodeId const throttleIn = connected_node(portSpan, ports_magicrocket::gc_throttleIn.port);
NodeId const multiplierIn = connected_node(portSpan, ports_magicrocket::gc_multiplierIn.port);

float const throttle = std::clamp(rSigValFloat[throttleIn], 0.0f, 1.0f);
float const multiplier = rSigValFloat[multiplierIn];
float const thrustMag = throttle * multiplier;

rCtxScnRdr.m_drawTransform[drawEnt]
= drawTf
* Matrix4::scaling({1.0f, 1.0f, thrustMag * rThrustIndicator.indicatorScale})
* Matrix4::translation({0.0f, 0.0f, -1.0f})
* Matrix4::scaling({0.2f, 0.2f, 1.0f});
if (pair.type == gc_mtMagicRocket)
{
DrawEnt const drawEnt = rThrustIndicator.rktToDrawEnt[pair.local];
MachAnyId const anyId = rockets.localToAny[pair.local];

auto const& portSpan = floats.machToNode[anyId];
NodeId const throttleIn = connected_node(portSpan, ports_magicrocket::gc_throttleIn.port);
NodeId const multiplierIn = connected_node(portSpan, ports_magicrocket::gc_multiplierIn.port);

float const throttle = std::clamp(rSigValFloat[throttleIn], 0.0f, 1.0f);
float const multiplier = rSigValFloat[multiplierIn];
float const thrustMag = throttle * multiplier;

rCtxScnRdr.m_drawTransform[drawEnt]
= drawTf
* Matrix4::scaling({1.0f, 1.0f, thrustMag * rThrustIndicator.indicatorScale})
* Matrix4::translation({0.0f, 0.0f, -1.0f})
* Matrix4::scaling({0.2f, 0.2f, 1.0f}); }
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/osp/framework/builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void ContextBuilder::add_feature(FeatureDef const &def, entt::any setupData) noe
else
{
// Not found, ERROR!
m_errors.push_back(ErrDependencyNotFound{
m_errors.emplace_back(ErrDependencyNotFound{
.whileAdding = def.name,
.requiredFI = subjectInfo.name
});
Expand All @@ -78,7 +78,7 @@ void ContextBuilder::add_feature(FeatureDef const &def, entt::any setupData) noe
if (rFInter.has_value())
{
// Already exists, error
m_errors.push_back(ErrAlreadyImplemented{
m_errors.emplace_back(ErrAlreadyImplemented{
.whileAdding = def.name,
.alreadyImplFI = subjectInfo.name
});
Expand Down
26 changes: 13 additions & 13 deletions src/osp/framework/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,46 +34,46 @@ namespace osp::fw
{


void SingleThreadedExecutor::load(Framework& rFramework)
void SingleThreadedExecutor::load(Framework& rFW)
{
m_graph = osp::make_exec_graph(rFramework.m_tasks);
m_graph = osp::make_exec_graph(rFW.m_tasks);
m_execContext = {};
exec_conform(rFramework.m_tasks, m_execContext);
exec_conform(rFW.m_tasks, m_execContext);
m_execContext.doLogging = m_log != nullptr;
}

void SingleThreadedExecutor::run(Framework& rAppTasks, PipelineId pipeline)
void SingleThreadedExecutor::run(Framework& rFW, PipelineId pipeline)
{
exec_request_run(m_execContext, pipeline);
}

void SingleThreadedExecutor::signal(Framework& rAppTasks, PipelineId pipeline)
void SingleThreadedExecutor::signal(Framework& rFW, PipelineId pipeline)
{
exec_signal(m_execContext, pipeline);
}

void SingleThreadedExecutor::wait(Framework& rAppTasks)
void SingleThreadedExecutor::wait(Framework& rFW)
{
if (m_log != nullptr)
{
m_log->info("\n>>>>>>>>>> Previous State Changes\n{}\n>>>>>>>>>> Current State\n{}\n",
WriteLog {rAppTasks.m_tasks, rAppTasks.m_taskImpl, m_graph, m_execContext},
WriteState{rAppTasks.m_tasks, rAppTasks.m_taskImpl, m_graph, m_execContext} );
WriteLog {rFW.m_tasks, rFW.m_taskImpl, m_graph, m_execContext},
WriteState{rFW.m_tasks, rFW.m_taskImpl, m_graph, m_execContext} );
m_execContext.logMsg.clear();
}

exec_update(rAppTasks.m_tasks, m_graph, m_execContext);
run_blocking(rAppTasks.m_tasks, m_graph, rAppTasks.m_taskImpl, rAppTasks.m_data, m_execContext);
exec_update(rFW.m_tasks, m_graph, m_execContext);
run_blocking(rFW.m_tasks, m_graph, rFW.m_taskImpl, rFW.m_data, m_execContext);

if (m_log != nullptr)
{
m_log->info("\n>>>>>>>>>> New State Changes\n{}",
WriteLog{rAppTasks.m_tasks, rAppTasks.m_taskImpl, m_graph, m_execContext} );
WriteLog{rFW.m_tasks, rFW.m_taskImpl, m_graph, m_execContext} );
m_execContext.logMsg.clear();
}
}

bool SingleThreadedExecutor::is_running(Framework const& appTasks)
bool SingleThreadedExecutor::is_running(Framework const& rFW)
{
return m_execContext.hasRequestRun || (m_execContext.pipelinesRunning != 0);
}
Expand All @@ -89,7 +89,7 @@ void SingleThreadedExecutor::run_blocking(
{
std::vector<entt::any> argumentRefs;

while (rExec.tasksQueuedRun.size() != 0)
while ( ! rExec.tasksQueuedRun.empty() )
{
TaskId const willRunId = rExec.tasksQueuedRun[0];
TaskImpl &rWillRunImpl = rTaskImpl[willRunId];
Expand Down
10 changes: 5 additions & 5 deletions src/osp/framework/executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ class SingleThreadedExecutor final : public IExecutor
friend std::ostream& operator<<(std::ostream& rStream, WriteLog const& write);
};

void load(Framework& rAppTasks) override;
void load(Framework& rFW) override;

void run(Framework& rAppTasks, PipelineId pipeline) override;
void run(Framework& rFW, PipelineId pipeline) override;

void signal(Framework& rAppTasks, PipelineId pipeline) override;
void signal(Framework& rFW, PipelineId pipeline) override;

void wait(Framework& rAppTasks) override;
void wait(Framework& rFW) override;

bool is_running(Framework const& rAppTasks) override;
bool is_running(Framework const& rFW) override;

std::shared_ptr<spdlog::logger> m_log;

Expand Down
12 changes: 6 additions & 6 deletions src/osp/framework/framework.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ concept CFeatureInterfaceDef = requires{ typename T::DataIds; typename T::Pipeli
struct FITypeInfo
{
std::string name;
std::size_t dataCount;
std::size_t dataCount{};
std::vector<PipelineDefInfo> pipelines;
};

Expand Down Expand Up @@ -396,15 +396,15 @@ class IExecutor
{
public:

virtual void load(Framework& rAppTasks) = 0;
virtual void load(Framework &rFW) = 0;

virtual void run(Framework& rAppTasks, osp::PipelineId pipeline) = 0;
virtual void run(Framework &rFW, osp::PipelineId pipeline) = 0;

virtual void signal(Framework& rAppTasks, osp::PipelineId pipeline) = 0;
virtual void signal(Framework &rFW, osp::PipelineId pipeline) = 0;

virtual void wait(Framework& rAppTasks) = 0;
virtual void wait(Framework &rFW) = 0;

virtual bool is_running(Framework const& rAppTasks) = 0;
virtual bool is_running(Framework const &rFW) = 0;
};


Expand Down
2 changes: 1 addition & 1 deletion src/testapp/features/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class NonBlockingCinReader
};


FeatureDef const ftrREPL = feature_def("REPL", [] (FeatureBuilder &rFB, Implement<FICinREPL> cinREPL, DependOn<FIMainApp> mainApp, entt::any)
FeatureDef const ftrREPL = feature_def("REPL", [] (FeatureBuilder &rFB, Implement<FICinREPL> cinREPL, DependOn<FIMainApp> mainApp)
{
rFB.data_emplace< std::vector<std::string> >(cinREPL.di.cinLines);
rFB.pipeline(cinREPL.pl.cinLines).parent(mainApp.pl.mainLoop);
Expand Down
2 changes: 0 additions & 2 deletions src/testapp/scenarios_magnum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ void start_magnum_renderer(Framework &rFW, ContextId ctx, entt::any userData)
rAppCtxs.window = windowCtx;
rAppCtxs.sceneRender = sceneRenderCtx;

bool const success = ContextBuilder::finalize(std::move(windowCB));

auto const magnum = rFW.get_interface<FIMagnum> (windowCtx);
auto &rMagnumApp = rFW.data_get<MagnumWindowApp> (magnum.di.magnumApp);
rMagnumApp.m_events = std::make_unique<CommonMagnumApp>(rTestApp);
Expand Down

0 comments on commit 29cae46

Please sign in to comment.