xref: /honee/include/honee.h (revision c0d10d1ddfa51fc3c0a8079706784eb95f3ed88f)
1 // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2 // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3 #pragma once
4 #include <ceed.h>
5 #include <petscdm.h>
6 #include <petscsection.h>
7 #include <petscts.h>
8 #include <stdbool.h>
9 typedef struct Honee_private *Honee;
10 
11 #define HONEE_VERSION_MAJOR 0
12 #define HONEE_VERSION_MINOR 0
13 #define HONEE_VERSION_PATCH 0
14 #define HONEE_VERSION_RELEASE false
15 /// Compile-time check that the the current library version is at least as
16 /// recent as the specified version. This macro is typically used in
17 /// @code
18 /// #if HONEE_VERSION_GE(0, 1, 0)
19 ///   code path that needs at least 0.1.0
20 /// #else
21 ///   fallback code for older versions
22 /// #endif
23 /// @endcode
24 ///
25 /// A non-release version always compares as positive infinity.
26 ///
27 #define HONEE_VERSION_GE(major, minor, patch) \
28   (!HONEE_VERSION_RELEASE ||                  \
29    (HONEE_VERSION_MAJOR > major ||            \
30     (HONEE_VERSION_MAJOR == major && (HONEE_VERSION_MINOR > minor || (HONEE_VERSION_MINOR == minor && HONEE_VERSION_PATCH >= patch)))))
31 
32 PetscErrorCode HoneeGetVersion(int *major, int *minor, int *patch, PetscBool *release);
33 PetscErrorCode HoneeGetGitVersion(const char **git_version);
34 PetscErrorCode HoneeGetBuildConfiguration(const char **build_config);
35 
36 PetscErrorCode HoneeSetContainer(Honee honee, const char key[], void *container, PetscCtxDestroyFn *container_destroy);
37 PetscErrorCode HoneeGetContainer(Honee honee, const char key[], void *container);
38 PetscErrorCode HoneeHasContainer(Honee honee, const char key[], PetscBool *has_key);
39