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