MCPcopy Create free account
hub / github.com/chrxh/alien / writeGenome

Function writeGenome

source/EngineInterface/GenomeDescriptionService.cpp:61–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 }
60 void writeStiffness(std::vector<uint8_t>& data, float value) { data.emplace_back(static_cast<uint8_t>(value * 255)); }
61 void writeGenome(std::vector<uint8_t>& data, std::variant<MakeGenomeCopy, std::vector<uint8_t>> const& value)
62 {
63 auto makeGenomeCopy = std::holds_alternative<MakeGenomeCopy>(value);
64 writeBool(data, makeGenomeCopy);
65 if (!makeGenomeCopy) {
66 auto genome = std::get<std::vector<uint8_t>>(value);
67 writeWord(data, static_cast<int>(genome.size()));
68 data.insert(data.end(), genome.begin(), genome.end());
69 }
70 }
71
72 uint8_t readByte(std::vector<uint8_t> const& data, int& pos)
73 {

Callers 1

Calls 5

writeBoolFunction · 0.85
writeWordFunction · 0.85
sizeMethod · 0.80
endMethod · 0.80
beginMethod · 0.80

Tested by

no test coverage detected