Open SCAP Library
err_queue.h
1 /*
2  * Copyright 2013 Red Hat Inc., Durham, North Carolina.
3  * All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  */
20 
21 #pragma once
22 #ifndef _OSCAP_ERR_QUEUE_H
23 #define _OSCAP_ERR_QUEUE_H
24 
25 #include "util.h"
26 #include "_error.h"
27 #include <stdbool.h>
28 
29 
35 struct err_queue;
36 
42 struct err_queue *err_queue_new(void);
43 
51 bool err_queue_push(struct err_queue *q, struct oscap_err_t *error);
52 
59 bool err_queue_is_empty(struct err_queue *q);
60 
68 struct oscap_err_t *err_queue_pop_first(struct err_queue *q);
69 
77 const struct oscap_err_t *err_queue_get_last(struct err_queue *q);
78 
86 void err_queue_free(struct err_queue *q, oscap_destruct_func destructor);
87 
97 int err_queue_to_string(struct err_queue *q, char **result);
98 
99 
100 #endif
struct err_queue * err_queue_new(void)
Initialize new error_queue.
Definition: err_queue.c:35
int err_queue_to_string(struct err_queue *q, char **result)
Get all the errors in the queue as a single string.
Definition: err_queue.c:102
const struct oscap_err_t * err_queue_get_last(struct err_queue *q)
Return the last object from the FIFO queuqe.
Definition: err_queue.c:82
bool err_queue_push(struct err_queue *q, struct oscap_err_t *error)
Push the new error at the end of the error queue.
Definition: err_queue.c:40
struct oscap_err_t * err_queue_pop_first(struct err_queue *q)
Pop the first object from the FIFO queue.
Definition: err_queue.c:68
void err_queue_free(struct err_queue *q, oscap_destruct_func destructor)
Dispose given err_queue.
Definition: err_queue.c:91
Definition: _error.h:40
Definition: err_queue.c:30