Loading [MathJax]/extensions/TeX/AMSsymbols.js
LAL 7.7.0.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALBitset.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Karl Wette
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with with program; see the file COPYING. If not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19
20#ifndef _LALBITSET_H
21#define _LALBITSET_H
22
23#include <lal/LALStdlib.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/**
30 * \defgroup LALBitset_h Header LALBitset.h
31 * \ingroup lal_utilities
32 * \author Karl Wette
33 * \brief Implementation of an arbitrary-size bitset
34 */
35/** @{ */
36
37/**
38 * Arbitrary-size bitset
39 */
40typedef struct tagLALBitset LALBitset;
41
42/**
43 * Create a bitset
44 */
45LALBitset *XLALBitsetCreate(
46 void
47 );
48
49/**
50 * Destroy a bitset and its elements
51 */
53 LALBitset *bs /**< [in] Pointer to bitset */
54 );
55
56/**
57 * Clear a bitset
58 */
60 LALBitset *bs /**< [in] Pointer to bitset */
61 );
62
63/**
64 * Set/unset a bit in the bitset
65 */
67 LALBitset *bs, /**< [in] Pointer to bitset */
68 const UINT8 idx, /**< [in] Index of bit in set */
69 const BOOLEAN is_set /**< [in] Whether bit is set */
70 );
71
72/**
73 * Get whether a bit in the bitset is set
74 */
76 const LALBitset *bs, /**< [in] Pointer to bitset */
77 const UINT8 idx, /**< [in] Index of bit in set */
78 BOOLEAN *is_set /**< [out] Whether bit is set */
79 );
80
81/** @} */
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif // _LALBITSET_H
LALBitset * XLALBitsetCreate(void)
Create a bitset.
Definition: LALBitset.c:51
int XLALBitsetClear(LALBitset *bs)
Clear a bitset.
Definition: LALBitset.c:78
void XLALBitsetDestroy(LALBitset *bs)
Destroy a bitset and its elements.
Definition: LALBitset.c:68
int XLALBitsetGet(const LALBitset *bs, const UINT8 idx, BOOLEAN *is_set)
Get whether a bit in the bitset is set.
Definition: LALBitset.c:131
int XLALBitsetSet(LALBitset *bs, const UINT8 idx, const BOOLEAN is_set)
Set/unset a bit in the bitset.
Definition: LALBitset.c:93
unsigned char BOOLEAN
Boolean logical type, see Headers LAL(Atomic)Datatypes.h for more details.
uint64_t UINT8
Eight-byte unsigned integer; on some platforms this is equivalent to unsigned long int instead.
Arbitrary-size bitset.
Definition: LALBitset.c:27