Statistics
| Branch: | Revision:

urtware / doc / classdiagrams / overview.uml @ 509d44c4

History | View | Annotate | Download (24.6 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..2019  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
/' Not a type but a set of configuration macros. '/
29
class urt_config <<(C,grey)>> {
30
    'Selection to en-/disable debug checks.
31
  + URT_CFG_DEBUG : bool
32
    'Selector to specify the width of urt_delay_t type.
33
  + URT_CFG_DELAY_WIDTH
34
    'Selector to specify the width of the urt_topicid_t type.
35
  + URT_CFG_TOPICID_WIDTH
36
    'Selector to specify the width of the urt_nodestage_t type.
37
  + URT_CFG_NODESTAGE_WIDTH
38
}
39

    
40
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
  urt_delay_t ..> urt_config
50

    
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
  urt_topicid_t ..> urt_config
70

    
71
  /' Node synchronization type. '/
72
  class urt_nodestage_t <<T,lightblue>> {
73
    'configurable
74
    uin8_t
75
    .. or ..
76
    uint16_t
77
    .. or ..
78
    uint32_t
79
    .. or ..
80
    uint64_t
81
  }
82
  urt_nodestage_t ..> urt_config
83

    
84
} /' package "primitives" '/
85

    
86

    
87

    
88
package "OSAL" {
89

    
90
  /' OS time type with arbitrary resolution. '/
91
  class urt_osTime_t <<(T,lightblue)>> {
92
      'Converts an OS time to 64 bit microsecond precise value.
93
    + urtTime2Us (t : urt_osTime_t*) : uint64_t
94
      'Retrieves the current time.
95
    + urtTimeNow (void) : urt_osTime_t
96
  }
97

    
98
  /' OS mutex lock interface. '/
99
  class urt_osMutex_t <<(T,lightblue)>> {
100
      'Initializes a urt_osMutex_t object.
101
    + urtMutexInit (mutex : urt_osMutex_t*) : void
102
      'Block the thread until the mutex could be locked.
103
    + urtMutexLock (mutex : urt_osMutex_t*) : void
104
      'Tries to lock the mutex, but does not block but immediately returns an indicator.
105
    + urtMutexTryLock (mutex : urt_osMutex_t*) : bool
106
      'Unlocks a previously locked mutex.
107
    + urtMutexUnlock (mutex : urt_osMutex_t*) : void
108
  }
109

    
110
  package "condition variable" {
111

    
112
    /' Return type for the wait function on condition variables. '/
113
    enum urt_condvarStatus_t {
114
        'The condition variable has been signaled.
115
      + URT_CONDVAR_STATUS_SIGNAL = 0
116
        'The condition variable has been broadcasted.
117
      + URT_CONDVAR_STATUS_BROADCAST = 1
118
        'The wait function timed out.
119
      + URT_CONDVAR_STATUS_TIMEOUT = 2
120
    }
121

    
122
    /' Condition variable interface. '/
123
    class urt_osCondvar_t <<(T,lightblue)>> {
124
        'Initializes a urt_osCondvar_t object.
125
      + urtCondvarInit (condvar : urt_osCondvar_t*) : void
126
        'Signals one thread that is waiting for the condition variable.
127
      + urtConvarSignal (condvar : urt_osCondvar_t*) : void
128
        'Signals all threads that are waiting for the condition variable.
129
      + urtCondvarBroadcast (condvar : urt_osCondvar_t*) : void
130
        'Waits for the condition variable.
131
      + urtCondvarWait (condvar : urt_osCondvar_t*, mutex : urt_osMutex_t*, timeout : urt_delay_t) : urt_condvarStatus_t
132
    }
133
    urt_osCondvar_t ..> urt_osMutex_t
134
    urt_osCondvar_t ..> urt_delay_t
135
    urt_osCondvar_t ..> urt_condvarStatus_t
136

    
137
  } /' package "condition variable" '/
138

    
139
  package "timer" {
140

    
141
    /' Timer callback definition. '/
142
    class urt_osTimerCallback_t <<(T,lightblue)>> {
143
      urt_osTimerCallback_t (parameter : void*) : void
144
    }
145
  
146
    /' OS timer interface. '/
147
    class urt_osTimer_t <<(T,lightblue)>> {
148
        'Initializes an urt_osTimer_t object.
149
      + urtTimerInit (timer : urt_osTimer_t*) : void
150
        'Sets the timer to a specified delay with specified callback and arguments.
151
      + urtTimerSet (timer : urt_osTimer_t*, delay : urt_delay_t, callback : urt_osTimerCallback_t*, parameter : void*) : urt_status_t
152
        'Resets the timer.
153
      + urtTimerReset (timer : urt_osTimer_t*) : urt_status_t
154
        'Check whether the timer is already armed.
155
      + urtTimerIsArmed (timer : urt_osTimer_t*) : bool
156
    }
157
    urt_osTimer_t ..> urt_delay_t
158
    urt_osTimer_t ..> urt_status_t
159
    urt_osTimer_t ..> urt_osTimerCallback_t
160

    
161
  } /' package "timer" '/
162

    
163
  package "thread" {
164

    
165
    /' Thread priority type. '/
166
    class urt_osThreadPrio_t <<(T,lightblue)>> {
167
      'Minimum priority for low priority threads.
168
      + URT_THREAD_PRIO_LOW_MIN
169
        'Maximum priority for low priority threads.
170
      + URT_THREAD_PRIO_LOW_MAX
171
        'Minimum priority for normal priority threads.
172
      + URT_THREAD_PRIO_NORMAL_MIN
173
        'Maximum priority for normal priority threads.
174
      + URT_THREAD_PRIO_NORMAL_MAX
175
        'Minimum priority for high priority threads.
176
      + URT_THREAD_PRIO_HIGH_MIN
177
        'Maximum priority for high priority threads.
178
      + URT_THREAD_PRIO_HIGH_MAX
179
        'Minimum priority for real-time threads.
180
      + URT_THREAD_PRIO_RT_MIN
181
        'Maximum priority for real-time threads.
182
      + URT_THREAD_PRIO_RT_MAX
183
    }
184

    
185
    /' Thread main function type. '/
186
    class urt_osThreadFunction_t <<(T,lightblue)>> {
187
      urt_osThreadFunction_t (arg : void*) : void
188
    }
189

    
190
    /' Thread terminate signals. '/
191
    enum urt_osThreadTerminateSignal_t {
192
      'Signal to request termination asap.
193
      URT_THREAD_TERMINATE_REQUEST = 15
194
      'Signal to kill a thread immediately.
195
      URT_THREAD_TERMINATE_KILL = 9
196
    }
197

    
198
    /' Thread execution states. '/
199
    enum urt_osThreadState_t {
200
      'Thread is currently being executed.
201
      URT_THREAD_STATE_RUNNING = 0
202
      'Thread is ready but waiting to be scheduled.
203
      URT_THREAD_STATE_READY = 1
204
      'Thread is actively sleeping.
205
      URT_THREAD_STATE_SLEEPING = 2
206
      'Thread has ben suspended explicitely.
207
      URT_THREAD_STATE_SUSPENDED = 3
208
      'Thread is waiting for something (e.g. Mutex, event, etc.).
209
      URT_THREAD_STATE_WAITING = 4
210
      'Thread has terminated.
211
      URT_THREAD_STATE_TERMINATED = 5
212
    }
213

    
214
    /' OS thread interface. '/
215
    class urt_osThread_t <<(T,lightblue)>> {
216
        'Maximum sleep interval in seconds (as float).
217
      + URT_THREAD_SLEEP_MAX : float
218
        'Maximum sleep interval in seconds.
219
      + URT_THREAD_SSLEP_MAX : unsigned int
220
        'Maximum sleep interval in milliseconds.
221
      + URT_THREAD_MSLEEP_MAX : unsigned int
222
        'Maximum sleep interval in microseconds.
223
      + URT_THREAD_USLEEP_MAX : unisgned int
224
      __
225
        'Macro to setup working area as static variable (handles alignment if required).
226
      + URT_THREAD_MEMORY (varname, stacksize)
227
      ..
228
        'Initializes an urt_osThread_t object.
229
      + urtThreadInit (memory : void*, size : size_t, func : urt_osThreadFunction_t*) : urt_osThread_t*
230
        'Starts a thread.
231
      + urtThreadStart (thread : urt_osThread_t*, prio : urt_osThreadPrio_t, arg : void*) : void
232
        'The calling threads yields.
233
      + urtThreadYield (void) : void
234
        'Retrieves the priority of the calling thread.
235
      + urtThreadGetPriority (void) : urt_osThreadPrio_t
236
        'Sets the priority of the calling thread.
237
      + urtThreadSetPriority (prio : urt_osThreadPrio_t) : void
238
        'Suspends a thread so it will no longer be executed.
239
      + urtThreadSuspend (thread : urt_osThread_t*) : void
240
        'Wakes a suspended thread.
241
      + urtThreadResume (thread : urt_osThread_t*) : urt_status_t
242
        'Suspends the calling thread for the specified time.
243
      + urtThreadSleep (seconds : float) : void
244
        'Suspends the calling thread for the specified time.
245
      + urtThreadSSleep (seconds : usnigned int) : void
246
        'Suspends the calling thread for the specified time.
247
      + urtThreadMSleep (milliseconds : unsigned int) : void
248
        'Suspends the calling thread for the specified time.
249
      + urtThreadUSleep (microseconds : unsigned int) : void
250
        'Suspends the calling thread until the specified time.
251
      + urtThreadSleepUntil (time : urt_osTime_t) : void
252
        'The calling thread exits execution (terminates).
253
      + urtThreadExit (void) : void
254
        'Terminates a specified thread.
255
      + urtThreadTerminate (thread : urt_osThread_t*, sig : urt_osThreadTerminateSignal_t) : void
256
        'Waits until the specified thread terminates.
257
      + urtThreadJoin (thread : urt_osThread_t*) : int
258
        'Retrieves the execution state of the specified thread.
259
      + urtThreadGetState (thread : urt_osThread_t*) : urt_osThreadState_t
260
        'Retrieves the calling thread itself.
261
      + urtThreadGetSelf (void) : urt_osThread_t*
262
        'Retrieves the first child of a thread (or ""NULL"").
263
      + urtThreadGetChildren (thread : urt_osThread_t*) : urt_osThread_t*
264
        'Retrieves a sibling (next child in a list) of the thread or ""NULL"".
265
      + urtThreadGetSibling (thread : urt_osThread_t*) : urt_osThread_t*
266
        'Retrieves the parent thread.
267
      + urtThreadGetParent (thread : urt_osThread_t) : urt_osThread_t*
268
    }
269
    urt_osThread_t ..> urt_osThreadPrio_t
270
    urt_osThread_t ..> urt_osThreadFunction_t
271
    urt_osThread_t ..> urt_osTime_t
272
    urt_osThread_t ..> urt_osThreadTerminateSignal_t
273
    urt_osThread_t ..> urt_osThreadState_t
274
    urt_osThread_t ..> urt_status_t
275

    
276
  } /' package "thread" '/
277

    
278
  package "events" {
279

    
280
    /' OS event mask type. '/
281
    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

    
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 (mask : urt_osEventMask_t, 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
  /' 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
} /' package "interfaces" '/
342

    
343
package "middleware" {
344

    
345
  /' Just a function for debugging. '/
346
  class urt_debug <<(F,white)>> {
347
      'Checks the condition in debug mode.
348
    + urtDebugAssert(condition : bool) : void
349
  }
350
  urt_debug ..> urt_config
351

    
352
  package "real-time class" {
353

    
354
    /' The top level RT class structure. '/
355
    class urt_rtclass_t <<(S,lightgrey)>> {
356
        'The actual RT class.
357
      + class : urt_rtclasstype_t
358
        'Parameters of the RT class.
359
      + params : urt_rtclassparams_t
360
    }
361
    urt_rtclass_t "1" *-- "1" urt_rtclasstype_t
362
    urt_rtclass_t "1" *-- "1" urt_rtclassparams_t
363

    
364
    /' Descriptor to distinguish the four RT classes. '/
365
    enum urt_rtclasstype_t {
366
      'Hard real-time.
367
      URT_RTCLASS_HARD = 0
368
      'Firm real-time.
369
      URT_RTCLASS_FIRM = 1
370
      'Soft real-time.
371
      URT_RTCLASS_SOFT = 2
372
      'No real-time at all.
373
      URT_RTCLASS_NONE = 3
374
    }
375

    
376
    /' Union structure, holding RT class parameters. '/
377
    class urt_rtclassparams_t <<(U,lightgreen)>> {
378
        'Parameters for hard real-time.
379
      + hrt : urt_hrtparams_t
380
        'Parameters for firm real-time.
381
      + frt : urt_frtparams_t
382
        'Parameters for soft real-time.
383
      + srt : urt_srtparans_t
384
        'Parameters for non-real-time.
385
      + nrt : urt_nrtparams_t
386
    }
387
    urt_rtclassparams_t "1" *-- "0..1" urt_hrtparams_t
388
    urt_rtclassparams_t "1" *-- "0..1" urt_frtparams_t
389
    urt_rtclassparams_t "1" *-- "0..1" urt_srtparams_t
390
    urt_rtclassparams_t "1" *-- "0..1" urt_nrtparams_t
391

    
392
    /' Parameters for hard real-time. '/
393
    class urt_hrtparams_t <<(S,lightgrey)>> {
394
        'Maximum temporal offset between creation and consumption of messages.
395
      + deadlineOffset : urt_delay_t
396
        'Expected rate at which data is published.
397
      + expectedRate : urt_delay_t
398
        'QoS timer to detected missed deadlines.
399
      + qosTimer : urt_osTimer_t
400
    }
401
    urt_hrtparams_t ..> urt_delay_t
402
    urt_hrtparams_t "1" *-- "1" urt_osTimer_t
403

    
404
    /' Parameters for firm real-time. '/
405
    class urt_frtparams_t <<(S,lightgrey)>> {
406
        'Maximum temporal offset between creation and consumption of messages.
407
      + deadlineOffset : urt_delay_t
408
        'Expected rate at which data is published.
409
      + expectedRate : urt_delay_t
410
        'QoS Timer to detect missed deadlines.
411
      + qosTimer : urt_osTimer_t
412
        'Callback function for the QoS timer.
413
      + callback : urt_osTimerCallback_t
414
        'Parameters for the callback function.
415
      + cbparams : void*
416
    }
417
    urt_frtparams_t ..> urt_delay_t
418
    urt_frtparams_t "1" *-- "1" urt_osTimer_t
419
    urt_frtparams_t "1" *-- "1" urt_osTimerCallback_t
420

    
421
    /' Parameters for soft real-time. '/
422
    class urt_srtparams_t <<(S,lightgrey)>> {
423
        'Callback function to calculate usefulness given a dleay.
424
      + *usefulness (dt : urt_delay_t, params : void*) : float
425
        'Optional parameters for the callback function.
426
      + params : void*
427
    }
428
    urt_srtparams_t ..> urt_delay_t
429

    
430
    /' Parameters for non-real-time. '/
431
    class urt_nrtparams_t <<(S,lightgrey)>> {
432
      'There are nor parameters in this case.
433
    }
434

    
435
  } /' package "real-time class" '/
436

    
437

    
438

    
439
  /' Message type. '/
440
  class urt_message_t <<(S,lightgrey)>> {
441
      'Pointer to the next message in a list.
442
    + next : urt_message_t*
443
      'Pointer to some arbitrary (reusable) payload object.
444
    + payload : void*
445
      'Origin time of the message.
446
    + originTime : urt_osTime_t
447
      'Mutex lock for exclusive access.
448
    + lock : urt_osMutex_t
449
      'Counter of HRT subscribers that did not consume the message yet.
450
    + numHrtConsumersLeft : unsigned int
451
      'Condition variable to inform waiting publishers when the message is available again.
452
    + hrtConsumersLeft : urt_osCondvar_t
453
    -- evaluation data --
454
      'Counter of overall subscribers that did not consume the message yet.
455
    + numConsumersLeft : unsigned int
456
    __
457
      'Initializes a urt_message_t object.
458
    + urtMessageInit (message : urt_message_t*, payload : void*) : urt_status_t
459
  }
460
  urt_message_t "1" o-- "0..1" urt_message_t
461
  urt_message_t "1" *-- "1" urt_osTime_t
462
  urt_message_t "1" *-- "1" urt_osMutex_t
463
  urt_message_t "1" *-- "1" urt_osCondvar_t
464

    
465
  /' Subscriber type. '/
466
  class urt_subscriber_t <<(S,lightgrey)>> {
467
      'Pointer to the next subscriber in a list.
468
    + next : urt_subscriber_t*
469
      'Pointer to the topic, this subscriber subscribed to.
470
    + topic : urt_topic_t*
471
      'Event listener to notify the node about new messages.
472
    + evtListener : urt_osEventListener_t
473
      'Real-time class descriptor.
474
    + rtclass : urt_rtclass_t
475
      'Pointer to the message consumed most recently.
476
    + lastMessage : urt_message_t*
477
      'Copy of the origin time of the message consumed most recently.
478
    + lastMessageTime : urt_osTime_t
479
    -- evaluation data --
480
      'Minimum latency ever detected.
481
    + minLatency : urt_delay_t
482
      'Maximum latency ever detected.
483
    + maxLatency : urt_delay_t
484
      'Sum of all latencies.
485
    + sumLatencies : uint64_t
486
      'Number of messages received.
487
    + numMessagesReceived : unsigned int
488
    __
489
      'Initializes a urt_subscriber_t object.
490
    + urtSubscriberInit (subscriber : urt_subscriber_t*) : urt_status_t
491
      'Tries to subscribe to a topic and contributes an optional list of messages.
492
    + urtSubscriberSubscribe (subscriber : urt_subscriber_t*, topic : urt_topic_t*, rtclass : urt_rtclass_t*, messages : urt_messages_t*) : urt_status_t
493
      'Unsubscribes from a topic.
494
    + urtSubscriberUnsubscribe (subscriber : urt_subscriber_t*) : urt_status_t
495
      'Fetches either the next or the latest message and optionally copies the payload.
496
    + urtSubscriberFetchMessage (subscriber : urt_subscriber_t*, payload : void*, bytes : size_t, latest : bool) : urt_status_t
497
  }
498
  urt_subscriber_t "1" o-- "0..1" urt_subscriber_t
499
  urt_subscriber_t "1" o-- "0..1" urt_topic_t
500
  urt_subscriber_t "1" *-- "1" urt_osEventListener_t
501
  urt_subscriber_t "1" *-- "1" urt_rtclass_t
502
  urt_subscriber_t "1" o-- "0..1" urt_message_t
503
  urt_subscriber_t "1" *-- "1" urt_osTime_t
504
  urt_subscriber_t "1" *-- "2" urt_delay_t
505
  urt_subscriber_t ..> urt_status_t
506
  urt_subscriber_t ..> urt_topicid_t
507

    
508
  /' Publisher type. '/
509
  class urt_publisher_t <<(S,lightgrey)>> {
510
      'Pointer to the topic for publishing.
511
    + topic : urt_topic_t*
512
    -- evaluation data --
513
      'Counter of attempts to publish a message.
514
    + publishAttempts : unsigned int
515
      'Counter of failed attempts to publish a message.
516
    + publishFails : unsigned int
517
    __
518
      'Initializes a urt_publisher_t object and contributes an optional list of messages.
519
    + urtPublisherInit (publisher : urt_publisher_t*, topic : urt_topic_t*, messages : urt_message_t*) : urt_status_t
520
      'Publishes a message via the associated topic.
521
    + urtPublisherPublish (publisher : urt_publisher_t*, payload : void*, n : size_t, t : urt_osTime_t, timeout : urt_delay_t) : urt_status_t
522
  }
523
  urt_publisher_t "1" o-- "1" urt_topic_t
524
  urt_publisher_t ..> urt_message_t
525
  urt_publisher_t ..> urt_osTime_t
526
  urt_publisher_t ..> urt_delay_t
527
  urt_publisher_t ..> urt_status_t
528

    
529
  /' Topic type. '/
530
  class urt_topic_t <<(S,lightgrey)>> {
531
      'Pointer to the next topic in a list.
532
    + next : urt_topic_t*
533
      'Mutex lock for exclusive access.
534
    + lock : urt_osMutex_t
535
      'Event source to inform all subscribers when a new message is published.
536
    + evtSource : urt_osEventSource_t
537
      'Number of HRT subscribers.
538
    + numHrtSubscribers : unsigned int
539
      'List of HRT subscribers, orderd by their expected rate (most critical first).
540
    + hrtSubscribers : urt_subscriber_t*
541
      'Timer to check for missed rates.
542
    + qosTimer : urt_osTimer_t
543
      'Mandatory message, each Topic holds.
544
    + mandatoryMessage : urt_message_t
545
      'Pointer to the latest message.
546
    + latestMessage : urt_message_t*
547
      'Identifier of the topic.
548
    + id : urt_topicid_t
549
    -- evaluation data --
550
      'Variable to count how many (non-hrt) subscribers did not fetch a message before it was reused.
551
    + numDiscardedMessages : unsigned int
552
      'Number of overall subscribers.
553
    + numSubscribers : unsigned int
554
    __
555
      'Initializes an urt_topic_t object.
556
    + urtTopicInit (topic : urt_topic_t*, id : urt_topicid_t) : urt_status_t
557
  }
558
  urt_topic_t "1" o-- "0..1" urt_topic_t
559
  urt_topic_t "1" *-- "1" urt_osMutex_t
560
  urt_topic_t "1" *-- "1" urt_osEventSource_t
561
  urt_topic_t "1" o-- "0..*" urt_subscriber_t
562
  urt_topic_t "1" *-- "1" urt_osTimer_t
563
  urt_topic_t "1" o-- "1..*" urt_message_t
564
  urt_topic_t "1" *-- "1" urt_message_t
565
  urt_topic_t "1" *-- "1" urt_topicid_t
566
  urt_topic_t ..> urt_osTime_t
567
  urt_topic_t ..> urt_status_t
568

    
569
  /' uRtWare core type. '/
570
  class urt_core_t <<(S,lightgrey)>> {
571
      'List of nodes ordered by their (initial) priority.
572
    - {static} _nodes : urt_node_t*
573
      'List of topics ordered by their identifiers.
574
    - {static} _topics : urt_topic_t*
575
      'Event source for control events.
576
    - {static} _evtSource : urt_osEventSource_t
577
      'Mutex used for synchronization.
578
    - {static} _lock : urt_osMutex_t
579
    __
580
      'Initializes the urt_core_t object.
581
    + urtCoreInit (void) : urt_status_t
582
      'Starts all node threads (nodes will block before the loop).
583
    + urtCoreStartNodes (void) : urt_status_t
584
      'Nodes can use this function to synchronize globally.
585
    + urtCoreSynchronizeNodes (node : urt_node_t*, stage : urt_nodestage_t) : urt_status_t
586
      'Stops all nodes.
587
    + urtCoreStopNodes (void) : urt_status_t
588
      'Retrieves a topic given an identifier.
589
    + urtCoreRetrieveTopic (id : urt_topicid_t) : urt_topic_t*
590
  }
591
  urt_core_t "1" o-- "0..*" urt_topic_t
592
  urt_core_t "1" o-- "0..*" urt_node_t
593
  urt_core_t "1" *-- "1" urt_osEventSource_t
594
  urt_core_t "1" *-- "1" urt_osMutex_t
595
  urt_core_t ..> urt_status_t
596
  urt_core_t --> urt_nodestage_t
597
  urt_core_t ..> urt_topicid_t
598

    
599
  package "node" {
600

    
601
    /' Function type to be called during setup phase of node threads. '/
602
    class urt_nodeSetupCallback_t <<(T,lightblue)>> {
603
      'Takes the node and optional parameters as arguments and returns a event mask for the next iteration.
604
      urt_nodeSetupCallback_t (node : urt_node_t*, arg : void*) : urt_osEventMask_t
605
    }
606
    urt_nodeSetupCallback_t ..> urt_node_t
607
    urt_nodeSetupCallback_t ..> urt_status_t
608

    
609
    /' Function type to be called during loop phase of node threads. '/
610
    class urt_nodeLoopCallback_t <<(T,lightblue)>> {
611
      'Takes the node, a mask of occurred events and optional parameters as arguments and returns a event mask for the next iteration.
612
      urt_nodeLoopCallback_t (node : urt_node_t*, events : urt_osEventMask_t, arg : void*) : urt_osEventMask_t
613
    }
614
    urt_nodeLoopCallback_t ..> urt_node_t
615
    urt_nodeLoopCallback_t ..> urt_osEventMask_t
616
    urt_nodeLoopCallback_t ..> urt_status_t
617

    
618
    /' Node type. '/
619
    class urt_node_t <<(S,lightgrey)>> {
620
        'Pointer to the next node in a list.
621
      + next : urt_node_t*
622
        'Pointer to the nore thread.
623
      + thread : urt_osThread_t*
624
        'Callback function to be called during the setup phase.
625
      + setupcallback : urt_nodeSetupCallback_t*
626
        'Optional parameters for the setup callback function.
627
      + setupparams : void*
628
        'Callback function to be called in each loop iteration.
629
      + loopcallback : urt_nodeLoopCallback_t*
630
        'Optional parameters for the loop callback function.
631
      + loopparams : void*
632
        'Execution stage of the node.
633
      + stage : urt_nodestage_t
634
        'Event listener for middleware-wide control events.
635
      + listener : urt_osEventListener_t
636
      __
637
      'The main() function of the node thread.
638
      - {static} _main : urt_osThreadFunction_t
639
        'Initializes an urt_node_t object.
640
      + urtNodeInit (node : urt_node_t*, stacksize : size_t, setupcallback : urt_nodeSetupCallback_t*, setupparams : void*, loopcallback : urt_nodeLoopCallback_t*, loopparams : void*) : urt_status_t
641
    }
642
    urt_node_t "1" o-- "0..1" urt_node_t
643
    urt_node_t "1" o-- "1" urt_osThread_t
644
    urt_node_t "1" o-- "1" urt_nodeSetupCallback_t
645
    urt_node_t "1" o-- "1" urt_nodeLoopCallback_t
646
    urt_node_t "1" *-- "1" urt_nodestage_t
647
    urt_node_t "1" *-- "1" urt_osEventMask_t
648
    urt_node_t "1" *-- "1" urt_osEventWaitType_t
649
    urt_node_t "1" *-- "1" urt_osEventListener_t
650
    urt_node_t ..> urt_osThreadTerminateSignal_t
651

    
652
  } /' package "node" '/
653

    
654
} /' package "middleware" '/
655

    
656
@enduml
657