KM3NeT CLB
2.0
KM3NeT CLB v2 Embedded Software
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
list.h
Go to the documentation of this file.
1
/*
2
* KM3NeT CLB v2 Firmware
3
* ----------------------
4
*
5
* Copyright 2012-2014 KM3NeT Collaboration
6
*
7
* All Rights Reserved.
8
*
9
*
10
* File : list.h
11
* Created : 7 jul. 2014
12
* Author : Vincent van Beveren
13
*/
14
15
#ifndef LIST_H_
16
#define LIST_H_
17
18
/**
19
* @file
20
*
21
* @ingroup collections
22
*
23
* A list type.
24
*/
25
26
/*!
27
* \brief List
28
*
29
* Describes a list.
30
*/
31
typedef
struct
{
32
void
*
const
memory
;
//!< first element pointer
33
const
uint16_t
capacity
;
//!< capacity in entries
34
const
uint16_t
entrySize
;
//!< size of an entry
35
uint16_t
length
;
//!< length of the list in entries
36
}
List
;
37
38
39
/*!
40
* \brief Convenience Macro, defines and inits list.
41
*
42
* Example of how to use it:
43
*
44
* \code
45
* L_INIT(myList, sizeof(MyStruct), 100);
46
*
47
* \endcode
48
*
49
* Must be used outside of any function scope.
50
*
51
* \param NAME Name of the list pointer.
52
* \param ENTRY_SIZE Size in bytes of one element (use sizeof()).
53
* \param CAPACITY Maximum number of elements in list.
54
*/
55
#define L_INIT(NAME, ENTRY_SIZE, CAPACITY) \
56
static uint8_t NAME ## Mem[ ( ENTRY_SIZE ) * ( CAPACITY ) ]; \
57
static const List NAME = { \
58
.memory = NAME ## Mem, \
59
.capacity = CAPACITY, \
60
.length = 0, \
61
};
62
63
64
65
#endif
/* LIST_H_ */
List::length
uint16_t length
length of the list in entries
Definition:
list.h:35
List::capacity
const uint16_t capacity
capacity in entries
Definition:
list.h:33
List::memory
void *const memory
first element pointer
Definition:
list.h:32
List::entrySize
const uint16_t entrySize
size of an entry
Definition:
list.h:34
List
List.
Definition:
list.h:31
src
common
coll
list.h
Generated on Mon Aug 3 2020 13:49:49 for KM3NeT CLB by
1.8.5