Linux GNU 11.4.0 Code Coverage Report


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

OMCompiler/Compiler/FrontEnd/FHashTableCrToUnit.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 package FHashTableCrToUnit "
37 This file is an extension to OpenModelica.
38
39 Copyright (c) 2013 TU Dresden
40
41 All rights reserved.
42
43 file: HashTableCrToUnit.mo
44 package: HashTableCrToUnit
45 description: ComponentRef to Unit.Unit
46
47
48 "
49
50 /* Below is the instance specific code. For each hashtable the user must define:
51
52 Key - The key used to uniquely define elements in a hashtable
53 Value - The data to associate with each key
54 hashFunc - A function that maps a key to a positive integer.
55 keyEqual - A comparison function between two keys, returns true if equal.
56 */
57
58 /* HashTable instance specific code */
59
60 public import BaseHashTable;
61 public import DAE;
62 public import ComponentReference;
63 public import ComponentReferenceBasics;
64 public import FUnit;
65
66
67 public type Key = DAE.ComponentRef;
68 public type Value = FUnit.Unit;
69
70 public type HashTableCrefFunctionsType = tuple<FuncHashKey,FuncKeyEqual,FuncKeyStr,FuncValueStr>;
71 public type HashTable = tuple<
72 array<list<tuple<Key,Integer>>>,
73 tuple<Integer,Integer,array<Option<tuple<Key,Value>>>>,
74 Integer,
75 HashTableCrefFunctionsType
76 >;
77
78 partial function FuncHashKey
79 input Key cr;
80 output Integer res;
81 end FuncHashKey;
82
83 partial function FuncKeyEqual
84 input Key cr1;
85 input Key cr2;
86 output Boolean res;
87 end FuncKeyEqual;
88
89 partial function FuncKeyStr
90 input Key cr;
91 output String res;
92 end FuncKeyStr;
93
94 partial function FuncValueStr
95 input Value exp;
96 output String res;
97 end FuncValueStr;
98
99 public function emptyHashTable
100 "
101 Returns an empty HashTable.
102 Using the default bucketsize..
103 "
104 output HashTable hashTable;
105 algorithm
106 ✗ hashTable := emptyHashTableSized(BaseHashTable.defaultBucketSize);
107 end emptyHashTable;
108
109 public function emptyHashTableSized
110 "
111 Returns an empty HashTable.
112 Using the bucketsize size.
113 "
114 input Integer size;
115 output HashTable hashTable;
116 algorithm
117 10 hashTable := BaseHashTable.emptyHashTableWork(size, (ComponentReferenceBasics.hashComponentRef, ComponentReferenceBasics.crefEqual, ComponentReferenceBasics.printComponentRefStr, FUnit.unit2string));
118 end emptyHashTableSized;
119
120 annotation(__OpenModelica_Interface="frontend");
121 end FHashTableCrToUnit;
122