-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPacket.cpp
More file actions
33 lines (28 loc) · 763 Bytes
/
Packet.cpp
File metadata and controls
33 lines (28 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "Packet.h"
Packet::Packet()
{
raw_data = std::vector<char>();
c_packet = std::vector<Complex>();
}
Packet::Packet(int samples_num) : Packet()
{
for (int i = 0; i < samples_num; i++)
{
raw_data.push_back(0);
//Create a new Complex number with Re = 0, Im = 0
c_packet.push_back(Complex(0, 0));
}
size = samples_num;
}
Packet::Packet(char* buf, int samples_num) : Packet()
{
for (int i = 0; i < samples_num; i++)
{
char el = buf[i];
//Insert the raw data inside the vector
raw_data.push_back(el);
//Create a new Complex number with Re = el, Im = 0
c_packet.push_back(Complex((double)el, 0));
}
size = samples_num;
}