urtware / inc / urt_topic.h @ 8378a78b
History | View | Annotate | Download (3.453 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 |
#ifndef URTWARE_TOPIC_H
|
23 |
#define URTWARE_TOPIC_H
|
24 |
|
25 |
#include <urtware.h> |
26 |
|
27 |
/******************************************************************************/
|
28 |
/* CONSTANTS */
|
29 |
/******************************************************************************/
|
30 |
|
31 |
/******************************************************************************/
|
32 |
/* SETTINGS */
|
33 |
/******************************************************************************/
|
34 |
|
35 |
/******************************************************************************/
|
36 |
/* CHECKS */
|
37 |
/******************************************************************************/
|
38 |
|
39 |
/******************************************************************************/
|
40 |
/* DATA STRUCTURES AND TYPES */
|
41 |
/******************************************************************************/
|
42 |
|
43 |
/**
|
44 |
* @brief topic
|
45 |
*/
|
46 |
typedef struct urt_topic |
47 |
{ |
48 |
struct urt_topic* next;
|
49 |
urt_topicid_t id; |
50 |
urt_osMutex_t lock; |
51 |
urt_osEventSource_t evtSource; |
52 |
unsigned int numHrtSubscribers; |
53 |
urt_osCondvar_t hrtReleased; |
54 |
urt_message_t mandatoryMessage; |
55 |
urt_message_t* latestMessage; |
56 |
#if (URT_CFG_PUBSUB_QOS_RATECHECKS)
|
57 |
struct urt_hrtsubscriber* hrtSubscribers;
|
58 |
urt_osTimer_t qosRateTimer; |
59 |
#endif /* URT_CFG_PUBSUB_QOS_RATECHECKS */ |
60 |
#if (URT_CFG_PUBSUB_PROFILING)
|
61 |
uint64_t numMessagesPublished; |
62 |
uint64_t numMessagesDiscarded; |
63 |
unsigned int numSubscribers; |
64 |
#endif /* URT_CFG_PUBSUB_PROFILING */ |
65 |
}urt_topic_t; |
66 |
|
67 |
/******************************************************************************/
|
68 |
/* MACROS */
|
69 |
/******************************************************************************/
|
70 |
|
71 |
/******************************************************************************/
|
72 |
/* EXTERN DECLARATIONS */
|
73 |
/******************************************************************************/
|
74 |
|
75 |
#if defined(__cplusplus)
|
76 |
extern "C" { |
77 |
#endif /* defined(__cplusplus) */ |
78 |
|
79 |
urt_status_t urtTopicInit(urt_topic_t* topic, urt_topicid_t id); |
80 |
#if defined(__cplusplus)
|
81 |
} |
82 |
#endif /* defined(__cplusplus) */ |
83 |
|
84 |
/******************************************************************************/
|
85 |
/* INLINE FUNCTIONS */
|
86 |
/******************************************************************************/
|
87 |
|
88 |
#endif /* URTWARE_TOPIC_H */ |