A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
bit-serializer.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 Universita' di Firenze, Italy
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
18
*/
19
20
#ifndef BITSERIALIZER_H_
21
#define BITSERIALIZER_H_
22
23
#include <cstdint>
24
#include <vector>
25
26
namespace
ns3
27
{
28
59
class
BitSerializer
60
{
61
public
:
62
BitSerializer
();
63
68
void
InsertPaddingAtEnd
(
bool
padAtEnd);
69
75
void
PushBits
(uint64_t value, uint8_t significantBits);
76
86
std::vector<uint8_t>
GetBytes
();
87
99
uint8_t
GetBytes
(uint8_t* buffer, uint32_t size);
100
101
private
:
105
void
PadAtStart
();
106
110
void
PadAtEnd
();
111
112
std::vector<bool>
m_blob
;
113
bool
m_padAtEnd
;
114
};
115
116
}
// namespace ns3
117
118
#endif
/* BITSERIALIZER_H_ */
ns3::BitSerializer
Bit serializer.
Definition:
bit-serializer.h:60
ns3::BitSerializer::m_padAtEnd
bool m_padAtEnd
True if the padding must be added at the end of the blob.
Definition:
bit-serializer.h:113
ns3::BitSerializer::PushBits
void PushBits(uint64_t value, uint8_t significantBits)
Pushes a number of bits in the blob.
Definition:
bit-serializer.cc:65
ns3::BitSerializer::BitSerializer
BitSerializer()
Definition:
bit-serializer.cc:33
ns3::BitSerializer::PadAtStart
void PadAtStart()
Add the padding at the start of the blob.
Definition:
bit-serializer.cc:47
ns3::BitSerializer::GetBytes
std::vector< uint8_t > GetBytes()
Get the bytes representation of the blob.
Definition:
bit-serializer.cc:87
ns3::BitSerializer::m_blob
std::vector< bool > m_blob
Blob of serialized bits.
Definition:
bit-serializer.h:112
ns3::BitSerializer::InsertPaddingAtEnd
void InsertPaddingAtEnd(bool padAtEnd)
Toggles the padding insertion policy.
Definition:
bit-serializer.cc:40
ns3::BitSerializer::PadAtEnd
void PadAtEnd()
Add the padding at the end of the blob.
Definition:
bit-serializer.cc:57
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
network
utils
bit-serializer.h
Generated on Sun Mar 3 2024 17:11:06 for ns-3 by
1.9.1