Simple example of tc::sdk::observable
#include <teiacare/sdk/observable.hpp>
#include <spdlog/spdlog.h>
int main()
{
spdlog::set_pattern("[%H:%M:%S.%e] %v");
const int total_updates = 10;
for (int i = 0; i < total_updates; ++i)
{
observable = i;
}
spdlog::warn("[Callback Disabled]");
observable.callback_enabled(false);
observable = -1;
spdlog::warn("[Callback Enabled]");
observable.callback_enabled(true);
observable = -1;
observable = 1;
observable = 1;
observable = 1;
return 0;
}
Utility class to observe a value with a user provided callback.