OCCT-Light 0.1
C ABI and C++ veneer for multi-language CAD workflows
Loading...
Searching...
No Matches
occtl_core.h
Go to the documentation of this file.
1// Copyright (c) 2026 Capgemini Engineering Research and Development.
2//
3// This file is part of OCCT-Light software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Affero General Public License version 3 as published
7// by the Free Software Foundation, with an option to use any later version.
8// Consult the file LICENSE_AGPL_30.txt included in OCCT-Light distribution
9// for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of a commercial
12// license or contractual agreement.
13//
14// SPDX-License-Identifier: AGPL-3.0-or-later
15
27#ifndef OCCTL_CORE_H
28#define OCCTL_CORE_H
29
30#include <stddef.h>
31#include <stdint.h>
32
39#define OCCTL_PI 3.14159265358979323846
40
42#define OCCTL_TWO_PI (2.0 * OCCTL_PI)
43
45#define OCCTL_PI_OVER_TWO (0.5 * OCCTL_PI)
46
48#define OCCTL_RAD_PER_DEG (OCCTL_PI / 180.0)
49
51#define OCCTL_ANGLE_1_DEG_RAD OCCTL_RAD_PER_DEG
52
54#define OCCTL_ANGLE_5_DEG_RAD (5.0 * OCCTL_RAD_PER_DEG)
55
57#define OCCTL_ANGLE_20_DEG_RAD (20.0 * OCCTL_RAD_PER_DEG)
58
60#define OCCTL_ANGLE_30_DEG_RAD (30.0 * OCCTL_RAD_PER_DEG)
61
63#define OCCTL_ANGLE_90_DEG_RAD OCCTL_PI_OVER_TWO
64
72#ifndef OCCTL_VERSION_MAJOR
73 #define OCCTL_VERSION_MAJOR 0
74#endif
75#ifndef OCCTL_VERSION_MINOR
76 #define OCCTL_VERSION_MINOR 0
77#endif
78#ifndef OCCTL_VERSION_PATCH
79 #define OCCTL_VERSION_PATCH 0
80#endif
81
88#ifndef OCCTL_ABI_VERSION
89 #define OCCTL_ABI_VERSION 1
90#endif
91
100#if defined(_WIN32) && !defined(OCCTL_STATIC_BUILD)
101 #if defined(OCCTL_BUILD_SHARED)
102 #define OCCTL_API __declspec(dllexport)
103 #else
104 #define OCCTL_API __declspec(dllimport)
105 #endif
106 #define OCCTL_CALL __cdecl
107#else
108 #if defined(__GNUC__) || defined(__clang__)
109 #define OCCTL_API __attribute__((visibility("default")))
110 #else
111 #define OCCTL_API
112 #endif
113 #define OCCTL_CALL
114#endif
115
116#ifdef __cplusplus
117extern "C"
118{
119#endif
120
155
157#define OCCTL_FAILED(status) ((status) != OCCTL_OK)
158
160#define OCCTL_SUCCEEDED(status) ((status) == OCCTL_OK)
161
177OCCTL_API const char* OCCTL_CALL occtl_status_to_string(occtl_status_t status);
178
203
223
244
250typedef struct occtl_rep_id
251{
252 uint64_t bits;
254
255#ifdef __cplusplus
256 #define OCCTL_REP_ID_INVALID (occtl_rep_id_t{0})
257#else
258 #define OCCTL_REP_ID_INVALID ((occtl_rep_id_t){0})
259#endif
260
271typedef struct occtl_uid
272{
273 uint64_t bits;
275
283#ifdef __cplusplus
284 #define OCCTL_UID_INVALID (occtl_uid_t{0})
285#else
286 #define OCCTL_UID_INVALID ((occtl_uid_t){0})
287#endif
288
307
322
334OCCTL_API void OCCTL_CALL occtl_error_clear(void);
335
340#define OCCTL_RUNTIME_INIT_INFO_VERSION_1 1u
341
353
355#define OCCTL_RUNTIME_INIT_INFO_INIT {OCCTL_RUNTIME_INIT_INFO_VERSION_1, NULL}
356
378
395
407OCCTL_API void OCCTL_CALL occtl_runtime_shutdown(void);
408
423OCCTL_API void OCCTL_CALL occtl_runtime_version(uint32_t* out_major,
424 uint32_t* out_minor,
425 uint32_t* out_patch);
426
440OCCTL_API uint32_t OCCTL_CALL occtl_runtime_abi_version(void);
441
454OCCTL_API const char* OCCTL_CALL occtl_runtime_occt_version(void);
455
465#define OCCTL_UID_WIRE_SIZE 16u
466
485OCCTL_API occtl_status_t OCCTL_CALL occtl_uid_to_bytes(occtl_uid_t uid, uint8_t* out_bytes);
486
507OCCTL_API occtl_status_t OCCTL_CALL occtl_uid_from_bytes(const uint8_t* in_bytes,
508 occtl_uid_t* out_uid);
509
523
524#ifdef __cplusplus
525} /* extern "C" */
526#endif
527
528#endif /* OCCTL_CORE_H */
occtl_rep_kind
Definition occtl_core.h:233
@ OCCTL_REP_KIND_INVALID
Definition occtl_core.h:234
@ OCCTL_REP_KIND_CURVE3D
Definition occtl_core.h:236
@ OCCTL_REP_KIND_SURFACE
Definition occtl_core.h:235
@ OCCTL_REP_KIND_POLYGON2D
Definition occtl_core.h:240
@ OCCTL_REP_KIND_CURVE2D
Definition occtl_core.h:237
@ OCCTL_REP_KIND_TRIANGULATION
Definition occtl_core.h:238
@ OCCTL_REP_KIND_POLYGON3D
Definition occtl_core.h:239
@ OCCTL_REP_KIND_POLYGON_ON_TRI
Definition occtl_core.h:241
int32_t occtl_uid_equal(occtl_uid_t a, occtl_uid_t b)
struct occtl_uid occtl_uid_t
const char * occtl_status_to_string(occtl_status_t status)
uint32_t occtl_runtime_abi_version(void)
#define OCCTL_API
Definition occtl_core.h:111
occtl_status_t occtl_runtime_init(const occtl_runtime_init_info_t *info)
occtl_ref_kind
Definition occtl_core.h:211
@ OCCTL_REF_KIND_SHELL
Definition occtl_core.h:213
@ OCCTL_REF_KIND_WIRE
Definition occtl_core.h:215
@ OCCTL_REF_KIND_OCCURRENCE
Definition occtl_core.h:220
@ OCCTL_REF_KIND_FACE
Definition occtl_core.h:214
@ OCCTL_REF_KIND_COEDGE
Definition occtl_core.h:216
@ OCCTL_REF_KIND_INVALID
Definition occtl_core.h:212
@ OCCTL_REF_KIND_CHILD
Definition occtl_core.h:219
@ OCCTL_REF_KIND_SOLID
Definition occtl_core.h:218
@ OCCTL_REF_KIND_VERTEX
Definition occtl_core.h:217
const occtl_error_t * occtl_error_last(void)
struct occtl_error occtl_error_t
enum occtl_status occtl_status_t
void occtl_error_clear(void)
const char * occtl_runtime_occt_version(void)
enum occtl_rep_kind occtl_rep_kind_t
enum occtl_ref_kind occtl_ref_kind_t
occtl_status
Definition occtl_core.h:132
@ OCCTL_TOPOLOGY_INVALID
Definition occtl_core.h:142
@ OCCTL_IO_ERROR
Definition occtl_core.h:143
@ OCCTL_OK
Definition occtl_core.h:133
@ OCCTL_OUT_OF_MEMORY
Definition occtl_core.h:138
@ OCCTL_BUFFER_TOO_SMALL
Definition occtl_core.h:147
@ OCCTL_INTERNAL
Definition occtl_core.h:149
@ OCCTL_STATUS_RESERVED_FUTURE
Definition occtl_core.h:153
@ OCCTL_ERROR
Definition occtl_core.h:134
@ OCCTL_OUT_OF_RANGE
Definition occtl_core.h:139
@ OCCTL_FORMAT_ERROR
Definition occtl_core.h:144
@ OCCTL_NOT_DONE
Definition occtl_core.h:140
@ OCCTL_INVALID_HANDLE
Definition occtl_core.h:136
@ OCCTL_WRONG_KIND
Definition occtl_core.h:150
@ OCCTL_UNSUPPORTED
Definition occtl_core.h:145
@ OCCTL_GEOMETRY_INVALID
Definition occtl_core.h:141
@ OCCTL_NOT_FOUND
Definition occtl_core.h:137
@ OCCTL_INVALID_ARGUMENT
Definition occtl_core.h:135
@ OCCTL_CANCELLED
Definition occtl_core.h:146
@ OCCTL_VERSION_MISMATCH
Definition occtl_core.h:148
void occtl_runtime_shutdown(void)
occtl_status_t occtl_uid_from_bytes(const uint8_t *in_bytes, occtl_uid_t *out_uid)
occtl_status_t occtl_runtime_init_info_init(occtl_runtime_init_info_t *info)
occtl_status_t occtl_uid_to_bytes(occtl_uid_t uid, uint8_t *out_bytes)
enum occtl_node_kind occtl_node_kind_t
struct occtl_runtime_init_info occtl_runtime_init_info_t
occtl_node_kind
Definition occtl_core.h:188
@ OCCTL_KIND_WIRE
Definition occtl_core.h:193
@ OCCTL_KIND_SOLID
Definition occtl_core.h:190
@ OCCTL_KIND_EDGE
Definition occtl_core.h:194
@ OCCTL_KIND_COMPOUND
Definition occtl_core.h:196
@ OCCTL_KIND_PRODUCT
Definition occtl_core.h:199
@ OCCTL_KIND_FACE
Definition occtl_core.h:192
@ OCCTL_KIND_VERTEX
Definition occtl_core.h:195
@ OCCTL_KIND_INVALID
Definition occtl_core.h:189
@ OCCTL_KIND_COMPSOLID
Definition occtl_core.h:197
@ OCCTL_KIND_OCCURRENCE
Definition occtl_core.h:200
@ OCCTL_KIND_SHELL
Definition occtl_core.h:191
@ OCCTL_KIND_COEDGE
Definition occtl_core.h:198
struct occtl_rep_id occtl_rep_id_t
void occtl_runtime_version(uint32_t *out_major, uint32_t *out_minor, uint32_t *out_patch)
Definition occtl_core.h:301
const char * message
Definition occtl_core.h:303
uint32_t extended
Definition occtl_core.h:305
occtl_uid_t source
Definition occtl_core.h:304
occtl_status_t status
Definition occtl_core.h:302
Definition occtl_core.h:251
uint64_t bits
Definition occtl_core.h:252
Definition occtl_core.h:349
uint32_t struct_version
Definition occtl_core.h:350
const void * p_next
Definition occtl_core.h:351
Definition occtl_core.h:272