Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / service / urtServiceDispatch.uml @ 17d978fe

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

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

    
30
note
31
  -- **service** : urt_service_t* --
32
  The service to dispatch a request for.
33
  Must not be ""NULL"".
34
  -- **payload** : void* --
35
  Pointer where to store the payload (if any).
36
  May be ""NULL"" if the service expects no payload.
37
  -- **bytes** : size_t --
38
  Size of the payload in bytes.
39
  Must be 0 if the service expects no payload.
40
  ====
41
  -- **return** : urt_baserequest_t* --
42
  Pointer to the request to be processed next.
43
  May be ""NULL"" if there are no pending requests.
44
endnote
45

    
46
/'### PROCEDURE ##############################################################'/
47

    
48
start
49
:lock service;
50
if (Request list empty?) then (no)
51
  :access first request (""requestQueue_front"");
52
  note
53
    No need to lock the request because it is enqueued at this point.
54
    Enqueued requests must not be altered without the according service to be locked.
55
    Since the service has been locked, no enqueued requests will be modified externally.
56
  endnote
57
  :proceed ""requestQueue_front"" pointer;
58
  fork
59
    if (This was the last request (pointer became ""NULL"")?) then (yes)
60
      :set ""requestQueue_back"" to ""NULL"";
61
    else (no)
62
      :set request ""next"" pointer to ""NULL"";
63
    endif
64
  fork again
65
    if (This was the last HRT request?) then (yes)
66
      :set ""requestQueue_hrtBack"" to ""NULL"";
67
    elseif (This was the last FRT/SRT request?) then (yes)
68
      :set ""requestQueue_fsrtBack"" to ""NULL"";
69
    else (no)
70
    endif
71
  fork again
72
    :copy payload from request to argument;
73
  endfork
74
  :unlock service;
75
  stop
76
  note
77
    Returns pointer to the dispatched request.
78
  endnote
79
else (yes)
80
endif
81
:unlock service;
82
stop
83
note
84
  Returns ""NULL"".
85
endnote
86

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

    
89
@enduml