A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
bit-deserializer.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 BITDESERIALIZER_H_
22
#define BITDESERIALIZER_H_
23
24
#include <vector>
25
#include <deque>
26
27
namespace
ns3
{
28
42
class
BitDeserializer
43
{
44
public
:
45
BitDeserializer
();
46
51
void
PushBytes
(std::vector<uint8_t> bytes);
52
58
void
PushBytes
(uint8_t* bytes, uint32_t size);
59
64
void
PushByte
(uint8_t
byte
);
65
75
uint64_t
GetBits
(uint8_t size);
76
77
private
:
81
void
PrepareDeserialization
();
82
83
std::deque<bool>
m_blob
;
84
std::vector<uint8_t>
m_bytesBlob
;
85
bool
m_deserializing
;
86
};
87
88
}
// namespace ns3
89
90
#endif
/* BITDESERIALIZER_H_ */
ns3::BitDeserializer::GetBits
uint64_t GetBits(uint8_t size)
Pops a given number of bits from the blob front.
Definition:
bit-deserializer.cc:60
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::BitDeserializer::PushBytes
void PushBytes(std::vector< uint8_t > bytes)
Pushes some bytes into the blob to be deserialized.
Definition:
bit-deserializer.cc:36
ns3::BitDeserializer::PushByte
void PushByte(uint8_t byte)
Pushes one byte into the blob to be deserialized.
Definition:
bit-deserializer.cc:53
ns3::BitDeserializer::PrepareDeserialization
void PrepareDeserialization()
Prepare the byte array to the deserialization.
Definition:
bit-deserializer.cc:78
ns3::BitDeserializer::m_bytesBlob
std::vector< uint8_t > m_bytesBlob
Blob of bytes to be deserialized.
Definition:
bit-deserializer.h:84
ns3::BitDeserializer::m_deserializing
bool m_deserializing
True if the deserialization did start already.
Definition:
bit-deserializer.h:85
ns3::BitDeserializer::BitDeserializer
BitDeserializer()
Definition:
bit-deserializer.cc:30
ns3::BitDeserializer::m_blob
std::deque< bool > m_blob
Blob of bits ready to be deserialized.
Definition:
bit-deserializer.h:83
ns3::BitDeserializer
Bit deserializer.
Definition:
bit-deserializer.h:43
src
network
utils
bit-deserializer.h
Generated on Fri Oct 1 2021 17:03:30 for ns-3 by
1.8.20