15 , attributeRegistry(attributeRegistry)
18 type = Type::MessageDelivery;
32 for ( XML::bpmnos::tAttribute& attributeElement : guidance->attributes.value().get().attribute ) {
34 auto attribute = std::make_unique<Attribute>(&attributeElement, Attribute::Category::STATUS, this->attributeRegistry);
35 if ( attribute->expression ) {
36 for ( auto input : attribute->expression->inputs ) {
37 dependencies.insert(input);
40 attributes.push_back(std::move(attribute));
42 catch ( const std::exception &error ){
43 throw std::runtime_error(
"Guidance: illegal expression for attribute '" + (std::string)attributeElement.id.value +
"'\n" + error.what() );
48 if ( guidance->restrictions.has_value() ) {
49 for ( XML::bpmnos::tRestriction& restriction : guidance->restrictions.value().get().restriction ) {
51 restrictions.push_back(std::make_unique<Restriction>(&restriction,this->attributeRegistry));
52 for ( auto input : restrictions.back()->expression.inputs ) {
53 dependencies.insert(input);
56 catch ( const std::exception &error ){
57 throw std::runtime_error(
"Guidance: illegal expression for restriction '" + (std::string)restriction.id.value +
"'\n" + error.what() );
62 if ( guidance->operators.has_value() ) {
63 for ( XML::bpmnos::tOperator& operator_ : guidance->operators.value().get().operator_ ) {
65 operators.push_back(std::make_unique<Operator>(&operator_,this->attributeRegistry));
66 for ( auto input : operators.back()->expression.inputs ) {
67 dependencies.insert(input);
70 catch ( const std::exception &error ){
71 throw std::runtime_error(
"Guidance: illegal expression for operator '" + (std::string)operator_.id.value +
"'" +
"'\n" + error.what() );
82 if ( value.has_value() && attribute->weight ) {
84 objective += attribute->weight * value.value();
89 if ( value.has_value() && attribute->weight ) {
91 objective += attribute->weight * value.value();
96 if ( value.has_value() ) {
98 objective += attribute->weight * value.value();
127 status.push_back( scenario->
getKnownValue(instanceId, attribute.get(), currentTime ) );
128 if ( attribute->expression ) {
130 status.back() = attribute->expression->execute(status,data,globals);
136 operator_->apply(status,data,globals);
void apply(const Scenario *scenario, BPMNOS::number currentTime, const BPMNOS::number instanceId, const BPMN::FlowNode *node, BPMNOS::Values &status, DataType &data, BPMNOS::Values &globals) const
std::optional< BPMNOS::number > getKnownValue(const Scenario::InstanceData *instance, const BPMNOS::Model::Attribute *attribute, const BPMNOS::number currentTime) const
Method returning a known value of an attribute.