Statistics
| Branch: | Revision:

urtware / doc / classdiagrams / overview.uml @ 42470f0a

History | View | Annotate | Download (24.597 KB)

1 6ebd2388 Thomas Schöpping
/'
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..2018  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
@startuml
23
24
title **µRtWare**\nOverview\n
25
26
27
28 5f113d7b Thomas Schöpping
/' Not a type but a set of configuration macros. '/
29
class urt_config <<(C,grey)>> {
30
    'Selection to en-/disable debug checks.
31
  + URT_CONFIG_DEBUG : bool
32
    'Selector to specify the width of urt_delay_t type.
33
  + URT_CONFIG_DELAY_WIDTH
34
    'Selector to specify the widtg of the urt_topicid_t type.
35
  + URT_CONFIG_TOPICID_WIDTH
36
    'Selector to specify the integer type of urt_nodesync_t.
37
  + URT_CONFIG_NODESYNC_TYPE
38
}
39
40 6ebd2388 Thomas Schöpping
package "primitives" {
41
42
  /' Temporal delay in microseconds. '/
43
  class urt_delay_t <<(T,lightblue)>> {
44
    .. either ..
45
    uint32_t
46
    .. or ..
47
    uint64_t
48
  }
49 5f113d7b Thomas Schöpping
  urt_delay_t ..> urt_config
50 6ebd2388 Thomas Schöpping
51
  /' Well defined error codes. '/
52
  enum urt_status_t {
53
    URT_STATUS_OK = 0
54
    URT_STATUS_WARNING = 1
55
    URT_STATUS_ERROR = -1
56
  }
57
  
58
  /' Topic ID type. '/
59
  class urt_topicid_t <<(T,lightblue)>> {
60
    'configurable
61
    uin8_t
62
    .. or ..
63
    uint16_t
64
    .. or ..
65
    uint32_t
66
    .. or ..
67
    uint64_t
68
  }
69 5f113d7b Thomas Schöpping
  urt_topicid_t ..> urt_config
70 6ebd2388 Thomas Schöpping
71 35c9457f Thomas Schöpping
  /' Just a function for debugging. '/
72
  class urt_debug <<(F,white)>> {
73
      'Checks the condition in debug mode.
74
    + urtDebugAssert(condition : bool) : void
75
  }
76
77
  /' Node synchronization type. '/
78
  class urt_nodesync_t <<T,lightblue>> {
79
    'configurable
80
    uin8_t
81
    .. or ..
82
    int8_t
83
    .. or ..
84
    uint16_t
85
    .. or ..
86
    int16_t
87
    .. or ..
88
    uint32_t
89
    .. or ..
90
    int32_t
91
    .. or ..
92
    uint64_t
93
    .. or ..
94
    int64_t
95
  }
96 5f113d7b Thomas Schöpping
  urt_nodesync_t ..> urt_config
97 35c9457f Thomas Schöpping
98 6ebd2388 Thomas Schöpping
} /' package "primitives" '/
99
100
101
102 5f113d7b Thomas Schöpping
package "OSAL" {
103 35c9457f Thomas Schöpping
104 6ebd2388 Thomas Schöpping
  /' OS time type with arbitrary resolution. '/
105
  class urt_osTime_t <<(T,lightblue)>> {
106
      'Converts an OS time to 64 bit microsecond precise value.
107
    + urtTime2Us (t : urt_osTime_t*) : uint64_t
108
      'Retrieves the current time.
109
    + urtTimeNow (void) : urt_osTime_t
110
  }
111
112
  /' OS mutex lock interface. '/
113
  class urt_osMutex_t <<(T,lightblue)>> {
114
      'Initializes a urt_osMutex_t object.
115 5f113d7b Thomas Schöpping
    + urtMutexInit (mutex : urt_osMutex_t*) : void
116 6ebd2388 Thomas Schöpping
      'Block the thread until the mutex could be locked.
117 5f113d7b Thomas Schöpping
    + urtMutexLock (mutex : urt_osMutex_t*) : void
118 6ebd2388 Thomas Schöpping
      'Tries to lock the mutex, but does not block but immediately returns an indicator.
119 5f113d7b Thomas Schöpping
    + urtMutexTryLock (mutex : urt_osMutex_t*) : bool
120 6ebd2388 Thomas Schöpping
      'Unlocks a previously locked mutex.
121 5f113d7b Thomas Schöpping
    + urtMutexUnlock (mutex : urt_osMutex_t*) : void
122 6ebd2388 Thomas Schöpping
  }
123
124
  package "condition variable" {
125
126
    /' Return type for the wait function on condition variables. '/
127
    enum urt_condvarStatus_t {
128
        'The condition variable has been signaled.
129
      + URT_CONDVAR_STATUS_SIGNAL = 0
130
        'The condition variable has been broadcasted.
131
      + URT_CONDVAR_STATUS_BROADCAST = 1
132
        'The wait function timed out.
133
      + URT_CONDVAR_STATUS_TIMEOUT = 2
134
    }
135
136
    /' Condition variable interface. '/
137
    class urt_osCondvar_t <<(T,lightblue)>> {
138
        'Initializes a urt_osCondvar_t object.
139
      + urtCondvarInit (condvar : urt_osCondvar_t*) : void
140
        'Signals one thread that is waiting for the condition variable.
141
      + urtConvarSignal (condvar : urt_osCondvar_t*) : void
142
        'Signals all threads that are waiting for the condition variable.
143
      + urtCondvarBroadcast (condvar : urt_osCondvar_t*) : void
144
        'Waits for the condition variable.
145
      + urtCondvarWait (condvar : urt_osCondvar_t*, mutex : urt_osMutex_t*, timeout : urt_delay_t) : urt_condvarStatus_t
146
    }
147
    urt_osCondvar_t ..> urt_osMutex_t
148
    urt_osCondvar_t ..> urt_delay_t
149
    urt_osCondvar_t ..> urt_condvarStatus_t
150
151
  } /' package "condition variable" '/
152
153
  package "timer" {
154
155
    /' Timer callback definition. '/
156
    class urt_osTimerCallback_t <<(T,lightblue)>> {
157
      urt_osTimerCallback_t (parameter : void*) : void
158
    }
159
  
160
    /' OS timer interface. '/
161
    class urt_osTimer_t <<(T,lightblue)>> {
162
        'Initializes an urt_osTimer_t object.
163
      + urtTimerInit (timer : urt_osTimer_t*) : void
164
        'Sets the timer to a specified delay with specified callback and arguments.
165
      + urtTimerSet (timer : urt_osTimer_t*, delay : urt_delay_t, callback : urt_osTimerCallback_t*, parameter : void*) : urt_status_t
166
        'Resets the timer.
167
      + urtTimerReset (timer : urt_osTimer_t*) : urt_status_t
168
        'Check whether the timer is already armed.
169 5f113d7b Thomas Schöpping
      + urtTimerIsArmed (timer : urt_osTimer_t*) : bool
170 6ebd2388 Thomas Schöpping
    }
171
    urt_osTimer_t ..> urt_delay_t
172
    urt_osTimer_t ..> urt_status_t
173
    urt_osTimer_t ..> urt_osTimerCallback_t
174
175
  } /' package "timer" '/
176
177
  package "thread" {
178
179
    /' Thread priority type. '/
180
    class urt_osThreadPrio_t <<(T,lightblue)>>
181
182
    /' Thread main function type. '/
183
    class urt_osThreadFunction_t <<(T,lightblue)>> {
184
      urt_osThreadFunction_t (arg : void*) : void
185
    }
186
187
    /' Thread terminate signals. '/
188
    enum urt_osThreadTerminateSignal_t {
189
      'Signal to request termination asap.
190
      URT_THREAD_TERMINATE_REQUEST = 15
191
      'Signal to kill a thread immediately.
192
      URT_THREAD_TERMINATE_KILL = 9
193
    }
194
195 35c9457f Thomas Schöpping
    /' Thread execution states. '/
196
    enum urt_osThreadState_t {
197
      'Thread is currently being executed.
198
      URT_THREAD_STATE_RUNNING = 0
199
      'Thread is ready but waiting to be scheduled.
200
      URT_THREAD_STATE_READY = 1
201
      'Thread is actively sleeping.
202
      URT_THREAD_STATE_SLEEPING = 2
203
      'Thread has ben suspended explicitely.
204
      URT_THREAD_STATE_SUSPENDED = 3
205
      'Thread is waiting for something (e.g. Mutex, event, etc.).
206
      URT_THREAD_STATE_WAITING = 4
207
      'Thread has terminated.
208
      URT_THREAD_STATE_TERMINATED = 5
209
    }
210
211 6ebd2388 Thomas Schöpping
    /' OS thread interface. '/
212
    class urt_osThread_t <<(T,lightblue)>> {
213
        'Minimum priority for low priority threads.
214
      + URT_THREAD_PRIO_LOW_MIN : urt_osThreadPrio_t
215
        'Maximum priority for low priority threads.
216
      + URT_THREAD_PRIO_LOW_MAX : urt_osThreadPrio_t
217
        'Minimum priority for normal priority threads.
218
      + URT_THREAD_PRIO_NORMAL_MIN : urt_osThreadPrio_t
219
        'Maximum priority for normal priority threads.
220
      + URT_THREAD_PRIO_NORMAL_MAX : urt_osThreadPrio_t
221
        'Minimum priority for high priority threads.
222
      + URT_THREAD_PRIO_HIGH_MIN : urt_osThreadPrio_t
223
        'Maximum priority for high priority threads.
224
      + URT_THREAD_PRIO_HIGH_MAX : urt_osThreadPrio_t
225
        'Minimum priority for real-time threads.
226
      + URT_THREAD_PRIO_RT_MIN : urt_osThreadPrio_t
227
        'Maximum priority for real-time threads.
228
      + URT_THREAD_PRIO_RT_MAX : urt_osThreadPrio_t
229
      ..
230
        'Maximum sleep interval in seconds (as float).
231
      + URT_THREAD_MAX_SLEEP : float
232
        'Maximum sleep interval in seconds.
233
      + URT_THREAD_MAX_SSLEP : unsigned int
234
        'Maximum sleep interval in milliseconds.
235
      + URT_THREAD_MAX_MSLEEP : unsigned int
236
        'Maximum sleep interval in microseconds.
237
      + URT_THREAD_MAX_USLEEP : unsigned int
238
      __
239
        'Macro to setup working area as static variable (handles alignment if required).
240 35c9457f Thomas Schöpping
      + URT_THREAD_WORKING_AREA (varname, stacksize)
241 6ebd2388 Thomas Schöpping
      ..
242
        'Initializes an urt_osThread_t object.
243
      + urtThreadInit (wa : void*, wasize : size_t, func : urt_osThreadFunction_t*, arg : void*) : urt_osThread_t*
244
        'Starts a thread.
245
      + urtThreadStart (thread : urt_osThread_t*, prio : urt_osThreadPrio_t, arg : void*) : void
246
        'The calling threads yields.
247
      + urtThreadYield (void) : void
248
        'Retrieves the priority of a thread.
249
      + urtThreadGetPriority (thread : urt_osThread_t*) : urt_osThreadPrio_t
250
        'Sets the priority of a thread.
251
      + urtThreadSetPriority (thread : urt_osThread_t*, prio : urt_osThreadPrio_t) : void
252
        'Retrieves the first thread in the list of children.
253
      + urtThreadSuspend (void) : void
254
        'Wakes a suspended thread.
255
      + urtThreadResume (thread : urt_osThread_t*) : urt_status_t
256
        'Suspends the calling thread for the specified time.
257
      + urtThreadSleep (seconds : float) : void
258
        'Suspends the calling thread for the specified time.
259
      + urtThreadSSleep (seconds : usnigned int) : void
260
        'Suspends the calling thread for the specified time.
261
      + urtThreadMSleep (milliseconds : unsigned int) : void
262
        'Suspends the calling thread for the specified time.
263
      + urtThreadUSleep (microseconds : unsigned int) : void
264
        'Suspends the calling thread until the specified time.
265
      + urtThreadSleepUntil (time : urt_osTime_t) : void
266
        'The calling thread exits execution (terminates).
267
      + urtThreadExit (void) : void
268
        'Terminates a specified thread.
269
      + urtThreadTerminate (thread : urt_osThread_t*, sig : urt_osThreadTerminateSignal_t) : void
270
        'Waits until the specified thread terminates.
271
      + urtThreadJoin (thread : urt_osThread_t*) : void
272 35c9457f Thomas Schöpping
        'Retrieves the execution state of the specified thread.
273
      + urtThreadGetState (thread : urt_osThread_t*) : urt_osThreadState_t
274
        'Retrieves the first child of a thread (or ""NULL"").
275
      + urtThreadGetChildren (thread : urt_osThread_t*) : urt_osThread_t*
276
        'Retrieves a sibling (next child in a list) of the thread or ""NULL"".
277
      + urtThreadGetSibling (thread : urt_osThread_t*) : urt_psThread_t*
278 6ebd2388 Thomas Schöpping
    }
279
    urt_osThread_t ..> urt_osThreadPrio_t
280
    urt_osThread_t ..> urt_osThreadFunction_t
281
    urt_osThread_t ..> urt_osTime_t
282
    urt_osThread_t ..> urt_osThreadTerminateSignal_t
283 35c9457f Thomas Schöpping
    urt_osThread_t ..> urt_osThreadState_t
284 6ebd2388 Thomas Schöpping
285
  } /' package "thread" '/
286
287
  package "events" {
288
289
    /' OS event mask type. '/
290 35c9457f Thomas Schöpping
    class urt_osEventMask_t <<(T,lightblue)>> {
291
        'The event mask, which will be handled with maximum priority by the event system.
292
      + URT_EVENTMASK_MAXPRIO : urt_osEventMask_t
293
    }
294 6ebd2388 Thomas Schöpping
295
    /' OS event flag type. '/
296
    class urt_osEventFlags_t <<(T,lightblue)>>
297
298
    enum urt_osEventWaitType_t {
299
      URT_EVENT_WAIT_ONE = 0
300
      URT_EVENT_WAIT_ANY = 1
301
      URT_EVENT_WAIT_ALL = 2
302
    }
303
304
    /' OS event listener interface. '/
305
    class urt_osEventListener_t <<(T,lightblue)>> {
306
        'Initializes an urt_osEventListener_t object.
307
      + urtEventListenerInit (listener : urt_osEventListener_t*) : void
308
        'Retrieves the flags of the event listener.
309
      + urtEventListenerGetFlags (listener : urt_osEventListener_t*) : urt_osEventFlags_t
310
        'Retrieves and clears the flags of the event listener.
311
      + urtEventListenerClearFlags (listener : urt_osEventListener_t*) : urt_osEventFlags_t
312
    }
313
    urt_osEventListener_t ..> urt_osEventFlags_t
314
315
    /' OS event source interface. '/
316
    class urt_osEventSource_t <<(T,lightblue)>> {
317
        'Initializes an urt_osEventSource_t object.
318
      + urtEventSourceInit (source : urt_osEventSource_t*) : void
319
        'Emits an event.
320
      + urtEventSourceBroadcast (source : urt_osEventSource_t*, flags : urt_osEventFlags_t) : void
321
    }
322
    urt_osEventSource_t ..> urt_osEventFlags_t
323
324
    /' Not a class/type but a set of static event-related functions. '/
325
    class urt_events <<(F,white)>> {
326
        'Registers a lister to a source.
327
      + urtEventRegister (source : urt_osEventSource_t*, listener : urt_osEventListener_t*, mask : urt_osEventMask_t) : urt_status_t
328
        'Unregisters a listener from a source.
329
      + urtEventUnregister (source _ urt_osEventSource_t*, listener : urt_osEventListener_t*) : urt_status_t
330
        'Blocks the thread until any event occurs or the timeout expires.
331
      + urtEventWait (type : urt_osEventWaitType_t, timeout : urt_delay_t) : urt_osEventMask_t
332
    }
333
    urt_events ..> urt_osEventSource_t
334
    urt_events ..> urt_osEventListener_t
335
    urt_events ..> urt_osEventMask_t
336
    urt_events ..> urt_status_t
337
    urt_events ..> urt_osEventWaitType_t
338
    urt_events ..> urt_delay_t
339
340
  } /' package "events" '/
341
342 35c9457f Thomas Schöpping
  /' Not a class/type but a set of output-related functions. '/
343
    class urt_streams <<(F,white)>> {
344
        'Prints a formatted string to the standard output stream (stdout).
345
      + urtPrintf(fmt : char*, ... ) : int
346
        'Prints a formatted string to the standard error stream (stderr).
347
      + urtErrPrintf(fmt : char*, ... ) : int
348
    }
349
350 6ebd2388 Thomas Schöpping
} /' package "interfaces" '/
351
352
package "middleware" {
353
354
  package "real-time class" {
355
356
    /' The top level RT class structure. '/
357
    class urt_rtclass_t <<(S,lightgrey)>> {
358
        'The actual RT class.
359
      + class : urt_rtclasstype_t
360
        'Parameters of the RT class.
361
      + params : urt_rtclassparams_t
362
    }
363
    urt_rtclass_t "1" *-- "1" urt_rtclasstype_t
364
    urt_rtclass_t "1" *-- "1" urt_rtclassparams_t
365
366
    /' Descriptor to distinguish the four RT classes. '/
367
    enum urt_rtclasstype_t {
368
      'Hard real-time.
369
      URT_RTCLASS_HARD = 0
370
      'Firm real-time.
371
      URT_RTCLASS_FIRM = 1
372
      'Soft real-time.
373
      URT_RTCLASS_SOFT = 2
374
      'No real-time at all.
375
      URT_RTCLASS_NONE = 3
376
    }
377
378
    /' Union structure, holding RT class parameters. '/
379
    class urt_rtclassparams_t <<(U,lightgreen)>> {
380
        'Parameters for hard real-time.
381
      + hrt : urt_hrtparams_t
382
        'Parameters for firm real-time.
383
      + frt : urt_frtparams_t
384
        'Parameters for soft real-time.
385
      + srt : urt_srtparans_t
386
        'Parameters for non-real-time.
387
      + nrt : urt_nrtparams_t
388
    }
389
    urt_rtclassparams_t "1" *-- "0..1" urt_hrtparams_t
390
    urt_rtclassparams_t "1" *-- "0..1" urt_frtparams_t
391
    urt_rtclassparams_t "1" *-- "0..1" urt_srtparams_t
392
    urt_rtclassparams_t "1" *-- "0..1" urt_nrtparams_t
393
394
    /' Parameters for hard real-time. '/
395
    class urt_hrtparams_t <<(S,lightgrey)>> {
396
        'Maximum temporal offset between creation and consumption of messages.
397
      + deadlineOffset : urt_delay_t
398
        'Expected rate at which data is published.
399
      + expectedRate : urt_delay_t
400
        'QoS timer to detected missed deadlines.
401
      + qosTimer : urt_osTimer_t
402
    }
403
    urt_hrtparams_t ..> urt_delay_t
404
    urt_hrtparams_t "1" *-- "1" urt_osTimer_t
405
406
    /' Parameters for firm real-time. '/
407
    class urt_frtparams_t <<(S,lightgrey)>> {
408
        'Maximum temporal offset between creation and consumption of messages.
409
      + deadlineOffset : urt_delay_t
410
        'Expected rate at which data is published.
411
      + expectedRate : urt_delay_t
412
        'QoS Timer to detect missed deadlines.
413
      + qosTimer : urt_osTimer_t
414
        'Callback function for the QoS timer.
415
      + callback : urt_osTimerCallback_t
416
        'Parameters for the callback function.
417
      + cbparams : void*
418
    }
419
    urt_frtparams_t ..> urt_delay_t
420
    urt_frtparams_t "1" *-- "1" urt_osTimer_t
421
    urt_frtparams_t "1" *-- "1" urt_osTimerCallback_t
422
423
    /' Parameters for soft real-time. '/
424
    class urt_srtparams_t <<(S,lightgrey)>> {
425
        'Callback function to calculate usefulness given a dleay.
426
      + *usefulness (dt : urt_delay_t, params : void*) : float
427
        'Optional parameters for the callback function.
428
      + params : void*
429
    }
430
    urt_srtparams_t ..> urt_delay_t
431
432
    /' Parameters for non-real-time. '/
433
    class urt_nrtparams_t <<(S,lightgrey)>> {
434
      'There are nor parameters in this case.
435
    }
436
437
  } /' package "real-time class" '/
438
439
440
441
  /' Message type. '/
442
  class urt_message_t <<(S,lightgrey)>> {
443
      'Pointer to the next message in a list.
444
    + next : urt_message_t*
445
      'Pointer to some arbitrary (reusable) payload object.
446
    + payload : void*
447
      'Origin time of the message.
448
    + originTime : urt_osTime_t
449
      'Mutex lock for exclusive access.
450
    + lock : urt_osMutex_t
451
      'Counter of HRT subscribers that did not consume the message yet.
452
    + numHrtConsumersLeft : unsigned int
453
      'Condition variable to inform waiting publishers when the message is available again.
454
    + hrtConsumersLeft : urt_osCondvar_t
455
    -- evaluation data --
456
      'Counter of overall subscribers that did not consume the message yet.
457
    + numConsumersLeft : unsigned int
458
    __
459
      'Initializes a urt_message_t object.
460
    + urtMessageInit (message : urt_message_t*, payload : void*) : urt_status_t
461
  }
462
  urt_message_t "1" o-- "0..1" urt_message_t
463
  urt_message_t "1" *-- "1" urt_osTime_t
464
  urt_message_t "1" *-- "1" urt_osMutex_t
465
  urt_message_t "1" *-- "1" urt_osCondvar_t
466
467
  /' Subscriber type. '/
468
  class urt_subscriber_t <<(S,lightgrey)>> {
469
      'Pointer to the next subscriber in a list.
470
    + next : urt_subscriber_t*
471
      'Pointer to the topic, this subscriber subscribed to.
472
    + topic : urt_topic_t*
473
      'Event listener to notify the node about new messages.
474
    + evtListener : urt_osEventListener_t
475
      'Real-time class descriptor.
476
    + rtclass : urt_rtclass_t
477
      'Pointer to the message consumed most recently.
478
    + lastMessage : urt_message_t*
479
      'Copy of the origin time of the message consumed most recently.
480
    + lastMessageTime : urt_osTime_t
481
    -- evaluation data --
482
      'Minimum latency ever detected.
483
    + minLatency : urt_delay_t
484
      'Maximum latency ever detected.
485
    + maxLatency : urt_delay_t
486
      'Sum of all latencies.
487
    + sumLatencies : uint64_t
488
      'Number of messages received.
489
    + numMessagesReceived : unsigned int
490
    __
491
      'Initializes a urt_subscriber_t object.
492
    + urtSubscriberInit (subscriber : urt_subscriber_t*) : urt_status_t
493
      'Tries to subscribe to a topic and contributes an optional list of messages.
494
    + urtSubscriberSubscribe (subscriber : urt_subscriber_t*, topic : urt_topic_t*, rtclass : urt_rtclass_t*, messages : urt_messages_t*) : urt_status_t
495
      'Unsubscribes from a topic.
496
    + urtSubscriberUnsubscribe (subscriber : urt_subscriber_t*) : urt_status_t
497 e98c61a8 Thomas Schöpping
      'Fetches either the next or the latest message and optionally copies the payload.
498
    + urtSubscriberFetchMessage (subscriber : urt_subscriber_t*, payload : void*, bytes : size_t, latest : bool) : urt_status_t
499 6ebd2388 Thomas Schöpping
  }
500
  urt_subscriber_t "1" o-- "0..1" urt_subscriber_t
501
  urt_subscriber_t "1" o-- "0..1" urt_topic_t
502
  urt_subscriber_t "1" *-- "1" urt_osEventListener_t
503
  urt_subscriber_t "1" *-- "1" urt_rtclass_t
504
  urt_subscriber_t "1" o-- "0..1" urt_message_t
505
  urt_subscriber_t "1" *-- "1" urt_osTime_t
506
  urt_subscriber_t "1" *-- "2" urt_delay_t
507
  urt_subscriber_t ..> urt_status_t
508
  urt_subscriber_t ..> urt_topicid_t
509
510
  /' Publisher type. '/
511
  class urt_publisher_t <<(S,lightgrey)>> {
512
      'Pointer to the topic for publishing.
513
    + topic : urt_topic_t*
514
    -- evaluation data --
515
      'Counter of attempts to publish a message.
516
    + publishAttempts : unsigned int
517
      'Counter of failed attempts to publish a message.
518
    + publishFails : unsigned int
519
    __
520
      'Initializes a urt_publisher_t object and contributes an optional list of messages.
521
    + urtPublisherInit (publisher : urt_publisher_t*, topic : urt_topic_t*, messages : urt_message_t*) : urt_status_t
522
      'Publishes a message via the associated topic.
523
    + urtPublisherPublish (publisher : urt_publisher_t*, payload : void*, n : size_t, t : urt_osTime_t, timeout : urt_delay_t) : urt_status_t
524
  }
525
  urt_publisher_t "1" o-- "1" urt_topic_t
526
  urt_publisher_t ..> urt_message_t
527
  urt_publisher_t ..> urt_osTime_t
528
  urt_publisher_t ..> urt_delay_t
529
  urt_publisher_t ..> urt_status_t
530
531
  /' Topic type. '/
532
  class urt_topic_t <<(S,lightgrey)>> {
533
      'Pointer to the next topic in a list.
534
    + next : urt_topic_t*
535
      'Mutex lock for exclusive access.
536 35c9457f Thomas Schöpping
    + lock : urt_osMutex_t
537 6ebd2388 Thomas Schöpping
      'Event source to inform all subscribers when a new message is published.
538
    + evtSource : urt_osEventSource_t
539
      'Number of HRT subscribers.
540
    + numHrtSubscribers : unsigned int
541
      'List of HRT subscribers, orderd by their expected rate (most critical first).
542
    + hrtSubscribers : urt_subscriber_t*
543
      'Timer to check for missed rates.
544
    + qosTimer : urt_osTimer_t
545
      'Mandatory message, each Topic holds.
546
    + mandatoryMessage : urt_message_t
547
      'Pointer to the latest message.
548
    + latestMessage : urt_message_t*
549
      'Identifier of the topic.
550
    + id : urt_topicid_t
551
    -- evaluation data --
552
      'Variable to count how many (non-hrt) subscribers did not fetch a message before it was reused.
553
    + numDiscardedMessages : unsigned int
554
      'Number of overall subscribers.
555
    + numSubscribers : unsigned int
556
    __
557
      'Initializes an urt_topic_t object.
558
    + urtTopicInit (topic : urt_topic_t*, id : urt_topicid_t) : urt_status_t
559
  }
560
  urt_topic_t "1" o-- "0..1" urt_topic_t
561
  urt_topic_t "1" *-- "1" urt_osMutex_t
562
  urt_topic_t "1" *-- "1" urt_osEventSource_t
563
  urt_topic_t "1" o-- "0..*" urt_subscriber_t
564
  urt_topic_t "1" *-- "1" urt_osTimer_t
565
  urt_topic_t "1" o-- "1..*" urt_message_t
566
  urt_topic_t "1" *-- "1" urt_message_t
567
  urt_topic_t "1" *-- "1" urt_topicid_t
568
  urt_topic_t ..> urt_osTime_t
569
  urt_topic_t ..> urt_status_t
570
571
  /' uRtWare core type. '/
572
  class urt_core_t <<(S,lightgrey)>> {
573
      'List of nodes ordered by their (initial) priority.
574
    - {static} _nodes : urt_node_t*
575
      'List of topics ordered by their identifiers.
576
    - {static} _topics : urt_topic_t*
577 35c9457f Thomas Schöpping
      'Event source for control events.
578
    - {static} _evtSource : urt_osEventSource_t
579
      'Mutex used for synchronization.
580
    - {static} _lock : urt_osMutex_t
581 6ebd2388 Thomas Schöpping
    __
582
      'Initializes the urt_core_t object.
583
    + urtCoreInit (void) : urt_status_t
584 35c9457f Thomas Schöpping
      'Starts all node threads (nodes will block before the loop).
585
    + urtCoreStartNodes (void) : urt_status_t
586
      'Nodes can use this function to synchronize globally.
587
    + urtCoreSynchronizeNodes (node : urt_node_t*, stage : urt_nodesync_t) : urt_status_t
588 6ebd2388 Thomas Schöpping
      'Stops all nodes.
589 35c9457f Thomas Schöpping
    + urtCoreStopNodes (void) : urt_status_t
590 6ebd2388 Thomas Schöpping
      'Retrieves a topic given an identifier.
591
    + urtCoreRetrieveTopic (id : urt_topicid_t) : urt_topic_t*
592
  }
593
  urt_core_t "1" o-- "0..*" urt_topic_t
594
  urt_core_t "1" o-- "0..*" urt_node_t
595 35c9457f Thomas Schöpping
  urt_core_t "1" *-- "1" urt_osEventSource_t
596
  urt_core_t "1" *-- "1" urt_osMutex_t
597 6ebd2388 Thomas Schöpping
  urt_core_t ..> urt_status_t
598 35c9457f Thomas Schöpping
  urt_core_t --> urt_nodesync_t
599 6ebd2388 Thomas Schöpping
  urt_core_t ..> urt_topicid_t
600
601
  package "node" {
602
603
    /' Function type to be called during setup phase of node threads. '/
604
    class urt_nodeSetupCallback_t <<(T,lightblue)>> {
605 35c9457f Thomas Schöpping
      'Takes the node and optional parameters as arguments and returns a event mask for the next iteration.
606
      urt_nodeSetupCallback_t (node : urt_node_t*, arg : void*) : urt_osEventMask_t
607 6ebd2388 Thomas Schöpping
    }
608
    urt_nodeSetupCallback_t ..> urt_node_t
609
    urt_nodeSetupCallback_t ..> urt_status_t
610
611
    /' Function type to be called during loop phase of node threads. '/
612
    class urt_nodeLoopCallback_t <<(T,lightblue)>> {
613 35c9457f Thomas Schöpping
      'Takes the node, a mask of occurred events and optional parameters as arguments and returns a event mask for the next iteration.
614
      urt_nodeLoopCallback_t (node : urt_node_t*, events : urt_osEventMask_t, arg : void*) : urt_osEventMask_t
615 6ebd2388 Thomas Schöpping
    }
616
    urt_nodeLoopCallback_t ..> urt_node_t
617
    urt_nodeLoopCallback_t ..> urt_osEventMask_t
618
    urt_nodeLoopCallback_t ..> urt_status_t
619
620
    /' Node type. '/
621
    class urt_node_t <<(S,lightgrey)>> {
622
        'Pointer to the next node in a list.
623
      + next : urt_node_t*
624
        'Pointer to the nore thread.
625
      + thread : urt_osThread_t*
626
        'Callback function to be called during the setup phase.
627
      + setupcallback : urt_nodeSetupCallback_t*
628
        'Optional parameters for the setup callback function.
629
      + setupparams : void*
630
        'Callback function to be called in each loop iteration.
631
      + loopcallback : urt_nodeLoopCallback_t*
632
        'Optional parameters for the loop callback function.
633
      + loopparams : void*
634 35c9457f Thomas Schöpping
        'Execution stage of the node.
635
      + stage : urt_nodesync_t
636
        'Event listener for middleware-wide control events.
637
      + listener : urt_osEventListener_t
638 6ebd2388 Thomas Schöpping
      __
639
      'The main() function of the node thread.
640
      - {static} _main : urt_osThreadFunction_t
641
        'Initializes an urt_node_t object.
642
      + urtNodeInit (node : urt_node_t*, stacksize : size_t, setupcallback : urt_nodeSetupCallback_t*, setupparams : void*, loopcallback : urt_nodeLoopCallback_t*, loopparams : void*) : urt_status_t
643
    }
644
    urt_node_t "1" o-- "0..1" urt_node_t
645
    urt_node_t "1" o-- "1" urt_osThread_t
646
    urt_node_t "1" o-- "1" urt_nodeSetupCallback_t
647
    urt_node_t "1" o-- "1" urt_nodeLoopCallback_t
648 35c9457f Thomas Schöpping
    urt_node_t "1" *-- "1" urt_nodesync_t
649 6ebd2388 Thomas Schöpping
    urt_node_t "1" *-- "1" urt_osEventMask_t
650
    urt_node_t "1" *-- "1" urt_osEventWaitType_t
651 35c9457f Thomas Schöpping
    urt_node_t "1" *-- "1" urt_osEventListener_t
652 6ebd2388 Thomas Schöpping
    urt_node_t ..> urt_osThreadTerminateSignal_t
653
654
  } /' package "node" '/
655
656
} /' package "middleware" '/
657
658
@enduml