this is is the big big big data
parent
b25f397462
commit
0664ce85eb
Binary file not shown.
|
@ -1,16 +1,39 @@
|
||||||
# ninja log v5
|
# ninja log v5
|
||||||
5 1875 1698859762131031423 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o ac96ce6eea552e98
|
4 1469 1698953294073499706 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o ac96ce6eea552e98
|
||||||
5 2802 1698859763059011893 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o 5500266fb1697520
|
5 2802 1698859763059011893 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o 5500266fb1697520
|
||||||
6 4924 1698859765174967403 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler_v2.cpp.o e7304896d85ed918
|
6 4924 1698859765174967403 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler_v2.cpp.o e7304896d85ed918
|
||||||
6 4372 1698859764618979088 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o 3ccbe9961f7739c8
|
6 4372 1698859764618979088 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o 3ccbe9961f7739c8
|
||||||
2 1240 1698859761499044732 CMakeFiles/AssignmentProject.dir/src/main.cpp.o 519d75b42539078d
|
2 3571 1698953296169250965 CMakeFiles/AssignmentProject.dir/src/main.cpp.o 519d75b42539078d
|
||||||
5437 5557 1698859765810954042 AssignmentProject 4b71d2492f56ed6a
|
4717 4929 1698953297529090245 AssignmentProject c7d6a3a2040ef3aa
|
||||||
|
0 103 1698953451329703921 build.ninja a40327fdfd9abe67
|
||||||
3 2049 1698859762307027720 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/format.cpp.o 88acf1e13074560c
|
3 2049 1698859762307027720 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/format.cpp.o 88acf1e13074560c
|
||||||
7 4454 1698859764694977491 libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o 63d9843266c3e3f8
|
5 4206 1698953296797176680 libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o 63d9843266c3e3f8
|
||||||
4924 5437 1698859765666957067 libraries/BLT/libBLT.a f5b601d9b774b003
|
4206 4717 1698953297293118093 libraries/BLT/libBLT.a f5b601d9b774b003
|
||||||
4 4651 1698859764898973202 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o dd234ba43f752924
|
4 4651 1698859764898973202 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o dd234ba43f752924
|
||||||
4 2631 1698859762887015512 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o 4c619d81fe5732f0
|
3 2435 1698953295037385140 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o 4c619d81fe5732f0
|
||||||
7 1229 1698859761487044985 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt_block.cpp.o 5e7e643c13f0b103
|
7 1229 1698859761487044985 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt_block.cpp.o 5e7e643c13f0b103
|
||||||
6 3607 1698859763858995067 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o 31fcb40edaba985e
|
6 3607 1698859763858995067 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o 31fcb40edaba985e
|
||||||
3 1583 1698859761839037571 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o 7cd9697546f581
|
3 1583 1698859761839037571 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o 7cd9697546f581
|
||||||
2 1968 1698859762223029488 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o 9e9f104a693ca6f5
|
3 2067 1698953294669428868 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o 9e9f104a693ca6f5
|
||||||
|
4 1273 1698953656526732873 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o ac96ce6eea552e98
|
||||||
|
3 1760 1698953657010702150 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o 9e9f104a693ca6f5
|
||||||
|
4 2104 1698953657350680590 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o 4c619d81fe5732f0
|
||||||
|
5 3921 1698953659158566033 libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o 63d9843266c3e3f8
|
||||||
|
2 2746 1698953700296017134 CMakeFiles/AssignmentProject.dir/src/main.cpp.o 7b18e037a23b35ad
|
||||||
|
3 4037 1698953701583939017 libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o 63d9843266c3e3f8
|
||||||
|
4038 4428 1698953701967915741 libraries/BLT/libBLT.a f5b601d9b774b003
|
||||||
|
4428 4662 1698953702215900719 AssignmentProject c7d6a3a2040ef3aa
|
||||||
|
3 2557 1698953766652108154 CMakeFiles/AssignmentProject.dir/src/main.cpp.o 7b18e037a23b35ad
|
||||||
|
2557 2786 1698953766884094865 AssignmentProject c7d6a3a2040ef3aa
|
||||||
|
2 2743 1698953804473972626 CMakeFiles/AssignmentProject.dir/src/main.cpp.o 7b18e037a23b35ad
|
||||||
|
2743 2962 1698953804697960153 AssignmentProject c7d6a3a2040ef3aa
|
||||||
|
3 3660 1698956357737298841 CMakeFiles/AssignmentProject.dir/src/main.cpp.o 7b18e037a23b35ad
|
||||||
|
3660 3882 1698956357961295064 AssignmentProject c7d6a3a2040ef3aa
|
||||||
|
3 3751 1698956437779991460 CMakeFiles/AssignmentProject.dir/src/main.cpp.o 7b18e037a23b35ad
|
||||||
|
3751 3988 1698956438019987651 AssignmentProject c7d6a3a2040ef3aa
|
||||||
|
3 3685 1698956783816311852 CMakeFiles/AssignmentProject.dir/src/main.cpp.o 7b18e037a23b35ad
|
||||||
|
3686 3912 1698956784048319538 AssignmentProject c7d6a3a2040ef3aa
|
||||||
|
3 3687 1698957622286652471 CMakeFiles/AssignmentProject.dir/src/main.cpp.o 7b18e037a23b35ad
|
||||||
|
3687 3919 1698957622522652509 AssignmentProject c7d6a3a2040ef3aa
|
||||||
|
3 3747 1698957647482651805 CMakeFiles/AssignmentProject.dir/src/main.cpp.o 7b18e037a23b35ad
|
||||||
|
3747 4032 1698957647770651743 AssignmentProject c7d6a3a2040ef3aa
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,3 @@
|
||||||
Start testing: Nov 01 22:19 EDT
|
Start testing: Nov 02 16:40 EDT
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
End testing: Nov 01 22:19 EDT
|
End testing: Nov 02 16:40 EDT
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
hello this is big data how may i help you?
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1 +1 @@
|
||||||
Subproject commit 1d8f9b4bbdb84647c8a96b1ef87d262afd7021cb
|
Subproject commit 15bcd37834628c941db5613fa62770426dff29e0
|
188
src/main.cpp
188
src/main.cpp
|
@ -1,7 +1,191 @@
|
||||||
|
/*
|
||||||
|
* Mail file containing the program entry point. I really want to name all this all femboy themed
|
||||||
|
* Copyright (C) 2023 Brett Terpstra
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include <blt/parse/argparse.h>
|
||||||
|
#include <blt/std/string.h>
|
||||||
|
#include <blt/std/logging.h>
|
||||||
|
#include <blt/std/memory.h>
|
||||||
|
#include <blt/std/random.h>
|
||||||
|
#include <blt/std/time.h>
|
||||||
|
#include <blt/std/assert.h>
|
||||||
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <ios>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
int main()
|
constexpr size_t PACKET_SIZE = 512;
|
||||||
|
|
||||||
|
class packet
|
||||||
{
|
{
|
||||||
std::cout << "Hello, World!" << std::endl;
|
private:
|
||||||
|
std::uint8_t* buffer = new std::uint8_t[PACKET_SIZE];
|
||||||
|
public:
|
||||||
|
size_t used = 0;
|
||||||
|
|
||||||
|
packet() = default;
|
||||||
|
|
||||||
|
packet(const packet& copy)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < PACKET_SIZE; i++)
|
||||||
|
buffer[i] = copy[i];
|
||||||
|
used = copy.used;
|
||||||
|
}
|
||||||
|
|
||||||
|
packet(packet&& move) noexcept
|
||||||
|
{
|
||||||
|
delete[] buffer;
|
||||||
|
buffer = move.buffer;
|
||||||
|
used = move.used;
|
||||||
|
move.buffer = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
packet& operator=(const packet& copy)
|
||||||
|
{
|
||||||
|
if (© == this)
|
||||||
|
return *this;
|
||||||
|
for (size_t i = 0; i < PACKET_SIZE; i++)
|
||||||
|
buffer[i] = copy[i];
|
||||||
|
used = copy.used;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
packet& operator=(packet&& move) noexcept
|
||||||
|
{
|
||||||
|
delete[] buffer;
|
||||||
|
buffer = move.buffer;
|
||||||
|
move.buffer = nullptr;
|
||||||
|
used = move.used;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::uint8_t* data()
|
||||||
|
{
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::uint8_t& operator[](size_t index)
|
||||||
|
{
|
||||||
|
BLT_ASSERT(index < PACKET_SIZE);
|
||||||
|
return buffer[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] const std::uint8_t& operator[](size_t index) const
|
||||||
|
{
|
||||||
|
BLT_ASSERT(index < PACKET_SIZE);
|
||||||
|
return buffer[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] size_t size() const
|
||||||
|
{
|
||||||
|
return used;
|
||||||
|
}
|
||||||
|
|
||||||
|
~packet()
|
||||||
|
{
|
||||||
|
delete[] buffer;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void mangle(packet& packet)
|
||||||
|
{
|
||||||
|
static std::random_device dev;
|
||||||
|
static std::mt19937_64 engine(dev());
|
||||||
|
static std::uniform_real_distribution dist(0.0, 1.0);
|
||||||
|
static std::uniform_int_distribution randomizer(0, 7);
|
||||||
|
|
||||||
|
// 50% chance to mangle 10% of the data.
|
||||||
|
if (dist(engine) < 0.5)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < PACKET_SIZE; i++)
|
||||||
|
if (dist(engine) < 0.1)
|
||||||
|
{
|
||||||
|
// this is bad
|
||||||
|
auto pos = static_cast<uint8_t>(exp2(randomizer(engine)));
|
||||||
|
// flip the bit
|
||||||
|
auto bit = ~(packet[i] & pos);
|
||||||
|
// extra everything but the bit
|
||||||
|
auto data = packet[i] & ~pos;
|
||||||
|
// recombine bit
|
||||||
|
packet[i] = data | bit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_packets(const std::vector<packet> packets)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, const char** argv)
|
||||||
|
{
|
||||||
|
|
||||||
|
blt::arg_parse parser;
|
||||||
|
parser.addArgument(
|
||||||
|
blt::arg_builder{"-f", "--file"}.setNArgs(1).setHelp("Specify a file to read from instead of cin").setAction(blt::arg_action_t::STORE)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
auto args = parser.parse_args(argc, argv);
|
||||||
|
|
||||||
|
std::vector<packet> packets;
|
||||||
|
|
||||||
|
if (args.contains("--file"))
|
||||||
|
{
|
||||||
|
auto& path = blt::arg_parse::get<std::string>(args.data["file"]);
|
||||||
|
|
||||||
|
std::ifstream file(path);
|
||||||
|
|
||||||
|
file.seekg(0, std::ifstream::end);
|
||||||
|
size_t length = file.tellg();
|
||||||
|
file.seekg(0, std::ifstream::beg);
|
||||||
|
|
||||||
|
blt::scoped_buffer<std::uint8_t> data(length);
|
||||||
|
|
||||||
|
file.read(reinterpret_cast<char*>(data.data()), static_cast<long>(length));
|
||||||
|
|
||||||
|
if (file)
|
||||||
|
BLT_INFO("All bytes have been read from the file, parsing into packets");
|
||||||
|
else
|
||||||
|
BLT_WARN("Only read %d characters, expected %d", file.gcount(), length);
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
size_t rp = 0;
|
||||||
|
while (rp < length)
|
||||||
|
{
|
||||||
|
packet p;
|
||||||
|
if (rp + PACKET_SIZE < length)
|
||||||
|
p.used = PACKET_SIZE;
|
||||||
|
else
|
||||||
|
p.used = length - rp;
|
||||||
|
std::memcpy(p.data(), &data[rp], p.used);
|
||||||
|
rp += PACKET_SIZE;
|
||||||
|
packets.push_back(std::move(p));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
packet p;
|
||||||
|
std::cin.read(reinterpret_cast<char*>(p.data()), PACKET_SIZE);
|
||||||
|
packets.push_back(std::move(p));
|
||||||
|
} while (!std::cin.eof() && !std::cin.fail());
|
||||||
|
}
|
||||||
|
|
||||||
|
process_packets(packets);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue