Skip to content
Open
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
6 changes: 4 additions & 2 deletions form/root_storage/root_tbranch_read_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ROOT_TBranch_Read_ContainerImp::ROOT_TBranch_Read_ContainerImp(std::string const

void ROOT_TBranch_Read_ContainerImp::setFile(std::shared_ptr<IStorage_File> file)
{
ROOT_TFileImp* root_tfile_imp = dynamic_cast<ROOT_TFileImp*>(file.get());
auto* root_tfile_imp = dynamic_cast<ROOT_TFileImp*>(file.get());
if (root_tfile_imp == nullptr) {
throw std::runtime_error(
"ROOT_TBranch_Read_ContainerImp::setFile can't attach to non-ROOT file");
Expand Down Expand Up @@ -166,7 +166,9 @@ bool ROOT_TBranch_Read_ContainerImp::read(int id, void const** data, std::type_i
" (col_name='" + col_name() + "', type='" + DemangleName(type) +
"')");
}
branchBuffer = klass->New();
// ROOT returns ownership of dynamically created branch payload objects here.
// NOLINTNEXTLINE(readability-redundant-casting)
branchBuffer = gsl::owner<void*>{klass->New()};
branchStatus = m_tree->SetBranchAddress(
col_name().c_str(), reinterpret_cast<void*>(&branchBuffer), klass, EDataType::kOther_t, true);
}
Expand Down
5 changes: 2 additions & 3 deletions form/root_storage/root_tbranch_write_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void ROOT_TBranch_Write_ContainerImp::setAttribute(std::string const& key, std::
void ROOT_TBranch_Write_ContainerImp::setFile(std::shared_ptr<IStorage_File> file)
{
this->Storage_Associative_Write_Container::setFile(file);
ROOT_TFileImp* root_tfile_imp = dynamic_cast<ROOT_TFileImp*>(file.get());
auto* root_tfile_imp = dynamic_cast<ROOT_TFileImp*>(file.get());
if (root_tfile_imp == nullptr) {
throw std::runtime_error(
"ROOT_TBranch_Write_ContainerImp::setFile can't attach to non-ROOT file");
Expand All @@ -43,8 +43,7 @@ void ROOT_TBranch_Write_ContainerImp::setFile(std::shared_ptr<IStorage_File> fil
void ROOT_TBranch_Write_ContainerImp::setParent(std::shared_ptr<IStorage_Write_Container> parent)
{
this->Storage_Associative_Write_Container::setParent(parent);
ROOT_TTree_Write_ContainerImp* root_ttree_imp =
dynamic_cast<ROOT_TTree_Write_ContainerImp*>(parent.get());
auto* root_ttree_imp = dynamic_cast<ROOT_TTree_Write_ContainerImp*>(parent.get());
if (root_ttree_imp == nullptr) {
throw std::runtime_error("ROOT_TBranch_Write_ContainerImp::setParent");
}
Expand Down
8 changes: 5 additions & 3 deletions form/root_storage/root_ttree_write_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ ROOT_TTree_Write_ContainerImp::ROOT_TTree_Write_ContainerImp(std::string const&
void ROOT_TTree_Write_ContainerImp::setFile(std::shared_ptr<IStorage_File> file)
{
this->Storage_Write_Association::setFile(file);
ROOT_TFileImp* root_tfile_imp = dynamic_cast<ROOT_TFileImp*>(file.get());
auto* root_tfile_imp = dynamic_cast<ROOT_TFileImp*>(file.get());
if (root_tfile_imp == nullptr) {
throw std::runtime_error(
"ROOT_TTree_Write_ContainerImp::setFile can't attach to non-ROOT file");
}
m_tfile = dynamic_cast<ROOT_TFileImp*>(file.get())->getTFile();
m_tfile = root_tfile_imp->getTFile();
}

void ROOT_TTree_Write_ContainerImp::setupWrite(std::type_info const& /* type*/)
Expand All @@ -35,7 +35,9 @@ void ROOT_TTree_Write_ContainerImp::setupWrite(std::type_info const& /* type*/)
m_tree.reset(m_tfile->Get<TTree>(name().c_str()));
}
if (m_tree == nullptr) {
m_tree.reset(new TTree(name().c_str(), name().c_str()));
// Mark the raw allocation as an owning pointer before transferring it.
// NOLINTNEXTLINE(readability-redundant-casting)
m_tree.reset(gsl::owner<TTree*>{new TTree(name().c_str(), name().c_str())});
m_tree->SetDirectory(m_tfile.get());
}
if (m_tree == nullptr) {
Expand Down
1 change: 1 addition & 0 deletions form/root_storage/root_ttree_write_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace form::detail::experimental {
class ROOT_TTree_Write_ContainerImp : public Storage_Write_Association {
public:
explicit ROOT_TTree_Write_ContainerImp(std::string const& name);
~ROOT_TTree_Write_ContainerImp() override = default;

ROOT_TTree_Write_ContainerImp(ROOT_TTree_Write_ContainerImp const&) = delete;
ROOT_TTree_Write_ContainerImp& operator=(ROOT_TTree_Write_ContainerImp const&) = delete;
Expand Down
1 change: 0 additions & 1 deletion form/storage/storage_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,4 @@ void StorageReader::readContainer(Token const& token,
}
}
cont->second->read(token.id(), data, type);
return;
}
3 changes: 2 additions & 1 deletion phlex/core/framework_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "oneapi/tbb/info.h"

#include <concepts>
#include <cstdint>
#include <functional>
#include <map>
#include <memory>
Expand Down Expand Up @@ -187,7 +188,7 @@ namespace phlex::detail {
void finalize_router(index_router::provider_input_ports_t provider_input_ports,
std::map<std::string, named_index_ports> multilayer_join_index_ports);

enum class driver_mode { default_driver, deferred_driver };
enum class driver_mode : std::uint8_t { default_driver, deferred_driver };
explicit framework_graph(driver_mode mode, int max_parallelism);

resource_usage graph_resource_usage_;
Expand Down
4 changes: 2 additions & 2 deletions test/core_misc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ TEST_CASE("verify_name tests", "[core]")
FAIL("Should have thrown");
} catch (std::runtime_error const& e) {
std::string msg = e.what();
CHECK(msg.find("my_module") != std::string::npos);
CHECK(msg.contains("my_module"));
}
}
}
Expand All @@ -104,5 +104,5 @@ TEST_CASE("add_to_error_messages tests", "[core]")
add_to_error_messages(errors, "Node", "duplicate_node");

REQUIRE(errors.size() == 1);
CHECK(errors[0].find("duplicate_node") != std::string::npos);
CHECK(errors[0].contains("duplicate_node"));
}
2 changes: 1 addition & 1 deletion test/fold_duplicate_layer_name_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ TEST_CASE("Fold different layer paths with same trailing name", "[graph]")
g.execute();

CHECK(g.execution_count("run_add") == std::size_t{index_limit} * number_limit);
CHECK(g.execution_count("job_add") == index_limit * number_limit + top_level_event_limit);
CHECK(g.execution_count("job_add") == (index_limit * number_limit) + top_level_event_limit);
CHECK(g.execution_count("verify_run_sum") == index_limit);
CHECK(g.execution_count("verify_job_sum") == 1);
}
5 changes: 1 addition & 4 deletions test/unfold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ namespace {
// Provider algorithms
unsigned int provide_max_number(data_cell_index const& id) { return 10u * (id.number() + 1); }

numbers_t provide_ten_numbers(data_cell_index const& id)
{
return numbers_t(10, id.number() + 1);
}
auto provide_ten_numbers(data_cell_index const& id) { return numbers_t(10, id.number() + 1); }
}

TEST_CASE("Splitting the processing", "[graph]")
Expand Down
Loading