-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from flora-suite/feature/upstream
Fix toggling of panels by listen only to revert event
- Loading branch information
Showing
7 changed files
with
173 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/ | ||
|
||
/** | ||
* Values of the contants below are a (more or less) informed guesses and not guaranteed to be accurate. | ||
*/ | ||
export const COMPRESSED_POINTER_SIZE = 4; // Pointers use 4 bytes (also on 64-bit systems) due to pointer compression | ||
export const OBJECT_BASE_SIZE = 3 * COMPRESSED_POINTER_SIZE; // 3 compressed pointers | ||
// Arrays have an additional length property (1 pointer) and a backing store header (2 pointers) | ||
// See https://stackoverflow.com/a/70550693. | ||
export const ARRAY_BASE_SIZE = OBJECT_BASE_SIZE + 3 * COMPRESSED_POINTER_SIZE; | ||
export const TYPED_ARRAY_BASE_SIZE = 25 * COMPRESSED_POINTER_SIZE; // byteLength, byteOffset, ..., see https://stackoverflow.com/a/45808835 | ||
export const SMALL_INTEGER_SIZE = COMPRESSED_POINTER_SIZE; // Small integers (up to 31 bits), pointer tagging | ||
export const HEAP_NUMBER_SIZE = 8 + 2 * COMPRESSED_POINTER_SIZE; // 4-byte map pointer + 8-byte payload + property pointer | ||
export const FIELD_SIZE_BY_PRIMITIVE: Record<string, number> = { | ||
bool: SMALL_INTEGER_SIZE, | ||
int8: SMALL_INTEGER_SIZE, | ||
uint8: SMALL_INTEGER_SIZE, | ||
int16: SMALL_INTEGER_SIZE, | ||
uint16: SMALL_INTEGER_SIZE, | ||
int32: SMALL_INTEGER_SIZE, | ||
uint32: SMALL_INTEGER_SIZE, | ||
float32: HEAP_NUMBER_SIZE, | ||
float64: HEAP_NUMBER_SIZE, | ||
int64: HEAP_NUMBER_SIZE, | ||
uint64: HEAP_NUMBER_SIZE, | ||
time: OBJECT_BASE_SIZE + 2 * HEAP_NUMBER_SIZE + COMPRESSED_POINTER_SIZE, | ||
duration: OBJECT_BASE_SIZE + 2 * HEAP_NUMBER_SIZE + COMPRESSED_POINTER_SIZE, | ||
string: 20, // we don't know the length upfront, assume a fixed length | ||
}; | ||
export const MAX_NUM_FAST_PROPERTIES = 1020; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/suite-base/src/testing/builders/MessageEventBuilder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/ | ||
|
||
import { MessageEvent } from "@lichtblick/suite"; | ||
import BasicBuilder from "@lichtblick/suite-base/testing/builders/BasicBuilder"; | ||
import RosTimeBuilder from "@lichtblick/suite-base/testing/builders/RosTimeBuilder"; | ||
import { defaults } from "@lichtblick/suite-base/testing/builders/utilities"; | ||
|
||
class MessageEventBuilder { | ||
public static messageEvent<T>(props: Partial<MessageEvent<T>> = {}): MessageEvent<T> { | ||
return defaults<MessageEvent<T>>(props, { | ||
message: BasicBuilder.stringMap() as T, | ||
publishTime: RosTimeBuilder.time(), | ||
receiveTime: RosTimeBuilder.time(), | ||
schemaName: BasicBuilder.string(), | ||
sizeInBytes: BasicBuilder.number(), | ||
topic: BasicBuilder.string(), | ||
topicConfig: BasicBuilder.stringMap(), | ||
}); | ||
} | ||
|
||
public static messageEvents(count = 3): MessageEvent[] { | ||
return BasicBuilder.multiple(MessageEventBuilder.messageEvent, count); | ||
} | ||
} | ||
|
||
export default MessageEventBuilder; |