1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | class TopicAliasRecv {
|
4 | constructor(max) {
|
5 | this.aliasToTopic = {};
|
6 | this.max = max;
|
7 | }
|
8 | put(topic, alias) {
|
9 | if (alias === 0 || alias > this.max) {
|
10 | return false;
|
11 | }
|
12 | this.aliasToTopic[alias] = topic;
|
13 | this.length = Object.keys(this.aliasToTopic).length;
|
14 | return true;
|
15 | }
|
16 | getTopicByAlias(alias) {
|
17 | return this.aliasToTopic[alias];
|
18 | }
|
19 | clear() {
|
20 | this.aliasToTopic = {};
|
21 | }
|
22 | }
|
23 | exports.default = TopicAliasRecv;
|
24 |
|
\ | No newline at end of file |