/*
µRtWare is a lightweight publish/subscribe middleware for real-time
applications. It was developed as part of the software habitat for the
Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well.
Copyright (C) 2018..2020 Thomas Schöpping et al.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#ifndef URTWARE_TOPIC_H
#define URTWARE_TOPIC_H
#include
/******************************************************************************/
/* CONSTANTS */
/******************************************************************************/
/******************************************************************************/
/* SETTINGS */
/******************************************************************************/
/******************************************************************************/
/* CHECKS */
/******************************************************************************/
/******************************************************************************/
/* DATA STRUCTURES AND TYPES */
/******************************************************************************/
/**
* @brief topic
*/
typedef struct urt_topic
{
struct urt_topic* next;
urt_topicid_t id;
urt_osMutex_t lock;
urt_osEventSource_t evtSource;
unsigned int numHrtSubscribers;
urt_osCondvar_t hrtReleased;
urt_message_t mandatoryMessage;
urt_message_t* latestMessage;
#if (URT_CFG_PUBSUB_QOS_RATECHECKS)
struct urt_hrtsubscriber* hrtSubscribers;
urt_osTimer_t qosRateTimer;
#endif /* URT_CFG_PUBSUB_QOS_RATECHECKS */
#if (URT_CFG_PUBSUB_PROFILING)
uint64_t numMessagesPublished;
uint64_t numMessagesDiscarded;
unsigned int numSubscribers;
#endif /* URT_CFG_PUBSUB_PROFILING */
}urt_topic_t;
/******************************************************************************/
/* MACROS */
/******************************************************************************/
/******************************************************************************/
/* EXTERN DECLARATIONS */
/******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif /* defined(__cplusplus) */
urt_status_t urtTopicInit(urt_topic_t* topic, urt_topicid_t id, urt_message_t* mandatoryMessage);
#if defined(__cplusplus)
}
#endif /* defined(__cplusplus) */
/******************************************************************************/
/* INLINE FUNCTIONS */
/******************************************************************************/
#endif /* URTWARE_TOPIC_H */