Revision ee83a495 doc/activitydiagrams/topic/urtTopicInit.uml
doc/activitydiagrams/topic/urtTopicInit.uml | ||
---|---|---|
25 | 25 |
|
26 | 26 |
title **µRtWare**\nurtTopicInit()\n |
27 | 27 |
|
28 |
!include ../../functions.iuml
|
|
28 |
/'### PARAMETERS & RETURN ####################################################'/
|
|
29 | 29 |
|
30 |
/'### PARAMETERS & START #####################################################'/ |
|
31 |
|
|
32 |
start |
|
33 | 30 |
note |
34 |
-- ""**topic** : urt_topic_t*"" --
|
|
31 |
-- **topic** : urt_topic_t* --
|
|
35 | 32 |
The topic to initialize. |
36 | 33 |
Must not be ""NULL"". |
37 |
-- ""**id** : urt_topicid_t"" --
|
|
34 |
-- **id** : urt_topicid_t --
|
|
38 | 35 |
Unique, numeric identifier of the topic. |
39 |
end note |
|
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 |
|
40 | 41 |
|
41 | 42 |
/'### PROCEDURE ##############################################################'/ |
42 | 43 |
|
44 |
start |
|
43 | 45 |
:initialize members; |
44 |
:lock core; |
|
45 |
:insert self to global topic list; |
|
46 |
:unlock core; |
|
47 |
|
|
48 |
/'### STOP & RETURN ##########################################################'/ |
|
49 |
|
|
50 |
stop |
|
51 | 46 |
note |
52 |
-- **return** ""urt_status_t"" -- |
|
53 |
Returns ""URT_STATUS_ERROR"" if another topic with the same identifier already exists. |
|
54 |
end 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 |
|
55 | 88 |
|
56 | 89 |
/'### OUTRO ##################################################################'/ |
57 | 90 |
|
Also available in: Unified diff