Skip to content

Commit

Permalink
Deprecate usage of PdiEvent::and_with by PdiEvent::with
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau committed Jan 15, 2025
1 parent 215546f commit ed8418b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions include/ddc/pdi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ class PdiEvent
return *this;
}

#if defined(DDC_BUILD_DEPRECATED_CODE)
template <PDI_inout_t access, class T>
PdiEvent& and_with(std::string const& name, T&& t)
[[deprecated("Use 'with' instead.")]] PdiEvent& and_with(std::string const& name, T&& t)
{
return with<access>(name, std::forward<T>(t));
}
#endif

/// @}
/// API with access deduction
Expand All @@ -148,12 +150,14 @@ class PdiEvent
return with<default_access_v<Arithmetic>>(name, std::forward<Arithmetic>(data));
}

#if defined(DDC_BUILD_DEPRECATED_CODE)
/// With synonym
template <class T>
PdiEvent& and_with(std::string const& name, T&& t)
[[deprecated("Use 'with' instead.")]] PdiEvent& and_with(std::string const& name, T&& t)
{
return with(name, std::forward<T>(t));
}
#endif

/// @}
};
Expand Down
6 changes: 3 additions & 3 deletions tests/pdi/pdi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ TEST(Pdi, ChunkAndChunkSpan)

ddc::PdiEvent("some_event")
.with("pdi_chunk_label", chunk)
.and_with("nb_event_called", nb_event_called);
.with("nb_event_called", nb_event_called);

ddc::PdiEvent("some_event")
.with("pdi_chunk_label", chunk.span_view())
.and_with("nb_event_called", nb_event_called);
.with("nb_event_called", nb_event_called);

ddc::PdiEvent("some_event")
.with("pdi_chunk_label", chunk.span_cview())
.and_with("nb_event_called", nb_event_called);
.with("nb_event_called", nb_event_called);

EXPECT_EQ(nb_event_called, 3);
}
Expand Down

0 comments on commit ed8418b

Please sign in to comment.