Statistics
| Branch: | Revision:

urtware / doc / classdiagrams / overview.uml @ 35c9457f

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