Skip to content

Commit

Permalink
Implement CtxSettings, use instead of BasicSettings.
Browse files Browse the repository at this point in the history
Signed-off-by: drslebedev <[email protected]>
  • Loading branch information
drslebedev authored and RalphSteinhagen committed May 24, 2024
1 parent 4069232 commit a48da57
Show file tree
Hide file tree
Showing 6 changed files with 596 additions and 272 deletions.
7 changes: 4 additions & 3 deletions core/include/gnuradio-4.0/Block.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <gnuradio-4.0/annotated.hpp> // This needs to be included after fmt/format.h, as it defines formatters only if FMT_FORMAT_H_ is defined
#include <gnuradio-4.0/reflection.hpp>
#include <gnuradio-4.0/Settings.hpp>
#include <gnuradio-4.0/Transactions.hpp>

#include <gnuradio-4.0/LifeCycle.hpp>

Expand Down Expand Up @@ -496,7 +497,7 @@ class Block : public lifecycle::StateMachine<Derived>, //
Tag _mergedInputTag{};

// intermediate non-real-time<->real-time setting states
std::unique_ptr<SettingsBase> _settings = std::make_unique<BasicSettings<Derived>>(self());
std::unique_ptr<SettingsBase> _settings = std::make_unique<CtxSettings<Derived>>(self());

[[nodiscard]] constexpr auto &
self() noexcept {
Expand Down Expand Up @@ -530,7 +531,7 @@ class Block : public lifecycle::StateMachine<Derived>, //
Block() noexcept(false) : Block({}) {} // N.B. throws in case of on contract violations

Block(std::initializer_list<std::pair<const std::string, pmtv::pmt>> init_parameter) noexcept(false) // N.B. throws in case of on contract violations
: _settings(std::make_unique<BasicSettings<Derived>>(*static_cast<Derived *>(this))) { // N.B. safe delegated use of this (i.e. not used during construction)
: _settings(std::make_unique<CtxSettings<Derived>>(*static_cast<Derived *>(this))) { // N.B. safe delegated use of this (i.e. not used during construction)

// check Block<T> contracts
checkBlockContracts<decltype(*static_cast<Derived *>(this))>();
Expand Down Expand Up @@ -907,7 +908,7 @@ class Block : public lifecycle::StateMachine<Derived>, //
inputPorts<PortType::STREAM>(&self()));

if (!mergedInputTag().map.empty()) {
settings().autoUpdate(mergedInputTag().map); // apply tags as new settings if matching
settings().autoUpdate(mergedInputTag()); // apply tags as new settings if matching
if constexpr (Derived::tag_policy == TagPropagationPolicy::TPP_ALL_TO_ALL) {
for_each_port([this](PortLike auto &outPort) noexcept { outPort.publishTag(mergedInputTag().map, 0); }, outputPorts<PortType::STREAM>(&self()));
}
Expand Down
2 changes: 1 addition & 1 deletion core/include/gnuradio-4.0/Graph_yaml_importer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ load_grc(PluginLoader &loader, const std::string &yaml_source) {
// clang-format on

} else {
const auto &value = kv.second.as<std::string>();
const auto &value = kv.second.as<std::string>();
currentBlock->metaInformation()[key] = value;
}
}
Expand Down
Loading

0 comments on commit a48da57

Please sign in to comment.