/' µRtWare is a lightweight publish/subscribe middleware for real-time applications. It was developed as part of the software habitat for the Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well. Copyright (C) 2018..2018 Thomas Schöpping et al. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . '/ @startuml title **µRtWare**\nurtSubscriberFetchMessage()\n start note event received endnote :lock topic; note The message list is part of the topic and must be locked. endnote if (Is HRT subscriber?) then (yes) :lock next message; if (Fetch next or latest message?) then (next) else (latest) partition "iterate to latest" { :lock next message; note locked two messaged ahead endnote while (Timestamp of next message is younger than current?) is (yes) fork fork :decremenet HRT counter of current message; fork again :update QoS delay timer (@subscriber); note no lock required since this timer is only accessed when the topic is locked endnote endfork :unlock current message; fork again :lock next message; endfork endwhile (no) :unlock next message; note one message ahead still locked but HRT counter not yet decremented endnote } endif fork :decrement HRT counter of current message; fork again :update QoS delay timer (@subscriber); note no lock required since this timer is only accessed when the topic is locked endnote endfork else (no) :lock last read message; if (Timestamp equals local copy?) then (yes) else (no) partition "find oldest valid message" { :lock next message; while (Timestamp of next is younger then of current?) is (yes) fork :unlock current mesage; fork again :lock one message further ahaead; endfork endwhile (no) :unlock next message; } endif if (Fetch next or latest message?) then (next) else (latest) partition "iterate to latest" { :lock next message; while (Timestamp of next message is younger then current?) is (yes) fork :unlock current message; fork again :lock next message; endfork endwhile (no) :unlock next message; note one message ahead still locked endnote } endif endif fork :set last fetched message pointer to locked message; fork again :copy timestamp of message; endfork :unlock message; :unlock topic; stop @enduml