Statistics
| Branch: | Revision:

urtware / inc / urt_node.h @ 03ed5026

History | View | Annotate | Download (4.119 KB)

1 1fb06240 skenneweg
/*
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_NODE_H
23
#define URTWARE_NODE_H
24
25 7d9678db skenneweg
#include <urtware.h>
26
27 1fb06240 skenneweg
/******************************************************************************/
28
/* CONSTANTS                                                                  */
29
/******************************************************************************/
30
31
/******************************************************************************/
32
/* SETTINGS                                                                   */
33
/******************************************************************************/
34
35
/******************************************************************************/
36
/* CHECKS                                                                     */
37
/******************************************************************************/
38
39
/******************************************************************************/
40
/* DATA STRUCTURES AND TYPES                                                  */
41
/******************************************************************************/
42
43 7d9678db skenneweg
/**
44 017b2ac7 skenneweg
 * @brief
45
 *
46
 * @param[in]   node   .
47
 * @param[in]   cause  .
48
 * @param[in]   arg    .
49
 *
50
 * @return    .
51
 *
52
 */
53 64fde4ba skenneweg
typedef void (*urt_nodeShutdownCallback_t)(struct urt_node* node, urt_status_t cause, void* arg);
54 017b2ac7 skenneweg
55
56
/**
57
 * @brief
58
 *
59
 * @param[in]   node  .
60
 * @param[in]   arg   .
61
 *
62
 * @return    .
63
 *
64
 */
65 64fde4ba skenneweg
typedef urt_osEventMask_t (*urt_nodeSetupCallback_t)(struct urt_node* node, void* arg);
66 017b2ac7 skenneweg
67
68
/**
69
 * @brief
70
 *
71
 * @param[in]   node  .
72
 * @param[in]   events    .
73
 * @param[in]   arg    .
74
 *
75
 * @return    .
76
 */
77 64fde4ba skenneweg
typedef urt_osEventMask_t (*urt_nodeLoopCallback_t)(struct urt_node* node, urt_osEventMask_t events, void* arg);
78
79
/**
80
 * @brief  node
81
 */
82
typedef struct urt_node
83
{
84
  struct urt_node* next;
85
  urt_osThread_t* thread;
86
  urt_nodeSetupCallback_t* setupcallback;
87
  void* setupparams;
88
  urt_nodeLoopCallback_t* loopcallback;
89
  void* loopparams;
90
  urt_nodeShutdownCallback_t* shutdowncallback;
91
  void* shutdownparams;
92
  urt_nodestage_t stage;
93
  urt_osEventListener_t listener;
94
  #if (URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING)
95
    uint64_t loops;
96
  #endif /* URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING */
97
}urt_node_t;
98
99 017b2ac7 skenneweg
100 1fb06240 skenneweg
/******************************************************************************/
101
/* MACROS                                                                     */
102
/******************************************************************************/
103
104
/******************************************************************************/
105
/* EXTERN DECLARATIONS                                                        */
106
/******************************************************************************/
107
108 7d9678db skenneweg
#if defined(__cplusplus)
109
extern "C" {
110
#endif /* defined(__cplusplus) */
111
112 cd21e832 skenneweg
  void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_nodeSetupCallback_t* setupcallback, void* setupparams, urt_nodeLoopCallback_t* loopcallback, void* loopparams, urt_nodeShutdownCallback_t* shutdowncallback, void* shutodwnparams);
113 7d9678db skenneweg
#if defined(__cplusplus)
114
}
115
#endif /* defined(__cplusplus) */
116
117 1fb06240 skenneweg
/******************************************************************************/
118
/* INLINE FUNCTIONS                                                           */
119
/******************************************************************************/
120
121
#endif /* URTWARE_NODE_H */