Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / service / urtServiceInit.uml @ 33aa05c5

History | View | Annotate | Download (2.604 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**\nurtServiceInit()\n
27

    
28
/'### PARAMETERS & RETURN ####################################################'/
29

    
30
note
31
  -- **service** : urt_service_t* --
32
  The service to initialize.
33
  Must not be ""NULL"".
34
  -- **id** : urt_serviceid_t --
35
  Unique, numeric identifier of the service.
36
  ====
37
  -- **return** : urt_status_t --
38
  Returns ""URT_STATUS_OK"" on success.
39
  Returns ""URT_STATUS_SERVICE_DUPLICATE"" if another service 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
  * **requestQueue_front** ← ""NULL""
51
  * **requestQueue_hrtBack** ← ""NULL""
52
  * **requestQueue_fsrtBack** ← ""NULL""
53
  * **requestQueue_back** ← ""NULL""
54
  * urtEventSourceInit(**evtSource**)
55
  * urtEventListenerInit(**evtListener**)
56
  .. URT_CFG_RPC_PROFILING == true ..
57
  * **numCalls** ← 0
58
endnote
59
:register event listener to source;
60
:lock core;
61
:access first service;
62
while (Service is not ""NULL""\nand service ID is lower?) is (yes)
63
  :proceed to next service;
64
endwhile (no)
65
if (Current service is ""NULL""?) then (yes)
66
  :append self to core's list of services;
67
  :unlock core;
68
  stop
69
  note
70
    Returns ""URT_STATUS_OK"":
71
  endnote
72
elseif (Current service ID is greater?) then (yes)
73
  :insert self in front of current service;
74
  :unlock core;
75
  stop
76
  note
77
    Returns ""URT_STATUS_OK"":
78
  endnote
79
else (no)
80
  :unlock core;
81
  stop
82
  note
83
    Returns ""URT_STATUS_SERVICE_DUPLICATE"":
84
  endnote
85
endif
86

    
87
/'### OUTRO ##################################################################'/
88

    
89
@enduml