void updateTreeWithMessageList(
        Process::MessageNode& rootNode,
        State::MessageList lst)
{
    for(const auto& mess : lst)
    {
        merge_impl(
            rootNode,
            mess.address,
            [&] (auto& nodeValues) {
            nodeValues.userValue = mess.value;
        });

    }
}
void updateTreeWithMessageList(
        Process::MessageNode& rootNode,
        State::MessageList lst,
        const Id<Process::ProcessModel>& proc,
        ProcessPosition pos)
{
    // We go through the tree.
    // For each node :
    // If lst contains a message corresponding to the node, we add / update it (and remove it from lst).
    // If the node contains a message corresponding to the process but there is none in lst, we remove its process part
    // (and we remove it if it's empty (and we also remove all the parents that don't have a value recursively)

    // When the tree has been visited, if there are remaining addresses in lst, we insert them in the tree.

    // We don't perform anything on the root node
    for(auto& child : rootNode)
    {
        rec_updateTree(child, lst, proc, pos);
    }

    // Handle the remaining messages
    for(const auto& mess : lst)
    {
        merge_impl(
            rootNode, mess.address,
            [&] (auto& nodeValues) {
            switch(pos)
            {
                case ProcessPosition::Previous:
                    nodeValues.previousProcessValues.push_back({proc, mess.value});
                    break;
                case ProcessPosition::Following:
                    nodeValues.followingProcessValues.push_back({proc, mess.value});
                    break;
                default:
                    ISCORE_ABORT;
                    break;
            }
        });
    }
}
示例#3
0
bool widen_into(State& dst, const State& src) {
  return merge_impl(dst, src, widening_union);
}
示例#4
0
bool merge_into(State& dst, const State& src) {
  return merge_impl(dst, src, union_of);
}