Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / topic / urtTopicInit.uml @ f6e5368e

History | View | Annotate | Download (2.761 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 ee83a495 Thomas Schöpping
  ====
37
  -- **return** : urt_status_t --
38
  Returns ""URT_STATUS_OK"" on success.
39 dd31cb03 Thomas Schöpping
  Returns ""URT_STATUS_TOPIC_DUPLICATE"" if another topic with the same identifier already exists.
40 ee83a495 Thomas Schöpping
endnote
41 7491c395 Thomas Schöpping
42
/'### PROCEDURE ##############################################################'/
43
44 ee83a495 Thomas Schöpping
start
45 7491c395 Thomas Schöpping
:initialize members;
46
note
47 dd31cb03 Thomas Schöpping
  * **next** ← ""NULL""
48
  * **id** ← id
49
  * urtMutexInit(**lock**)
50
  * urtEventSourceInit(**evtSource**)
51
  * **numHrtSubscriber** ← 0
52
  * urtCondvarInit(**hrtReleased**)
53
  * urtMessageInit(**mandatoryMessage**)
54
  * **latestMessage** ← &mandatoryMessage
55 ee83a495 Thomas Schöpping
  .. URT_CFG_PUBSUB_QOS_RATECHECKS == true ..
56 dd31cb03 Thomas Schöpping
  * **hrtSubscribers** ← ""NULL""
57
  * urtTimerInit(**qosRateTimer**)
58 ee83a495 Thomas Schöpping
  .. URT_CFG_PUBSUB_PROFILING == true ..
59 dd31cb03 Thomas Schöpping
  * **numMessagesPublished** ← 0
60
  * **numMessagesDiscarded** ← 0
61
  * **numSubscribers** ← 0
62 ee83a495 Thomas Schöpping
endnote
63 e87bd7c7 Thomas Schöpping
:close circular message buffer;
64
note
65
  latestMessage""->""next ← latestMessage
66
endnote
67 ee83a495 Thomas Schöpping
: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 dd31cb03 Thomas Schöpping
    Returns ""URT_STATUS_TOPIC_DUPLICATE"".
91 ee83a495 Thomas Schöpping
  endnote
92
endif
93 7491c395 Thomas Schöpping
94
/'### OUTRO ##################################################################'/
95
96
@enduml