2 * Copyright (C) 2021 Tobias Brunner
3 * Copyright (C) 2021 Thomas Egerer
5 * Copyright (C) secunet Security Networks AG
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * @defgroup metadata_factory metadata_factory
20 * @{ @ingroup metadata
23 #ifndef METADATA_FACTORY_H_
24 #define METADATA_FACTORY_H_
28 typedef struct metadata_factory_t metadata_factory_t
;
31 * Create a factory for dealing with metadata objects.
33 struct metadata_factory_t
{
36 * Create a metadata object of the given type.
38 * @param type type of the desired metadata object
39 * @param ... data to wrap into the metadata object
40 * @return metadata handler on success, NULL otherwise
42 metadata_t
*(*create
)(metadata_factory_t
*this, const char *type
, ...);
45 * Register a constructor for a given type.
47 * @param type type to register
48 * @param create metadata constructor
50 void (*register_type
)(metadata_factory_t
*this, const char *type
,
51 metadata_create_t create
);
54 * Destroy a metadata_factory_t instance.
56 void (*destroy
)(metadata_factory_t
*this);
60 * Create a metadata_factory_t instance.
62 metadata_factory_t
*metadata_factory_create();
64 #endif /** METADATA_FACTORY_H_ @}*/