/' µ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..2020 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 . '/ /'### INTRO ##################################################################'/ @startuml title **µRtWare**\nurtTopicInit()\n /'### PARAMETERS & RETURN ####################################################'/ note -- **topic** : urt_topic_t* -- The topic to initialize. Must not be ""NULL"". -- **id** : urt_topicid_t -- Unique, numeric identifier of the topic. -- **mandatoryMessage** : urt_message_t* -- Starting message of the topic. Must not be ""NULL"". ==== -- **return** : urt_status_t -- Returns ""URT_STATUS_OK"" on success. Returns ""URT_STATUS_TOPIC_DUPLICATE"" if another topic with the same identifier already exists. endnote /'### PROCEDURE ##############################################################'/ start :initialize members; note * **next** ← ""NULL"" * **id** ← id * urtMutexInit(**lock**) * urtEventSourceInit(**evtSource**) * **numHrtSubscriber** ← 0 * urtCondvarInit(**hrtReleased**) * **mandatoryMessage** ← mandatoryMessage * **latestMessage** ← &mandatoryMessage .. URT_CFG_PUBSUB_QOS_RATECHECKS == true .. * **hrtSubscribers** ← ""NULL"" * urtTimerInit(**qosRateTimer**) .. URT_CFG_PUBSUB_PROFILING == true .. * **numMessagesPublished** ← 0 * **numMessagesDiscarded** ← 0 * **numSubscribers** ← 0 endnote :close circular message buffer; note latestMessage""->""next ← latestMessage endnote :lock core; :access first topic; while (Topic is not ""NULL""\nand topic ID is lower?) is (yes) :proceed to next topic; endwhile (no) if (Current topic is ""NULL""?) then (yes) :append self to core's list of topic; :unlock core; stop note Returns ""URT_STATUS_OK"". endnote elseif (Current topic ID is greater?) then (yes) :insert self in front of current topic; :unlock core; stop note Returns ""URT_STATUS_OK"". endnote else (no) :unlock core; stop note Returns ""URT_STATUS_TOPIC_DUPLICATE"". endnote endif /'### OUTRO ##################################################################'/ @enduml