Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / topic / urtTopicInit.uml @ 77bd2c61

History | View | Annotate | Download (2.866 KB)

1 7491c395 Thomas Schöpping
/'
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 ee83a495 Thomas Schöpping
/'### PARAMETERS & RETURN ####################################################'/
29 7491c395 Thomas Schöpping
30
note
31 ee83a495 Thomas Schöpping
  -- **topic** : urt_topic_t* --
32 7491c395 Thomas Schöpping
  The topic to initialize.
33
  Must not be ""NULL"".
34 ee83a495 Thomas Schöpping
  -- **id** : urt_topicid_t --
35 7491c395 Thomas Schöpping
  Unique, numeric identifier of the topic.
36 77bd2c61 skenneweg
  -- **mandatoryMessage** : urt_message_t* --
37
  Starting message of the topic.
38
  Must not be ""NULL"".
39 ee83a495 Thomas Schöpping
  ====
40
  -- **return** : urt_status_t --
41
  Returns ""URT_STATUS_OK"" on success.
42 dd31cb03 Thomas Schöpping
  Returns ""URT_STATUS_TOPIC_DUPLICATE"" if another topic with the same identifier already exists.
43 ee83a495 Thomas Schöpping
endnote
44 7491c395 Thomas Schöpping
45
/'### PROCEDURE ##############################################################'/
46
47 ee83a495 Thomas Schöpping
start
48 7491c395 Thomas Schöpping
:initialize members;
49
note
50 dd31cb03 Thomas Schöpping
  * **next** ← ""NULL""
51
  * **id** ← id
52
  * urtMutexInit(**lock**)
53
  * urtEventSourceInit(**evtSource**)
54
  * **numHrtSubscriber** ← 0
55
  * urtCondvarInit(**hrtReleased**)
56 77bd2c61 skenneweg
  * **mandatoryMessage** ← mandatoryMessage
57 dd31cb03 Thomas Schöpping
  * **latestMessage** ← &mandatoryMessage
58 ee83a495 Thomas Schöpping
  .. URT_CFG_PUBSUB_QOS_RATECHECKS == true ..
59 dd31cb03 Thomas Schöpping
  * **hrtSubscribers** ← ""NULL""
60
  * urtTimerInit(**qosRateTimer**)
61 ee83a495 Thomas Schöpping
  .. URT_CFG_PUBSUB_PROFILING == true ..
62 dd31cb03 Thomas Schöpping
  * **numMessagesPublished** ← 0
63
  * **numMessagesDiscarded** ← 0
64
  * **numSubscribers** ← 0
65 ee83a495 Thomas Schöpping
endnote
66 e87bd7c7 Thomas Schöpping
:close circular message buffer;
67
note
68
  latestMessage""->""next ← latestMessage
69
endnote
70 ee83a495 Thomas Schöpping
:lock core;
71
:access first topic;
72
while (Topic is not ""NULL""\nand topic ID is lower?) is (yes)
73
  :proceed to next topic;
74
endwhile (no)
75
if (Current topic is ""NULL""?) then (yes)
76
  :append self to core's list of topic;
77
  :unlock core;
78
  stop
79
  note
80
    Returns ""URT_STATUS_OK"".
81
  endnote
82
elseif (Current topic ID is greater?) then (yes)
83
  :insert self in front of current topic;
84
  :unlock core;
85
  stop
86
  note
87
    Returns ""URT_STATUS_OK"".
88
  endnote
89
else (no)
90
  :unlock core;
91
  stop
92
  note
93 dd31cb03 Thomas Schöpping
    Returns ""URT_STATUS_TOPIC_DUPLICATE"".
94 ee83a495 Thomas Schöpping
  endnote
95
endif
96 7491c395 Thomas Schöpping
97
/'### OUTRO ##################################################################'/
98
99
@enduml