quic/qbox
Loading...
Searching...
No Matches
systemc-components
common
include
macs
payload.h
1
/*
2
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
3
* Author: GreenSocs 2022
4
*
5
* SPDX-License-Identifier: BSD-3-Clause
6
*/
7
8
#pragma once
9
10
#include <inttypes.h>
11
#include <sys/types.h>
12
#include <systemc>
13
14
class
Payload
15
{
16
private
:
17
uint8_t* m_buffer;
18
size_t
m_size;
19
size_t
m_capacity;
20
21
public
:
22
Payload
(
size_t
capacity): m_size(0), m_capacity(capacity) { m_buffer =
new
uint8_t[capacity]; }
23
~Payload
()
24
{
25
if
(m_buffer) {
26
delete
[] m_buffer;
27
}
28
m_buffer =
nullptr
;
29
}
30
31
size_t
capacity()
const
{
return
m_capacity; }
32
size_t
size()
const
{
return
m_size; }
33
uint8_t* data()
const
{
return
m_buffer; }
34
35
void
resize(
size_t
size)
36
{
37
assert
(size <= m_capacity);
38
m_size = size;
39
}
40
41
private
:
42
Payload
(
const
Payload
&);
43
Payload
& operator=(
const
Payload
&);
44
};
Payload
Definition
payload.h:15
QemuTargetSocket
Definition
target.h:160
Generated by
1.9.8