syslog-ng source
persistable-state-presenter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2013 Balabit
3  * Copyright (c) 2013 Viktor Juhasz
4  * Copyright (c) 2013 Viktor Tusa
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  * As an additional exemption you are allowed to compile & link against the
21  * OpenSSL libraries as published by the OpenSSL project. See the file
22  * COPYING for details.
23  *
24  */
25 #ifndef PERSISTABLE_STATE_PRESENTER_H_INCLUDED
26 #define PERSISTABLE_STATE_PRESENTER_H_INCLUDED
27 
28 #include "syslog-ng.h"
29 #include "persist-state.h"
32 
34 {
35  gboolean (*dump)(PersistableStateHeader *state, PresentedPersistableState *representation);
36  gboolean (*load)(PersistableStateHeader *state, PresentedPersistableState *representation);
37  PersistEntryHandle (*alloc)(PersistState *state, const gchar *name);
38 };
39 
40 typedef struct _PersistableStatePresenter PersistableStatePresenter;
41 
42 static inline gboolean
43 persistable_state_presenter_load(PersistableStatePresenter *self, PersistableStateHeader *state,
44  PresentedPersistableState *representation)
45 {
46  g_assert(self->load != NULL);
47  return self->load(state, representation);
48 }
49 
50 static inline gboolean
51 persistable_state_presenter_dump(PersistableStatePresenter *self, PersistableStateHeader *state,
52  PresentedPersistableState *representation)
53 {
54  g_assert(self->dump != NULL);
55  return self->dump(state, representation);
56 }
57 
58 static inline PersistEntryHandle
59 persistable_state_presenter_alloc(PersistableStatePresenter *self, PersistState *state, const gchar *name)
60 {
61  g_assert(self->alloc != NULL);
62  return self->alloc(state, name);
63 }
64 
65 typedef PersistableStatePresenter *(*PersistableStatePresenterConstructFunc)(const gchar *name);
66 
70 
71 #endif
const gchar * name
Definition: debugger.c:265
guint32 PersistEntryHandle
Definition: persist-state.h:53
PersistableStatePresenter *(* PersistableStatePresenterConstructFunc)(const gchar *name)
Definition: persistable-state-presenter.h:65
PersistableStatePresenterConstructFunc persistable_state_presenter_get_constructor_by_prefix(const gchar *prefix)
Definition: persistable-state-presenter.c:32
void persistable_state_presenter_register_constructor(const gchar *prefix, PersistableStatePresenterConstructFunc handler)
Definition: persistable-state-presenter.c:43
#define self
Definition: rcptid.c:38
Definition: persistable-state-header.h:31
Definition: persistable-state-presenter.h:34
PersistEntryHandle(* alloc)(PersistState *state, const gchar *name)
Definition: persistable-state-presenter.h:37
gboolean(* dump)(PersistableStateHeader *state, PresentedPersistableState *representation)
Definition: persistable-state-presenter.h:35
gboolean(* load)(PersistableStateHeader *state, PresentedPersistableState *representation)
Definition: persistable-state-presenter.h:36
struct @95 state