Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / service / urtServiceInit.uml @ dd31cb03

History | View | Annotate | Download (2.583 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
  -- **callback** : urt_servicefunc_t* --
37
  Callabck function to be executed by this service.
38
  Must not be ""NULL"".
39
  ====
40
  -- **return** : urt_status_t --
41
  Returns ""URT_STATUS_OK"" on success.
42
  Returns ""URT_STATUS_SERVICE_DUPLICATE"" if another service with the same identifier already exists.
43
endnote
44

    
45
/'### PROCEDURE ##############################################################'/
46

    
47
start
48
:initialize members;
49
note
50
  * **next** ← ""NULL""
51
  * **id** ← id
52
  * urtMutexInit(**lock**)
53
  * **callback** ← callback
54
  .. URT_CFG_RPC_PROFILING == true ..
55
  * **minDuration** ← 0xF..F
56
  * **maxDuration** ← 0
57
  * **sumDurations** ← 0
58
  * **numCalls** ← 0
59
  * **numTimeouts** ← 0
60
endnote
61
:lock core;
62
:access first service;
63
while (Service is not ""NULL""\nand service ID is lower?) is (yes)
64
  :proceed to next service;
65
endwhile (no)
66
if (Current service is ""NULL""?) then (yes)
67
  :append self to core's list of services;
68
  :unlock core;
69
  stop
70
  note
71
    Returns ""URT_STATUS_OK"":
72
  endnote
73
elseif (Current service ID is greater?) then (yes)
74
  :insert self in front of current service;
75
  :unlock core;
76
  stop
77
  note
78
    Returns ""URT_STATUS_OK"":
79
  endnote
80
else (no)
81
  :unlock core;
82
  stop
83
  note
84
    Returns ""URT_STATUS_SERVICE_DUPLICATE"":
85
  endnote
86
endif
87

    
88
/'### OUTRO ##################################################################'/
89

    
90
@enduml