2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2019-09-09 14:32:34 +02:00
|
|
|
|
|
|
|
/** \file
|
|
|
|
* \ingroup DNA
|
|
|
|
*
|
|
|
|
* \see dna_defaults.c for details on how to use this system.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-03-06 16:45:06 +01:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2020-05-08 18:16:39 +02:00
|
|
|
#include "dna_type_offsets.h"
|
|
|
|
|
2020-03-17 14:41:48 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-09-09 14:32:34 +02:00
|
|
|
extern const void *DNA_default_table[SDNA_TYPE_MAX];
|
|
|
|
|
2021-12-01 12:16:44 +01:00
|
|
|
uint8_t *_DNA_struct_default_alloc_impl(const uint8_t *data_src,
|
|
|
|
size_t size,
|
|
|
|
const char *alloc_str);
|
2019-09-09 14:32:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wrap with macro that casts correctly.
|
|
|
|
*/
|
|
|
|
#define DNA_struct_default_get(struct_name) \
|
|
|
|
(const struct_name *)DNA_default_table[SDNA_TYPE_FROM_STRUCT(struct_name)]
|
|
|
|
|
|
|
|
#define DNA_struct_default_alloc(struct_name) \
|
|
|
|
(struct_name *)_DNA_struct_default_alloc_impl( \
|
2022-01-12 18:02:08 +01:00
|
|
|
(const uint8_t *)DNA_default_table[SDNA_TYPE_FROM_STRUCT(struct_name)], \
|
|
|
|
sizeof(struct_name), \
|
|
|
|
__func__)
|
2019-09-09 14:32:34 +02:00
|
|
|
|
2020-03-17 14:41:48 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|