9 log = nlohmann::ordered_json::array();
14 log = nlohmann::ordered_json::array();
15 if (this->os.has_value()) {
25 os.value().get() <<
"Objective (maximization): " << (float)
objective << std::endl;
26 os.value().get() <<
"Objective (minimization): " << -(float)
objective << std::endl;
40 auto token =
static_cast<const Token*
>(observable);
42 auto json = token->jsonify();
52 log.push_back( json );
54 if (
log.size() > maxSize) {
59 auto event =
static_cast<const Event*
>(observable);
70 log.push_back( json );
72 if (
log.size() > maxSize) {
77 auto message =
static_cast<const Message*
>(observable);
88 log.push_back( json );
90 if (
log.size() > maxSize) {
97nlohmann::ordered_json
Recorder::find(nlohmann::json include, nlohmann::json exclude)
const {
98 nlohmann::ordered_json result = nlohmann::ordered_json::array();
102 std::back_inserter(result), [&include,&exclude](
const nlohmann::json& item) {
103 for ( auto& [key,value] : include.items() ) {
104 if ( !item.contains(key) || !(value.is_null() || item[key] == value) ) {
108 for (
auto& [key,value] : exclude.items() ) {
109 if ( item.contains(key) && (value.is_null() || item[key] == value) ) {
nlohmann::ordered_json jsonify() const
void addSubscriber(Observer *subscriber, ObservableTypes... observableTypes)
nlohmann::ordered_json find(nlohmann::json include, nlohmann::json exclude=nlohmann::json()) const
Returns a json array containing all log entries matching the include object and not matching the excl...
nlohmann::ordered_json log
A json object of the entire log.
void subscribe(Engine *engine)
void notice(const Observable *observable) override
Recorder(size_t maxSize=std::numeric_limits< size_t >::max())
BPMNOS::number objective
The global objective.
const SystemState * systemState
BPMNOS::number getObjective() const
Returns the total objective value (assuming maximization) accumulated during execution.
Represents a token running through a (sub)process.
const StateMachine * owner
State machine owning the token.
virtual nlohmann::ordered_json jsonify() const =0
virtual constexpr Type getObservableType() const =0