Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 6 / 0 / 6
Functions: 100.0% 2 / 1 / 3
Branches: -% 0 / 0 / 0

OMCompiler/Compiler/Util/Mutable.mo
Line Branch Exec Source
1 /*
2 * This file is part of OpenModelica.
3 *
4 * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC),
5 * c/o Linköpings universitet, Department of Computer and Information Science,
6 * SE-58183 Linköping, Sweden.
7 *
8 * All rights reserved.
9 *
10 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF AGPL VERSION 3 LICENSE OR
11 * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8.
12 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
13 * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GNU AGPL
14 * VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
15 *
16 * The OpenModelica software and the OSMC (Open Source Modelica Consortium)
17 * Public License (OSMC-PL) are obtained from OSMC, either from the above
18 * address, from the URLs:
19 * http://www.openmodelica.org or
20 * https://github.com/OpenModelica/ or
21 * http://www.ida.liu.se/projects/OpenModelica,
22 * and in the OpenModelica distribution.
23 *
24 * GNU AGPL version 3 is obtained from:
25 * https://www.gnu.org/licenses/licenses.html#GPL
26 *
27 * This program is distributed WITHOUT ANY WARRANTY; without
28 * even the implied warranty of MERCHANTABILITY or FITNESS
29 * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
30 * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
31 *
32 * See the full OSMC Public License conditions for more details.
33 *
34 */
35
36 encapsulated uniontype Mutable<T>
37 "Creating mutable (shared) objects
38
39 This uniontype contains routines for creating and updating objects,
40 similar to array<> structures."
41
42 63320787 impure function create
43 input T data;
44 output Mutable<T> mutable;
45 external "C" mutable=mutableCreate(data) annotation(Include="
46 static inline void* mutableCreate(void *data)
47 {
48 63320787 return mmc_mk_box1(0, data);
49 }
50 ");
51 end create;
52
53 63320787 impure function update
54 input Mutable<T> mutable;
55 input T data;
56 external "C" mutableUpdate(mutable, data) annotation(Include="
57 static inline void mutableUpdate(void *mutable, void *data)
58 {
59 112193269 MMC_STRUCTDATA(mutable)[0] = data;
60 }
61 ");
62 end update;
63
64 657807874 impure function access
65 input Mutable<T> mutable;
66 output T data;
67 external "C" data=mutableAccess(mutable) annotation(Include="
68 static inline void* mutableAccess(void *mutable)
69 {
70 545614605 return MMC_STRUCTDATA(mutable)[0];
71 }
72 ");
73 end access;
74
75 annotation(__OpenModelica_Interface="util_datatypes_basic");
76 end Mutable;
77