Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (2.597 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_ERROR"" 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
  **hrtSubscribers** ← ""NULL""
53
  urtCondvarInit(**hrtReleased**)
54
  urtMessageInit(**mandatoryMessage**)
55
  **latestMessage** ← &mandatoryMessage
56
  .. URT_CFG_PUBSUB_QOS_RATECHECKS == true ..
57
  urtTimerInit(**qosRateTimer**)
58
  .. URT_CFG_PUBSUB_PROFILING == true ..
59
  **numDiscardedMessages** ← 0
60
  **numSubscribers** ← 0
61
endnote
62
:lock core;
63
:access first topic;
64
while (Topic is not ""NULL""\nand topic ID is lower?) is (yes)
65
  :proceed to next topic;
66
endwhile (no)
67
if (Current topic is ""NULL""?) then (yes)
68
  :append self to core's list of topic;
69
  :unlock core;
70
  stop
71
  note
72
    Returns ""URT_STATUS_OK"".
73
  endnote
74
elseif (Current topic ID is greater?) then (yes)
75
  :insert self in front of current topic;
76
  :unlock core;
77
  stop
78
  note
79
    Returns ""URT_STATUS_OK"".
80
  endnote
81
else (no)
82
  :unlock core;
83
  stop
84
  note
85
    Returns ""URT_STATUS_ERROR"".
86
  endnote
87
endif
88

    
89
/'### OUTRO ##################################################################'/
90

    
91
@enduml