public API
(
switch to internal
)
-
revision 3.6.7
casadi
core
runtime
casadi_oracle_callback.hpp
1
//
2
// MIT No Attribution
3
//
4
// Copyright (C) 2010-2023 Joel Andersson, Joris Gillis, Moritz Diehl, KU Leuven.
5
//
6
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
7
// software and associated documentation files (the "Software"), to deal in the Software
8
// without restriction, including without limitation the rights to use, copy, modify,
9
// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
10
// permit persons to whom the Software is furnished to do so.
11
//
12
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
14
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
15
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
16
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
17
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
//
19
20
// SYMBOL "oracle_callback"
21
template
<
typename
T1>
22
struct
casadi_oracle_callback
{
23
int (*
eval
)(
const
T1** arg, T1** res, casadi_int* iw, T1* w,
int
mem);
24
int (*
checkout
)(void);
25
void (*
release
)(int);
26
};
27
// C-REPLACE "casadi_oracle_callback<T1>" "struct casadi_oracle_callback"
28
// C-REPLACE "casadi_oracle_data<T1>" "struct casadi_oracle_data"
29
30
// SYMBOL "call"
31
template
<
typename
T1>
32
int
casadi_oracle_call(
const
casadi_oracle_callback<T1>
* cb,
casadi_oracle_data<T1>
* d) {
33
int
flag;
34
int
mem = 0;
35
if
(cb->
checkout
) mem = cb->
checkout
();
36
flag = cb->
eval
(d->
arg
, d->
res
, d->
iw
, d->
w
, mem);
37
if
(cb->
release
) cb->
release
(mem);
38
return
flag;
39
}
casadi_oracle_callback
Definition:
casadi_oracle_callback.hpp:22
casadi_oracle_callback::checkout
int(* checkout)(void)
Definition:
casadi_oracle_callback.hpp:24
casadi_oracle_callback::eval
int(* eval)(const T1 **arg, T1 **res, casadi_int *iw, T1 *w, int mem)
Definition:
casadi_oracle_callback.hpp:23
casadi_oracle_callback::release
void(* release)(int)
Definition:
casadi_oracle_callback.hpp:25
casadi_oracle_data
Definition:
casadi_oracle.hpp:25
casadi_oracle_data::w
T1 * w
Definition:
casadi_oracle.hpp:29
casadi_oracle_data::res
T1 ** res
Definition:
casadi_oracle.hpp:27
casadi_oracle_data::arg
const T1 ** arg
Definition:
casadi_oracle.hpp:26
casadi_oracle_data::iw
casadi_int * iw
Definition:
casadi_oracle.hpp:28