Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Common/Core/TableHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

#include "Common/Core/TableHelper.h"

#include <string>

#include "Framework/InitContext.h"
#include "Framework/RunningWorkflowInfo.h"

#include <string>

/// Function to print the table required in the full workflow
/// @param initContext initContext of the init function
void printTablesInWorkflow(o2::framework::InitContext& initContext)
void o2::common::core::printTablesInWorkflow(o2::framework::InitContext& initContext)
{
auto& workflows = initContext.services().get<o2::framework::RunningWorkflowInfo const>();
for (auto const& device : workflows.devices) {
Expand All @@ -37,7 +37,7 @@ void printTablesInWorkflow(o2::framework::InitContext& initContext)
/// Function to check if a table is required in a workflow
/// @param initContext initContext of the init function
/// @param table name of the table to check for
bool isTableRequiredInWorkflow(o2::framework::InitContext& initContext, const std::string& table)
bool o2::common::core::isTableRequiredInWorkflow(o2::framework::InitContext& initContext, const std::string& table)
{
LOG(debug) << "Checking if table " << table << " is needed";
bool tableNeeded = false;
Expand All @@ -57,7 +57,7 @@ bool isTableRequiredInWorkflow(o2::framework::InitContext& initContext, const st
/// @param initContext initContext of the init function
/// @param table name of the table to check for
/// @param flag bool value of flag to set, if the given value is true it will be kept, disregarding the table usage in the workflow.
void enableFlagIfTableRequired(o2::framework::InitContext& initContext, const std::string& table, bool& flag)
void o2::common::core::enableFlagIfTableRequired(o2::framework::InitContext& initContext, const std::string& table, bool& flag)
{
if (flag) {
LOG(info) << "Table enabled: " + table;
Expand All @@ -75,7 +75,7 @@ void enableFlagIfTableRequired(o2::framework::InitContext& initContext, const st
/// @param initContext initContext of the init function
/// @param table name of the table to check for
/// @param flag int value of flag to set, only if initially set to -1. Initial values of 0 or 1 will be kept disregarding the table usage in the workflow.
void enableFlagIfTableRequired(o2::framework::InitContext& initContext, const std::string& table, int& flag)
void o2::common::core::enableFlagIfTableRequired(o2::framework::InitContext& initContext, const std::string& table, int& flag)
{
if (flag > 0) {
flag = 1;
Expand Down
10 changes: 10 additions & 0 deletions Common/Core/TableHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

#include <string>

namespace o2::common::core
{

/// Function to print the table required in the full workflow
/// @param initContext initContext of the init function
void printTablesInWorkflow(o2::framework::InitContext& initContext);
Expand Down Expand Up @@ -76,7 +79,7 @@
}
if (device.name == taskName) { // Found the mother task
int optionCounter = 0;
for (const o2::framework::ConfigParamSpec& option : device.options) {

Check failure on line 82 in Common/Core/TableHelper.h

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (verbose) {
LOG(info) << " Option " << optionCounter++ << " " << option.name << " of type " << static_cast<int>(option.type) << " = '" << option.defaultValue.asString() << "'";
}
Expand Down Expand Up @@ -109,4 +112,11 @@
return getTaskOptionValue(initContext, taskName, configurable.name, configurable.value, verbose);
}

} // namespace o2::common::core

using o2::common::core::enableFlagIfTableRequired;
using o2::common::core::getTaskOptionValue;
using o2::common::core::isTableRequiredInWorkflow;
using o2::common::core::printTablesInWorkflow;

#endif // COMMON_CORE_TABLEHELPER_H_
Loading