@itwin/core-bentley 3.5.0-dev.5 → 3.5.0-dev.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/lib/cjs/AccessToken.d.ts +8 -8
  3. package/lib/cjs/AccessToken.js +9 -9
  4. package/lib/cjs/AccessToken.js.map +1 -1
  5. package/lib/cjs/Assert.d.ts +25 -25
  6. package/lib/cjs/Assert.js +45 -45
  7. package/lib/cjs/Assert.js.map +1 -1
  8. package/lib/cjs/AsyncMutex.d.ts +26 -26
  9. package/lib/cjs/AsyncMutex.js +43 -43
  10. package/lib/cjs/AsyncMutex.js.map +1 -1
  11. package/lib/cjs/BeEvent.d.ts +81 -81
  12. package/lib/cjs/BeEvent.js +156 -156
  13. package/lib/cjs/BeEvent.js.map +1 -1
  14. package/lib/cjs/BeSQLite.d.ts +170 -170
  15. package/lib/cjs/BeSQLite.js +183 -183
  16. package/lib/cjs/BeSQLite.js.map +1 -1
  17. package/lib/cjs/BentleyError.d.ts +378 -376
  18. package/lib/cjs/BentleyError.d.ts.map +1 -1
  19. package/lib/cjs/BentleyError.js +702 -699
  20. package/lib/cjs/BentleyError.js.map +1 -1
  21. package/lib/cjs/BentleyLoggerCategory.d.ts +11 -11
  22. package/lib/cjs/BentleyLoggerCategory.js +19 -19
  23. package/lib/cjs/BentleyLoggerCategory.js.map +1 -1
  24. package/lib/cjs/ByteStream.d.ts +92 -92
  25. package/lib/cjs/ByteStream.js +133 -133
  26. package/lib/cjs/ByteStream.js.map +1 -1
  27. package/lib/cjs/ClassUtils.d.ts +14 -14
  28. package/lib/cjs/ClassUtils.js +27 -27
  29. package/lib/cjs/ClassUtils.js.map +1 -1
  30. package/lib/cjs/Compare.d.ts +47 -47
  31. package/lib/cjs/Compare.js +75 -75
  32. package/lib/cjs/Compare.js.map +1 -1
  33. package/lib/cjs/CompressedId64Set.d.ts +134 -134
  34. package/lib/cjs/CompressedId64Set.js +428 -428
  35. package/lib/cjs/CompressedId64Set.js.map +1 -1
  36. package/lib/cjs/Dictionary.d.ts +125 -125
  37. package/lib/cjs/Dictionary.js +203 -203
  38. package/lib/cjs/Dictionary.js.map +1 -1
  39. package/lib/cjs/Disposable.d.ts +80 -80
  40. package/lib/cjs/Disposable.js +120 -120
  41. package/lib/cjs/Disposable.js.map +1 -1
  42. package/lib/cjs/Id.d.ts +277 -277
  43. package/lib/cjs/Id.js +629 -629
  44. package/lib/cjs/Id.js.map +1 -1
  45. package/lib/cjs/IndexMap.d.ts +65 -65
  46. package/lib/cjs/IndexMap.js +91 -91
  47. package/lib/cjs/IndexMap.js.map +1 -1
  48. package/lib/cjs/JsonSchema.d.ts +77 -77
  49. package/lib/cjs/JsonSchema.js +9 -9
  50. package/lib/cjs/JsonSchema.js.map +1 -1
  51. package/lib/cjs/JsonUtils.d.ts +78 -78
  52. package/lib/cjs/JsonUtils.js +151 -151
  53. package/lib/cjs/JsonUtils.js.map +1 -1
  54. package/lib/cjs/LRUMap.d.ts +129 -129
  55. package/lib/cjs/LRUMap.js +333 -333
  56. package/lib/cjs/LRUMap.js.map +1 -1
  57. package/lib/cjs/Logger.d.ts +143 -141
  58. package/lib/cjs/Logger.d.ts.map +1 -1
  59. package/lib/cjs/Logger.js +258 -254
  60. package/lib/cjs/Logger.js.map +1 -1
  61. package/lib/cjs/ObservableSet.d.ts +23 -23
  62. package/lib/cjs/ObservableSet.js +51 -51
  63. package/lib/cjs/ObservableSet.js.map +1 -1
  64. package/lib/cjs/OneAtATimeAction.d.ts +31 -31
  65. package/lib/cjs/OneAtATimeAction.js +94 -94
  66. package/lib/cjs/OneAtATimeAction.js.map +1 -1
  67. package/lib/cjs/OrderedId64Iterable.d.ts +74 -74
  68. package/lib/cjs/OrderedId64Iterable.js +235 -235
  69. package/lib/cjs/OrderedId64Iterable.js.map +1 -1
  70. package/lib/cjs/OrderedSet.d.ts +40 -40
  71. package/lib/cjs/OrderedSet.js +64 -64
  72. package/lib/cjs/OrderedSet.js.map +1 -1
  73. package/lib/cjs/PriorityQueue.d.ts +70 -70
  74. package/lib/cjs/PriorityQueue.js +140 -140
  75. package/lib/cjs/PriorityQueue.js.map +1 -1
  76. package/lib/cjs/ProcessDetector.d.ts +59 -59
  77. package/lib/cjs/ProcessDetector.js +71 -71
  78. package/lib/cjs/ProcessDetector.js.map +1 -1
  79. package/lib/cjs/SortedArray.d.ts +232 -232
  80. package/lib/cjs/SortedArray.js +303 -303
  81. package/lib/cjs/SortedArray.js.map +1 -1
  82. package/lib/cjs/StatusCategory.d.ts +30 -30
  83. package/lib/cjs/StatusCategory.js +460 -460
  84. package/lib/cjs/StatusCategory.js.map +1 -1
  85. package/lib/cjs/StringUtils.d.ts +22 -22
  86. package/lib/cjs/StringUtils.js +148 -148
  87. package/lib/cjs/StringUtils.js.map +1 -1
  88. package/lib/cjs/Time.d.ts +122 -122
  89. package/lib/cjs/Time.js +152 -152
  90. package/lib/cjs/Time.js.map +1 -1
  91. package/lib/cjs/Tracing.d.ts +40 -40
  92. package/lib/cjs/Tracing.js +130 -130
  93. package/lib/cjs/Tracing.js.map +1 -1
  94. package/lib/cjs/TupleKeyedMap.d.ts +37 -0
  95. package/lib/cjs/TupleKeyedMap.d.ts.map +1 -0
  96. package/lib/cjs/TupleKeyedMap.js +103 -0
  97. package/lib/cjs/TupleKeyedMap.js.map +1 -0
  98. package/lib/cjs/TypedArrayBuilder.d.ts +97 -97
  99. package/lib/cjs/TypedArrayBuilder.js +134 -134
  100. package/lib/cjs/TypedArrayBuilder.js.map +1 -1
  101. package/lib/cjs/UnexpectedErrors.d.ts +43 -43
  102. package/lib/cjs/UnexpectedErrors.js +68 -68
  103. package/lib/cjs/UnexpectedErrors.js.map +1 -1
  104. package/lib/cjs/UtilityTypes.d.ts +100 -86
  105. package/lib/cjs/UtilityTypes.d.ts.map +1 -1
  106. package/lib/cjs/UtilityTypes.js +40 -26
  107. package/lib/cjs/UtilityTypes.js.map +1 -1
  108. package/lib/cjs/YieldManager.d.ts +18 -18
  109. package/lib/cjs/YieldManager.js +34 -34
  110. package/lib/cjs/YieldManager.js.map +1 -1
  111. package/lib/cjs/core-bentley.d.ts +75 -74
  112. package/lib/cjs/core-bentley.d.ts.map +1 -1
  113. package/lib/cjs/core-bentley.js +91 -90
  114. package/lib/cjs/core-bentley.js.map +1 -1
  115. package/lib/cjs/partitionArray.d.ts +21 -21
  116. package/lib/cjs/partitionArray.js +43 -43
  117. package/lib/cjs/partitionArray.js.map +1 -1
  118. package/lib/esm/AccessToken.d.ts +8 -8
  119. package/lib/esm/AccessToken.js +8 -8
  120. package/lib/esm/AccessToken.js.map +1 -1
  121. package/lib/esm/Assert.d.ts +25 -25
  122. package/lib/esm/Assert.js +41 -41
  123. package/lib/esm/Assert.js.map +1 -1
  124. package/lib/esm/AsyncMutex.d.ts +26 -26
  125. package/lib/esm/AsyncMutex.js +39 -39
  126. package/lib/esm/AsyncMutex.js.map +1 -1
  127. package/lib/esm/BeEvent.d.ts +81 -81
  128. package/lib/esm/BeEvent.js +150 -150
  129. package/lib/esm/BeEvent.js.map +1 -1
  130. package/lib/esm/BeSQLite.d.ts +170 -170
  131. package/lib/esm/BeSQLite.js +180 -180
  132. package/lib/esm/BeSQLite.js.map +1 -1
  133. package/lib/esm/BentleyError.d.ts +378 -376
  134. package/lib/esm/BentleyError.d.ts.map +1 -1
  135. package/lib/esm/BentleyError.js +698 -695
  136. package/lib/esm/BentleyError.js.map +1 -1
  137. package/lib/esm/BentleyLoggerCategory.d.ts +11 -11
  138. package/lib/esm/BentleyLoggerCategory.js +16 -16
  139. package/lib/esm/BentleyLoggerCategory.js.map +1 -1
  140. package/lib/esm/ByteStream.d.ts +92 -92
  141. package/lib/esm/ByteStream.js +129 -129
  142. package/lib/esm/ByteStream.js.map +1 -1
  143. package/lib/esm/ClassUtils.d.ts +14 -14
  144. package/lib/esm/ClassUtils.js +22 -22
  145. package/lib/esm/ClassUtils.js.map +1 -1
  146. package/lib/esm/Compare.d.ts +47 -47
  147. package/lib/esm/Compare.js +63 -63
  148. package/lib/esm/Compare.js.map +1 -1
  149. package/lib/esm/CompressedId64Set.d.ts +134 -134
  150. package/lib/esm/CompressedId64Set.js +423 -423
  151. package/lib/esm/CompressedId64Set.js.map +1 -1
  152. package/lib/esm/Dictionary.d.ts +125 -125
  153. package/lib/esm/Dictionary.js +199 -199
  154. package/lib/esm/Dictionary.js.map +1 -1
  155. package/lib/esm/Disposable.d.ts +80 -80
  156. package/lib/esm/Disposable.js +112 -112
  157. package/lib/esm/Disposable.js.map +1 -1
  158. package/lib/esm/Id.d.ts +277 -277
  159. package/lib/esm/Id.js +625 -625
  160. package/lib/esm/Id.js.map +1 -1
  161. package/lib/esm/IndexMap.d.ts +65 -65
  162. package/lib/esm/IndexMap.js +86 -86
  163. package/lib/esm/IndexMap.js.map +1 -1
  164. package/lib/esm/JsonSchema.d.ts +77 -77
  165. package/lib/esm/JsonSchema.js +8 -8
  166. package/lib/esm/JsonSchema.js.map +1 -1
  167. package/lib/esm/JsonUtils.d.ts +78 -78
  168. package/lib/esm/JsonUtils.js +148 -148
  169. package/lib/esm/JsonUtils.js.map +1 -1
  170. package/lib/esm/LRUMap.d.ts +129 -129
  171. package/lib/esm/LRUMap.js +326 -326
  172. package/lib/esm/LRUMap.js.map +1 -1
  173. package/lib/esm/Logger.d.ts +143 -141
  174. package/lib/esm/Logger.d.ts.map +1 -1
  175. package/lib/esm/Logger.js +253 -249
  176. package/lib/esm/Logger.js.map +1 -1
  177. package/lib/esm/ObservableSet.d.ts +23 -23
  178. package/lib/esm/ObservableSet.js +47 -47
  179. package/lib/esm/ObservableSet.js.map +1 -1
  180. package/lib/esm/OneAtATimeAction.d.ts +31 -31
  181. package/lib/esm/OneAtATimeAction.js +89 -89
  182. package/lib/esm/OneAtATimeAction.js.map +1 -1
  183. package/lib/esm/OrderedId64Iterable.d.ts +74 -74
  184. package/lib/esm/OrderedId64Iterable.js +232 -232
  185. package/lib/esm/OrderedId64Iterable.js.map +1 -1
  186. package/lib/esm/OrderedSet.d.ts +40 -40
  187. package/lib/esm/OrderedSet.js +59 -59
  188. package/lib/esm/OrderedSet.js.map +1 -1
  189. package/lib/esm/PriorityQueue.d.ts +70 -70
  190. package/lib/esm/PriorityQueue.js +136 -136
  191. package/lib/esm/PriorityQueue.js.map +1 -1
  192. package/lib/esm/ProcessDetector.d.ts +59 -59
  193. package/lib/esm/ProcessDetector.js +67 -67
  194. package/lib/esm/ProcessDetector.js.map +1 -1
  195. package/lib/esm/SortedArray.d.ts +232 -232
  196. package/lib/esm/SortedArray.js +296 -296
  197. package/lib/esm/SortedArray.js.map +1 -1
  198. package/lib/esm/StatusCategory.d.ts +30 -30
  199. package/lib/esm/StatusCategory.js +454 -454
  200. package/lib/esm/StatusCategory.js.map +1 -1
  201. package/lib/esm/StringUtils.d.ts +22 -22
  202. package/lib/esm/StringUtils.js +142 -142
  203. package/lib/esm/StringUtils.js.map +1 -1
  204. package/lib/esm/Time.d.ts +122 -122
  205. package/lib/esm/Time.js +146 -146
  206. package/lib/esm/Time.js.map +1 -1
  207. package/lib/esm/Tracing.d.ts +40 -40
  208. package/lib/esm/Tracing.js +126 -126
  209. package/lib/esm/Tracing.js.map +1 -1
  210. package/lib/esm/TupleKeyedMap.d.ts +37 -0
  211. package/lib/esm/TupleKeyedMap.d.ts.map +1 -0
  212. package/lib/esm/TupleKeyedMap.js +99 -0
  213. package/lib/esm/TupleKeyedMap.js.map +1 -0
  214. package/lib/esm/TypedArrayBuilder.d.ts +97 -97
  215. package/lib/esm/TypedArrayBuilder.js +127 -127
  216. package/lib/esm/TypedArrayBuilder.js.map +1 -1
  217. package/lib/esm/UnexpectedErrors.d.ts +43 -43
  218. package/lib/esm/UnexpectedErrors.js +64 -64
  219. package/lib/esm/UnexpectedErrors.js.map +1 -1
  220. package/lib/esm/UtilityTypes.d.ts +100 -86
  221. package/lib/esm/UtilityTypes.d.ts.map +1 -1
  222. package/lib/esm/UtilityTypes.js +34 -21
  223. package/lib/esm/UtilityTypes.js.map +1 -1
  224. package/lib/esm/YieldManager.d.ts +18 -18
  225. package/lib/esm/YieldManager.js +30 -30
  226. package/lib/esm/YieldManager.js.map +1 -1
  227. package/lib/esm/core-bentley.d.ts +75 -74
  228. package/lib/esm/core-bentley.d.ts.map +1 -1
  229. package/lib/esm/core-bentley.js +79 -78
  230. package/lib/esm/core-bentley.js.map +1 -1
  231. package/lib/esm/partitionArray.d.ts +21 -21
  232. package/lib/esm/partitionArray.js +39 -39
  233. package/lib/esm/partitionArray.js.map +1 -1
  234. package/package.json +4 -4
@@ -1,98 +1,98 @@
1
- /** @packageDocumentation
2
- * @module Collections
3
- */
4
- import { Constructor } from "./UtilityTypes";
5
- /** Options used to construct a [[TypedArrayBuilder]].
6
- * @public
7
- */
8
- export interface TypedArrayBuilderOptions {
9
- /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.
10
- * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.
11
- * Default: 1.5
12
- * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.
13
- */
14
- growthFactor?: number;
15
- /** The number of elements to allocate memory for in the TypedArray when creating the builder.
16
- * If you know the minimum number of elements you intend to add to the builder, you should specify that as the
17
- * initial capacity to avoid reallocations when populating the array.
18
- * Default: 0.
19
- * Minimum: 0.
20
- */
21
- initialCapacity?: number;
22
- }
23
- /** Incrementally builds a [TypedArray] of unsigned 8-, 16-, or 32-bit integers.
24
- * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.
25
- * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.
26
- *
27
- * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two "size" properties":
28
- * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and
29
- * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].
30
- * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.
31
- *
32
- * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].
33
- * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.
34
- * @public
35
- */
36
- export declare class TypedArrayBuilder<T extends Uint8Array | Uint16Array | Uint32Array> {
37
- /** The constructor for the specific type of array being populated. */
38
- protected readonly _constructor: Constructor<T>;
39
- /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */
40
- protected _data: T;
41
- /** The number of elements added to the array so far. */
42
- protected _length: number;
43
- /** Multiplier applied to required capacity by [[ensureCapacity]]. */
44
- readonly growthFactor: number;
45
- /** Constructs a new builder from the specified options, with a [[length]] of zero. */
46
- protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions);
47
- /** The number of elements currently in the array. */
48
- get length(): number;
49
- /** The number of elements that can fit into the memory currently allocated for the array. */
50
- get capacity(): number;
51
- /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),
52
- * returns the element at the specified index, with negative integers counting back from the end of the array.
53
- * @note It is your responsibility to ensure the index falls within the bounds of the array.
54
- */
55
- at(index: number): number;
56
- /** Ensure that [[capacity]] is at least equal to `newCapacity`.
57
- * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.
58
- * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.
59
- *
60
- * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.
61
- * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.
62
- * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.
63
- */
64
- ensureCapacity(newCapacity: number): number;
65
- /** Append the specified value, resizing if necessary. */
66
- push(value: number): void;
67
- /** Append an array of values, resizing (at most once) if necessary. */
68
- append(values: T): void;
69
- /** Obtain the finished array.
70
- * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the
71
- * returned array's length will be equal to [[length]].
72
- */
73
- toTypedArray(includeUnusedCapacity?: boolean): T;
74
- }
75
- /** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
76
- * @public
77
- */
78
- export declare class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {
79
- /** @see [[TypedArrayBuilder]] constructor. */
80
- constructor(options?: TypedArrayBuilderOptions);
81
- }
82
- /** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).
83
- * @public
84
- */
85
- export declare class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {
86
- /** @see [[TypedArrayBuilder]] constructor. */
87
- constructor(options?: TypedArrayBuilderOptions);
88
- }
89
- /** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).
90
- * @public
91
- */
92
- export declare class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {
93
- /** @see [[TypedArrayBuilder]] constructor. */
94
- constructor(options?: TypedArrayBuilderOptions);
95
- /** Obtain a view of the finished array as an array of bytes. */
96
- toUint8Array(includeUnusedCapacity?: boolean): Uint8Array;
97
- }
1
+ /** @packageDocumentation
2
+ * @module Collections
3
+ */
4
+ import { Constructor } from "./UtilityTypes";
5
+ /** Options used to construct a [[TypedArrayBuilder]].
6
+ * @public
7
+ */
8
+ export interface TypedArrayBuilderOptions {
9
+ /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.
10
+ * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.
11
+ * Default: 1.5
12
+ * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.
13
+ */
14
+ growthFactor?: number;
15
+ /** The number of elements to allocate memory for in the TypedArray when creating the builder.
16
+ * If you know the minimum number of elements you intend to add to the builder, you should specify that as the
17
+ * initial capacity to avoid reallocations when populating the array.
18
+ * Default: 0.
19
+ * Minimum: 0.
20
+ */
21
+ initialCapacity?: number;
22
+ }
23
+ /** Incrementally builds a [TypedArray] of unsigned 8-, 16-, or 32-bit integers.
24
+ * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.
25
+ * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.
26
+ *
27
+ * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two "size" properties":
28
+ * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and
29
+ * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].
30
+ * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.
31
+ *
32
+ * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].
33
+ * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.
34
+ * @public
35
+ */
36
+ export declare class TypedArrayBuilder<T extends Uint8Array | Uint16Array | Uint32Array> {
37
+ /** The constructor for the specific type of array being populated. */
38
+ protected readonly _constructor: Constructor<T>;
39
+ /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */
40
+ protected _data: T;
41
+ /** The number of elements added to the array so far. */
42
+ protected _length: number;
43
+ /** Multiplier applied to required capacity by [[ensureCapacity]]. */
44
+ readonly growthFactor: number;
45
+ /** Constructs a new builder from the specified options, with a [[length]] of zero. */
46
+ protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions);
47
+ /** The number of elements currently in the array. */
48
+ get length(): number;
49
+ /** The number of elements that can fit into the memory currently allocated for the array. */
50
+ get capacity(): number;
51
+ /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),
52
+ * returns the element at the specified index, with negative integers counting back from the end of the array.
53
+ * @note It is your responsibility to ensure the index falls within the bounds of the array.
54
+ */
55
+ at(index: number): number;
56
+ /** Ensure that [[capacity]] is at least equal to `newCapacity`.
57
+ * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.
58
+ * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.
59
+ *
60
+ * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.
61
+ * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.
62
+ * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.
63
+ */
64
+ ensureCapacity(newCapacity: number): number;
65
+ /** Append the specified value, resizing if necessary. */
66
+ push(value: number): void;
67
+ /** Append an array of values, resizing (at most once) if necessary. */
68
+ append(values: T): void;
69
+ /** Obtain the finished array.
70
+ * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the
71
+ * returned array's length will be equal to [[length]].
72
+ */
73
+ toTypedArray(includeUnusedCapacity?: boolean): T;
74
+ }
75
+ /** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
76
+ * @public
77
+ */
78
+ export declare class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {
79
+ /** @see [[TypedArrayBuilder]] constructor. */
80
+ constructor(options?: TypedArrayBuilderOptions);
81
+ }
82
+ /** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).
83
+ * @public
84
+ */
85
+ export declare class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {
86
+ /** @see [[TypedArrayBuilder]] constructor. */
87
+ constructor(options?: TypedArrayBuilderOptions);
88
+ }
89
+ /** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).
90
+ * @public
91
+ */
92
+ export declare class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {
93
+ /** @see [[TypedArrayBuilder]] constructor. */
94
+ constructor(options?: TypedArrayBuilderOptions);
95
+ /** Obtain a view of the finished array as an array of bytes. */
96
+ toUint8Array(includeUnusedCapacity?: boolean): Uint8Array;
97
+ }
98
98
  //# sourceMappingURL=TypedArrayBuilder.d.ts.map
@@ -1,128 +1,128 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module Collections
7
- */
8
- import { assert } from "./Assert";
9
- /** Incrementally builds a [TypedArray] of unsigned 8-, 16-, or 32-bit integers.
10
- * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.
11
- * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.
12
- *
13
- * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two "size" properties":
14
- * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and
15
- * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].
16
- * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.
17
- *
18
- * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].
19
- * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.
20
- * @public
21
- */
22
- export class TypedArrayBuilder {
23
- /** Constructs a new builder from the specified options, with a [[length]] of zero. */
24
- constructor(constructor, options) {
25
- var _a, _b;
26
- this._constructor = constructor;
27
- this._data = new constructor((_a = options === null || options === void 0 ? void 0 : options.initialCapacity) !== null && _a !== void 0 ? _a : 0);
28
- this.growthFactor = Math.max(1.0, (_b = options === null || options === void 0 ? void 0 : options.growthFactor) !== null && _b !== void 0 ? _b : 1.5);
29
- this._length = 0;
30
- }
31
- /** The number of elements currently in the array. */
32
- get length() {
33
- return this._length;
34
- }
35
- /** The number of elements that can fit into the memory currently allocated for the array. */
36
- get capacity() {
37
- return this._data.length;
38
- }
39
- /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),
40
- * returns the element at the specified index, with negative integers counting back from the end of the array.
41
- * @note It is your responsibility to ensure the index falls within the bounds of the array.
42
- */
43
- at(index) {
44
- if (index < 0)
45
- index = this.length - index;
46
- const value = this._data[index];
47
- assert(value !== undefined, "index out of bounds");
48
- return value;
49
- }
50
- /** Ensure that [[capacity]] is at least equal to `newCapacity`.
51
- * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.
52
- * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.
53
- *
54
- * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.
55
- * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.
56
- * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.
57
- */
58
- ensureCapacity(newCapacity) {
59
- if (this.capacity >= newCapacity)
60
- return this.capacity;
61
- assert(this.growthFactor >= 1.0);
62
- newCapacity = Math.ceil(newCapacity * this.growthFactor);
63
- const prevData = this._data;
64
- this._data = new this._constructor(newCapacity);
65
- this._data.set(prevData, 0);
66
- assert(this.capacity === newCapacity);
67
- return this.capacity;
68
- }
69
- /** Append the specified value, resizing if necessary. */
70
- push(value) {
71
- this.ensureCapacity(this.length + 1);
72
- this._data[this.length] = value;
73
- ++this._length;
74
- }
75
- /** Append an array of values, resizing (at most once) if necessary. */
76
- append(values) {
77
- const newLength = this.length + values.length;
78
- this.ensureCapacity(newLength);
79
- this._data.set(values, this.length);
80
- this._length = newLength;
81
- }
82
- /** Obtain the finished array.
83
- * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the
84
- * returned array's length will be equal to [[length]].
85
- */
86
- toTypedArray(includeUnusedCapacity = false) {
87
- if (includeUnusedCapacity)
88
- return this._data;
89
- const subarray = this._data.subarray(0, this.length);
90
- assert(subarray instanceof this._constructor);
91
- assert(subarray.buffer === this._data.buffer);
92
- return subarray;
93
- }
94
- }
95
- /** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
96
- * @public
97
- */
98
- export class Uint8ArrayBuilder extends TypedArrayBuilder {
99
- /** @see [[TypedArrayBuilder]] constructor. */
100
- constructor(options) {
101
- super(Uint8Array, options);
102
- }
103
- }
104
- /** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).
105
- * @public
106
- */
107
- export class Uint16ArrayBuilder extends TypedArrayBuilder {
108
- /** @see [[TypedArrayBuilder]] constructor. */
109
- constructor(options) {
110
- super(Uint16Array, options);
111
- }
112
- }
113
- /** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).
114
- * @public
115
- */
116
- export class Uint32ArrayBuilder extends TypedArrayBuilder {
117
- /** @see [[TypedArrayBuilder]] constructor. */
118
- constructor(options) {
119
- super(Uint32Array, options);
120
- }
121
- /** Obtain a view of the finished array as an array of bytes. */
122
- toUint8Array(includeUnusedCapacity = false) {
123
- if (includeUnusedCapacity)
124
- return new Uint8Array(this._data.buffer);
125
- return new Uint8Array(this._data.buffer, 0, this.length * 4);
126
- }
127
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Collections
7
+ */
8
+ import { assert } from "./Assert";
9
+ /** Incrementally builds a [TypedArray] of unsigned 8-, 16-, or 32-bit integers.
10
+ * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.
11
+ * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.
12
+ *
13
+ * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two "size" properties":
14
+ * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and
15
+ * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].
16
+ * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.
17
+ *
18
+ * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].
19
+ * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.
20
+ * @public
21
+ */
22
+ export class TypedArrayBuilder {
23
+ /** Constructs a new builder from the specified options, with a [[length]] of zero. */
24
+ constructor(constructor, options) {
25
+ var _a, _b;
26
+ this._constructor = constructor;
27
+ this._data = new constructor((_a = options === null || options === void 0 ? void 0 : options.initialCapacity) !== null && _a !== void 0 ? _a : 0);
28
+ this.growthFactor = Math.max(1.0, (_b = options === null || options === void 0 ? void 0 : options.growthFactor) !== null && _b !== void 0 ? _b : 1.5);
29
+ this._length = 0;
30
+ }
31
+ /** The number of elements currently in the array. */
32
+ get length() {
33
+ return this._length;
34
+ }
35
+ /** The number of elements that can fit into the memory currently allocated for the array. */
36
+ get capacity() {
37
+ return this._data.length;
38
+ }
39
+ /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),
40
+ * returns the element at the specified index, with negative integers counting back from the end of the array.
41
+ * @note It is your responsibility to ensure the index falls within the bounds of the array.
42
+ */
43
+ at(index) {
44
+ if (index < 0)
45
+ index = this.length - index;
46
+ const value = this._data[index];
47
+ assert(value !== undefined, "index out of bounds");
48
+ return value;
49
+ }
50
+ /** Ensure that [[capacity]] is at least equal to `newCapacity`.
51
+ * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.
52
+ * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.
53
+ *
54
+ * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.
55
+ * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.
56
+ * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.
57
+ */
58
+ ensureCapacity(newCapacity) {
59
+ if (this.capacity >= newCapacity)
60
+ return this.capacity;
61
+ assert(this.growthFactor >= 1.0);
62
+ newCapacity = Math.ceil(newCapacity * this.growthFactor);
63
+ const prevData = this._data;
64
+ this._data = new this._constructor(newCapacity);
65
+ this._data.set(prevData, 0);
66
+ assert(this.capacity === newCapacity);
67
+ return this.capacity;
68
+ }
69
+ /** Append the specified value, resizing if necessary. */
70
+ push(value) {
71
+ this.ensureCapacity(this.length + 1);
72
+ this._data[this.length] = value;
73
+ ++this._length;
74
+ }
75
+ /** Append an array of values, resizing (at most once) if necessary. */
76
+ append(values) {
77
+ const newLength = this.length + values.length;
78
+ this.ensureCapacity(newLength);
79
+ this._data.set(values, this.length);
80
+ this._length = newLength;
81
+ }
82
+ /** Obtain the finished array.
83
+ * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the
84
+ * returned array's length will be equal to [[length]].
85
+ */
86
+ toTypedArray(includeUnusedCapacity = false) {
87
+ if (includeUnusedCapacity)
88
+ return this._data;
89
+ const subarray = this._data.subarray(0, this.length);
90
+ assert(subarray instanceof this._constructor);
91
+ assert(subarray.buffer === this._data.buffer);
92
+ return subarray;
93
+ }
94
+ }
95
+ /** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
96
+ * @public
97
+ */
98
+ export class Uint8ArrayBuilder extends TypedArrayBuilder {
99
+ /** @see [[TypedArrayBuilder]] constructor. */
100
+ constructor(options) {
101
+ super(Uint8Array, options);
102
+ }
103
+ }
104
+ /** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).
105
+ * @public
106
+ */
107
+ export class Uint16ArrayBuilder extends TypedArrayBuilder {
108
+ /** @see [[TypedArrayBuilder]] constructor. */
109
+ constructor(options) {
110
+ super(Uint16Array, options);
111
+ }
112
+ }
113
+ /** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).
114
+ * @public
115
+ */
116
+ export class Uint32ArrayBuilder extends TypedArrayBuilder {
117
+ /** @see [[TypedArrayBuilder]] constructor. */
118
+ constructor(options) {
119
+ super(Uint32Array, options);
120
+ }
121
+ /** Obtain a view of the finished array as an array of bytes. */
122
+ toUint8Array(includeUnusedCapacity = false) {
123
+ if (includeUnusedCapacity)
124
+ return new Uint8Array(this._data.buffer);
125
+ return new Uint8Array(this._data.buffer, 0, this.length * 4);
126
+ }
127
+ }
128
128
  //# sourceMappingURL=TypedArrayBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TypedArrayBuilder.js","sourceRoot":"","sources":["../../src/TypedArrayBuilder.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAqBlC;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,iBAAiB;IAU5B,sFAAsF;IACtF,YAAsB,WAA2B,EAAE,OAAkC;;QACnF,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,WAAW,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,mCAAI,CAA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O,CAAC,CAAC;IAC9B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAA8B;IACpE,8CAA8C;IAC9C,YAAmB,OAAkC;QACnD,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,gEAAgE;IACzD,YAAY,CAAC,qBAAqB,GAAG,KAAK;QAC/C,IAAI,qBAAqB;YACvB,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE3C,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Collections\n */\n\nimport { Constructor } from \"./UtilityTypes\";\nimport { assert } from \"./Assert\";\n\n/** Options used to construct a [[TypedArrayBuilder]].\n * @public\n */\nexport interface TypedArrayBuilderOptions {\n /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.\n * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.\n * Default: 1.5\n * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.\n */\n growthFactor?: number;\n /** The number of elements to allocate memory for in the TypedArray when creating the builder.\n * If you know the minimum number of elements you intend to add to the builder, you should specify that as the\n * initial capacity to avoid reallocations when populating the array.\n * Default: 0.\n * Minimum: 0.\n */\n initialCapacity?: number;\n}\n\n/** Incrementally builds a [TypedArray] of unsigned 8-, 16-, or 32-bit integers.\n * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.\n * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.\n *\n * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two \"size\" properties\":\n * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and\n * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].\n * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.\n *\n * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.\n * @public\n */\nexport class TypedArrayBuilder<T extends Uint8Array | Uint16Array | Uint32Array> {\n /** The constructor for the specific type of array being populated. */\n protected readonly _constructor: Constructor<T>;\n /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */\n protected _data: T;\n /** The number of elements added to the array so far. */\n protected _length: number;\n /** Multiplier applied to required capacity by [[ensureCapacity]]. */\n public readonly growthFactor: number;\n\n /** Constructs a new builder from the specified options, with a [[length]] of zero. */\n protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions) {\n this._constructor = constructor;\n this._data = new constructor(options?.initialCapacity ?? 0);\n this.growthFactor = Math.max(1.0, options?.growthFactor ?? 1.5);\n this._length = 0;\n }\n\n /** The number of elements currently in the array. */\n public get length(): number {\n return this._length;\n }\n\n /** The number of elements that can fit into the memory currently allocated for the array. */\n public get capacity(): number {\n return this._data.length;\n }\n\n /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),\n * returns the element at the specified index, with negative integers counting back from the end of the array.\n * @note It is your responsibility to ensure the index falls within the bounds of the array.\n */\n public at(index: number): number {\n if (index < 0)\n index = this.length - index;\n\n const value = this._data[index];\n assert(value !== undefined, \"index out of bounds\");\n return value;\n }\n\n /** Ensure that [[capacity]] is at least equal to `newCapacity`.\n * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.\n * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.\n *\n * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.\n * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.\n * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.\n */\n public ensureCapacity(newCapacity: number): number {\n if (this.capacity >= newCapacity)\n return this.capacity;\n\n assert(this.growthFactor >= 1.0);\n newCapacity = Math.ceil(newCapacity * this.growthFactor);\n const prevData = this._data;\n this._data = new this._constructor(newCapacity);\n this._data.set(prevData, 0);\n\n assert(this.capacity === newCapacity);\n return this.capacity;\n }\n\n /** Append the specified value, resizing if necessary. */\n public push(value: number): void {\n this.ensureCapacity(this.length + 1);\n this._data[this.length] = value;\n ++this._length;\n }\n\n /** Append an array of values, resizing (at most once) if necessary. */\n public append(values: T): void {\n const newLength = this.length + values.length;\n this.ensureCapacity(newLength);\n this._data.set(values, this.length);\n this._length = newLength;\n }\n\n /** Obtain the finished array.\n * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the\n * returned array's length will be equal to [[length]].\n */\n public toTypedArray(includeUnusedCapacity = false): T {\n if (includeUnusedCapacity)\n return this._data;\n\n const subarray = this._data.subarray(0, this.length);\n assert(subarray instanceof this._constructor);\n assert(subarray.buffer === this._data.buffer);\n return subarray;\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).\n * @public\n */\nexport class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {\n /** @see [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint8Array, options);\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).\n * @public\n */\nexport class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {\n /** @see [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint16Array, options);\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).\n * @public\n */\nexport class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {\n /** @see [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint32Array, options);\n }\n\n /** Obtain a view of the finished array as an array of bytes. */\n public toUint8Array(includeUnusedCapacity = false): Uint8Array {\n if (includeUnusedCapacity)\n return new Uint8Array(this._data.buffer);\n\n return new Uint8Array(this._data.buffer, 0, this.length * 4);\n }\n}\n"]}
1
+ {"version":3,"file":"TypedArrayBuilder.js","sourceRoot":"","sources":["../../src/TypedArrayBuilder.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAqBlC;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,iBAAiB;IAU5B,sFAAsF;IACtF,YAAsB,WAA2B,EAAE,OAAkC;;QACnF,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,WAAW,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,mCAAI,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,mCAAI,GAAG,CAAC,CAAC;QAChE,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,qDAAqD;IACrD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,6FAA6F;IAC7F,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,KAAK,C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CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Collections\r\n */\r\n\r\nimport { Constructor } from \"./UtilityTypes\";\r\nimport { assert } from \"./Assert\";\r\n\r\n/** Options used to construct a [[TypedArrayBuilder]].\r\n * @public\r\n */\r\nexport interface TypedArrayBuilderOptions {\r\n /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.\r\n * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.\r\n * Default: 1.5\r\n * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.\r\n */\r\n growthFactor?: number;\r\n /** The number of elements to allocate memory for in the TypedArray when creating the builder.\r\n * If you know the minimum number of elements you intend to add to the builder, you should specify that as the\r\n * initial capacity to avoid reallocations when populating the array.\r\n * Default: 0.\r\n * Minimum: 0.\r\n */\r\n initialCapacity?: number;\r\n}\r\n\r\n/** Incrementally builds a [TypedArray] of unsigned 8-, 16-, or 32-bit integers.\r\n * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.\r\n * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.\r\n *\r\n * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two \"size\" properties\":\r\n * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and\r\n * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].\r\n * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.\r\n *\r\n * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].\r\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.\r\n * @public\r\n */\r\nexport class TypedArrayBuilder<T extends Uint8Array | Uint16Array | Uint32Array> {\r\n /** The constructor for the specific type of array being populated. */\r\n protected readonly _constructor: Constructor<T>;\r\n /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */\r\n protected _data: T;\r\n /** The number of elements added to the array so far. */\r\n protected _length: number;\r\n /** Multiplier applied to required capacity by [[ensureCapacity]]. */\r\n public readonly growthFactor: number;\r\n\r\n /** Constructs a new builder from the specified options, with a [[length]] of zero. */\r\n protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions) {\r\n this._constructor = constructor;\r\n this._data = new constructor(options?.initialCapacity ?? 0);\r\n this.growthFactor = Math.max(1.0, options?.growthFactor ?? 1.5);\r\n this._length = 0;\r\n }\r\n\r\n /** The number of elements currently in the array. */\r\n public get length(): number {\r\n return this._length;\r\n }\r\n\r\n /** The number of elements that can fit into the memory currently allocated for the array. */\r\n public get capacity(): number {\r\n return this._data.length;\r\n }\r\n\r\n /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),\r\n * returns the element at the specified index, with negative integers counting back from the end of the array.\r\n * @note It is your responsibility to ensure the index falls within the bounds of the array.\r\n */\r\n public at(index: number): number {\r\n if (index < 0)\r\n index = this.length - index;\r\n\r\n const value = this._data[index];\r\n assert(value !== undefined, \"index out of bounds\");\r\n return value;\r\n }\r\n\r\n /** Ensure that [[capacity]] is at least equal to `newCapacity`.\r\n * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.\r\n * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.\r\n *\r\n * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.\r\n * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.\r\n * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.\r\n */\r\n public ensureCapacity(newCapacity: number): number {\r\n if (this.capacity >= newCapacity)\r\n return this.capacity;\r\n\r\n assert(this.growthFactor >= 1.0);\r\n newCapacity = Math.ceil(newCapacity * this.growthFactor);\r\n const prevData = this._data;\r\n this._data = new this._constructor(newCapacity);\r\n this._data.set(prevData, 0);\r\n\r\n assert(this.capacity === newCapacity);\r\n return this.capacity;\r\n }\r\n\r\n /** Append the specified value, resizing if necessary. */\r\n public push(value: number): void {\r\n this.ensureCapacity(this.length + 1);\r\n this._data[this.length] = value;\r\n ++this._length;\r\n }\r\n\r\n /** Append an array of values, resizing (at most once) if necessary. */\r\n public append(values: T): void {\r\n const newLength = this.length + values.length;\r\n this.ensureCapacity(newLength);\r\n this._data.set(values, this.length);\r\n this._length = newLength;\r\n }\r\n\r\n /** Obtain the finished array.\r\n * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the\r\n * returned array's length will be equal to [[length]].\r\n */\r\n public toTypedArray(includeUnusedCapacity = false): T {\r\n if (includeUnusedCapacity)\r\n return this._data;\r\n\r\n const subarray = this._data.subarray(0, this.length);\r\n assert(subarray instanceof this._constructor);\r\n assert(subarray.buffer === this._data.buffer);\r\n return subarray;\r\n }\r\n}\r\n\r\n/** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).\r\n * @public\r\n */\r\nexport class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {\r\n /** @see [[TypedArrayBuilder]] constructor. */\r\n public constructor(options?: TypedArrayBuilderOptions) {\r\n super(Uint8Array, options);\r\n }\r\n}\r\n\r\n/** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).\r\n * @public\r\n */\r\nexport class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {\r\n /** @see [[TypedArrayBuilder]] constructor. */\r\n public constructor(options?: TypedArrayBuilderOptions) {\r\n super(Uint16Array, options);\r\n }\r\n}\r\n\r\n/** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).\r\n * @public\r\n */\r\nexport class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {\r\n /** @see [[TypedArrayBuilder]] constructor. */\r\n public constructor(options?: TypedArrayBuilderOptions) {\r\n super(Uint32Array, options);\r\n }\r\n\r\n /** Obtain a view of the finished array as an array of bytes. */\r\n public toUint8Array(includeUnusedCapacity = false): Uint8Array {\r\n if (includeUnusedCapacity)\r\n return new Uint8Array(this._data.buffer);\r\n\r\n return new Uint8Array(this._data.buffer, 0, this.length * 4);\r\n }\r\n}\r\n"]}
@@ -1,44 +1,44 @@
1
- /** @packageDocumentation
2
- * @module Errors
3
- */
4
- /// <reference types="node" />
5
- /** A function to be notified when an unexpected error happens
6
- * @public
7
- */
8
- export declare type OnUnexpectedError = (error: any) => void;
9
- /**
10
- * Utility for handling/reporting unexpected runtime errors. This class establishes a global handler for
11
- * unexpected errors, and programmers should use its `handle` method when they occur. Generally, unexpected
12
- * errors should not cause program termination, and should instead be logged and swallowed. However, for
13
- * development/debugging, it can be helpful to re-throw exceptions so they are not missed.
14
- * @public
15
- */
16
- export declare class UnexpectedErrors {
17
- /** handler for re-throwing exceptions directly */
18
- static readonly reThrowImmediate: (e: any) => never;
19
- /** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */
20
- static readonly reThrowDeferred: (e: any) => NodeJS.Timeout;
21
- /** handler for logging exception to console */
22
- static readonly consoleLog: (e: any) => void;
23
- /** handler for logging exception with [[Logger]] */
24
- static readonly errorLog: (e: any) => void;
25
- private static _telemetry;
26
- private static _handler;
27
- private constructor();
28
- /** Add a "telemetry tracker" for unexpected errors. Useful for tracking/reporting errors without changing handler.
29
- * @returns a method to remove the tracker
30
- */
31
- static addTelemetry(tracker: OnUnexpectedError): () => void;
32
- /** call this method when an unexpected error happens so the global handler can process it.
33
- * @param error the unexpected error
34
- * @param notifyTelemetry if false, don't notify telemetry trackers. Use this for exceptions from third-party code, for example.
35
- */
36
- static handle(error: any, notifyTelemetry?: boolean): void;
37
- /** establish a new global *unexpected error* handler.
38
- * @param handler the new global handler. You may provide your own function or use one of the static members of this class.
39
- * The default is [[errorLog]].
40
- * @returns the previous handler. Useful to temporarily change the handler.
41
- */
42
- static setHandler(handler: OnUnexpectedError): OnUnexpectedError;
43
- }
1
+ /** @packageDocumentation
2
+ * @module Errors
3
+ */
4
+ /// <reference types="node" />
5
+ /** A function to be notified when an unexpected error happens
6
+ * @public
7
+ */
8
+ export declare type OnUnexpectedError = (error: any) => void;
9
+ /**
10
+ * Utility for handling/reporting unexpected runtime errors. This class establishes a global handler for
11
+ * unexpected errors, and programmers should use its `handle` method when they occur. Generally, unexpected
12
+ * errors should not cause program termination, and should instead be logged and swallowed. However, for
13
+ * development/debugging, it can be helpful to re-throw exceptions so they are not missed.
14
+ * @public
15
+ */
16
+ export declare class UnexpectedErrors {
17
+ /** handler for re-throwing exceptions directly */
18
+ static readonly reThrowImmediate: (e: any) => never;
19
+ /** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */
20
+ static readonly reThrowDeferred: (e: any) => NodeJS.Timeout;
21
+ /** handler for logging exception to console */
22
+ static readonly consoleLog: (e: any) => void;
23
+ /** handler for logging exception with [[Logger]] */
24
+ static readonly errorLog: (e: any) => void;
25
+ private static _telemetry;
26
+ private static _handler;
27
+ private constructor();
28
+ /** Add a "telemetry tracker" for unexpected errors. Useful for tracking/reporting errors without changing handler.
29
+ * @returns a method to remove the tracker
30
+ */
31
+ static addTelemetry(tracker: OnUnexpectedError): () => void;
32
+ /** call this method when an unexpected error happens so the global handler can process it.
33
+ * @param error the unexpected error
34
+ * @param notifyTelemetry if false, don't notify telemetry trackers. Use this for exceptions from third-party code, for example.
35
+ */
36
+ static handle(error: any, notifyTelemetry?: boolean): void;
37
+ /** establish a new global *unexpected error* handler.
38
+ * @param handler the new global handler. You may provide your own function or use one of the static members of this class.
39
+ * The default is [[errorLog]].
40
+ * @returns the previous handler. Useful to temporarily change the handler.
41
+ */
42
+ static setHandler(handler: OnUnexpectedError): OnUnexpectedError;
43
+ }
44
44
  //# sourceMappingURL=UnexpectedErrors.d.ts.map