queue.h
3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* \file scot/queue.h
* \author Georg Steffers <georg@steffers.org>
* \brief Macro which produce all prototypes and implementations for
* handling queues based on linked lists by Templates.
*
* This is the toplevel template file for queues based on typesafe lists.
* It is quite simple. It just defines one MACRO which in turn calls two
* other macros to generate all that is needed for queue-handling of a queue
* to a given type.
*
* Copyright (C)2006 Georg Steffers <georg@steffers.org>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef QUEUE_H
#define QUEUE_H
#include <scot/queue_proto.h>
#include <scot/queue_impl.h>
/**
* \param type the datatype that this list code should handle.
* \pre Type must be a single word typename. If one wants
* to use e.g. lists of structs one has to use typedef
* to create a single word type name like this:
* typedef struct mystruct_t mystruct_t;
* GEN_LIST(type) has to be called for the list functions,
* as queues depend on these.
* \return Nothing
* \post The complete framework of functions, types, globals
* prototypes and definitions to handle queues based on
* typesave
* lists for the given datatype are generated within the
* calling build file.
*
* \brief create complete framework to handle queues based on typesafe lists.
*
* This macro first colls GEN_QUEUE_PROTO() to create all prototypes
* neccesary for handling queues of the given \a type. And then it calls
* GEN_QUEUE_IMPL() to also create the neccesary definitions and
* implementations.\
* Normally this macro is only called if one only wants to have queues
* of the given type in a single c source file and nowhere else. Normally
* this is then used in conjunction with a previous define of GEN_LOCAL,
* that tells GEN_QUEUE() and the subsequent macros to generate the functions
* as static.\n
* If one wants to used queues of the given type in several places of the
* project one would normally call GEN_QUEUE_PROTO() in a h file and
* GEN_QUEUE_IMPL() in the c file that does the implementation of that
* h file (without GEN_LOCAL).
*/
#define GEN_QUEUE(type) \
GEN_QUEUE_PROTO (type) \
GEN_QUEUE_IMPL (type)
#endif /* QUEUE_H */