rnsf

Define and load a phase function data format
git clone git://git.meso-star.fr/rnsf.git
Log | Files | Refs | README | LICENSE

commit b8b6a3cb74cc201ff11c80cbef0ac934a7d5ea80
parent 7a6dad387f5df59b6b018931aa424a830d1d5546
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 20 Jun 2022 14:57:15 +0200

Write the public API

Diffstat:
Asrc/rnsf.h | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 103 insertions(+), 0 deletions(-)

diff --git a/src/rnsf.h b/src/rnsf.h @@ -0,0 +1,103 @@ +/* Copyright (C) 2022 GSMA - Université de Reims Champgne-Ardenne, CNRS + * Copyright (C) 2022 IPGP, Université Paris Cité, CNRS + * Copyright (C) 2022 LAPLACE - Université de Toulouse, CNRS, INPT, UPS + * Copyright (C) 2022 LATMOS/IPSL - UVSQ, Université Paris-Saclay, + * Sorbonne Université, CNRS + * Copyright (C) 2022 LESIA - Observatoire de Paris, Université PSL, + * Sorbonne Université, Université Paris Cité + * Copyright (C) 2022 LMD/IPSL - Sorbonne Université, Université PSL, + * Ecole Polytechnique, Institut Polytechnique de Paris, + * CNRS + * Copyright (C) 2022 |Meso|Star> (contact@meso-star.com) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef RNSF_H +#define RNSF_H + +#include <rsys/rsys.h> + +/* Library symbol management */ +#if defined(RNSF_SHARED_BUILD) /* Build shared library */ + #define RNSF_API extern EXPORT_SYM +#elif defined(RNSF_STATIC) /* Use/build static library */ + #define RNSF_API extern LOCAL_SYM +#else /* Use shared library */ + #define RNSF_API extern IMPORT_SYM +#endif + +/* Helper macro that asserts if the invocation of the htcp function `Func' + * returns an error. One should use this macro on htcp function calls for + * which no explicit error checking is performed */ +#ifndef NDEBUG + #define RNSF(Func) ASSERT(rnsf_ ## Func == RES_OK) +#else + #define RNSF(Func) rnsf_ ## Func +#endif + +/* Forward declaration of external data types */ +struct logger; +struct mem_allocator; + +enum rnsf_phase_fn_type { + RNSF_PHASE_FN_HG, + RNSF_PHASE_FN_DISCRETE, + RNSF_PHASE_FN_NONE__ +}; + +struct rnsf_create_args { + struct logger* logger; /* NULL <=> use default logger */ + struct mem_allocator* allocator; /* NULL <=> use default allocator */ + int verbose; /* Verbosity level */ +}; +#define RNSF_CREATE_ARGS_DEFAULT__ {NULL, NULL, 0} +static const struct rnsf_create_args RNSF_CREATE_ARGS_DEFAULT = + RNSF_CREATE_ARGS_DEFAULT__; + +/* Opaque data types */ +struct rnsf; + +BEGIN_DECLS + +/******************************************************************************* + * Rad-Net Scattering Functions API + ******************************************************************************/ +RNSF_API res_T +rnsf_create + (const struct rnsf_create_args* args, + struct rnsf** rnsf); + +RNSF_API res_T +rnsf_ref_get + (struct rnsf* rnsf); + +RNSF_API res_T +rnsf_ref_put + (struct rnsf* rnsf); + +RNSF_API res_T +rnsf_load + (struct rnsf* rnsf, + const char* path); + +RNSF_API res_T +rnsf_load_stream + (struct rnsf* rnsf, + FILE* stream, + const char* stream_name); /* May be NULL */ + +END_DECLS + +#endif /* RNSF_H */ +