• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16export class TransferPayload extends Object {
17  private _index: number; // uint64_t
18  private _compressType: number; // uint8_t;
19  private _compressSize: number; // uint32_t
20  private _uncompressSize: number; //uint32_t
21
22  constructor(index: number, compressType: number, compressSize: number, uncompressSize: number) {
23    super();
24    this._index = index;
25    this._compressType = compressType;
26    this._compressSize = compressSize;
27    this._uncompressSize = uncompressSize;
28  }
29
30  getDataView(): DataView {
31    const view = new DataView(new ArrayBuffer(24));
32    return view;
33  }
34
35  get index(): number {
36    return this._index;
37  }
38
39  set index(value: number) {
40    this._index = value;
41  }
42
43  get compressType(): number {
44    return this._compressType;
45  }
46
47  set compressType(value: number) {
48    this._compressType = value;
49  }
50
51  get compressSize(): number {
52    return this._compressSize;
53  }
54
55  set compressSize(value: number) {
56    this._compressSize = value;
57  }
58
59  get uncompressSize(): number {
60    return this._uncompressSize;
61  }
62
63  set uncompressSize(value: number) {
64    this._uncompressSize = value;
65  }
66
67  toString(): string {
68    return (
69      'index: ' +
70      this._index +
71      ' compressType: ' +
72      this._compressType +
73      ' compressSize: ' +
74      this._compressSize +
75      ' uncompressSize: ' +
76      this._uncompressSize
77    );
78  }
79}
80