urtware / doc / activitydiagrams / topic / urtTopicInit.uml @ 5dfd7422
History | View | Annotate | Download (2.761 KB)
1 |
/' |
---|---|
2 |
µRtWare is a lightweight publish/subscribe middleware for real-time |
3 |
applications. It was developed as part of the software habitat for the |
4 |
Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well. |
5 |
|
6 |
Copyright (C) 2018..2020 Thomas Schöpping et al. |
7 |
|
8 |
This program is free software: you can redistribute it and/or modify |
9 |
it under the terms of the GNU General Public License as published by |
10 |
the Free Software Foundation, either version 3 of the License, or |
11 |
(at your option) any later version. |
12 |
|
13 |
This program is distributed in the hope that it will be useful, |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
GNU General Public License for more details. |
17 |
|
18 |
You should have received a copy of the GNU General Public License |
19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 |
'/ |
21 |
|
22 |
/'### INTRO ##################################################################'/ |
23 |
|
24 |
@startuml |
25 |
|
26 |
title **µRtWare**\nurtTopicInit()\n |
27 |
|
28 |
/'### PARAMETERS & RETURN ####################################################'/ |
29 |
|
30 |
note |
31 |
-- **topic** : urt_topic_t* -- |
32 |
The topic to initialize. |
33 |
Must not be ""NULL"". |
34 |
-- **id** : urt_topicid_t -- |
35 |
Unique, numeric identifier of the topic. |
36 |
==== |
37 |
-- **return** : urt_status_t -- |
38 |
Returns ""URT_STATUS_OK"" on success. |
39 |
Returns ""URT_STATUS_TOPIC_DUPLICATE"" if another topic with the same identifier already exists. |
40 |
endnote |
41 |
|
42 |
/'### PROCEDURE ##############################################################'/ |
43 |
|
44 |
start |
45 |
:initialize members; |
46 |
note |
47 |
* **next** ← ""NULL"" |
48 |
* **id** ← id |
49 |
* urtMutexInit(**lock**) |
50 |
* urtEventSourceInit(**evtSource**) |
51 |
* **numHrtSubscriber** ← 0 |
52 |
* urtCondvarInit(**hrtReleased**) |
53 |
* urtMessageInit(**mandatoryMessage**) |
54 |
* **latestMessage** ← &mandatoryMessage |
55 |
.. URT_CFG_PUBSUB_QOS_RATECHECKS == true .. |
56 |
* **hrtSubscribers** ← ""NULL"" |
57 |
* urtTimerInit(**qosRateTimer**) |
58 |
.. URT_CFG_PUBSUB_PROFILING == true .. |
59 |
* **numMessagesPublished** ← 0 |
60 |
* **numMessagesDiscarded** ← 0 |
61 |
* **numSubscribers** ← 0 |
62 |
endnote |
63 |
:close circular message buffer; |
64 |
note |
65 |
latestMessage""->""next ← latestMessage |
66 |
endnote |
67 |
:lock core; |
68 |
:access first topic; |
69 |
while (Topic is not ""NULL""\nand topic ID is lower?) is (yes) |
70 |
:proceed to next topic; |
71 |
endwhile (no) |
72 |
if (Current topic is ""NULL""?) then (yes) |
73 |
:append self to core's list of topic; |
74 |
:unlock core; |
75 |
stop |
76 |
note |
77 |
Returns ""URT_STATUS_OK"". |
78 |
endnote |
79 |
elseif (Current topic ID is greater?) then (yes) |
80 |
:insert self in front of current topic; |
81 |
:unlock core; |
82 |
stop |
83 |
note |
84 |
Returns ""URT_STATUS_OK"". |
85 |
endnote |
86 |
else (no) |
87 |
:unlock core; |
88 |
stop |
89 |
note |
90 |
Returns ""URT_STATUS_TOPIC_DUPLICATE"". |
91 |
endnote |
92 |
endif |
93 |
|
94 |
/'### OUTRO ##################################################################'/ |
95 |
|
96 |
@enduml |