Skip to content

Commit

Permalink
Minor Hierarchy stream improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Werni2A committed Dec 31, 2023
1 parent 2611f05 commit bd56f42
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Streams/StreamHierarchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,22 @@ void StreamHierarchy::read(FileFormatVersion aVersion)

mCtx.mLogger.trace("schematicName = {}", schematicName);

ds.printUnknownData(9, getMethodName(this, __func__) + ": 1");
ds.printUnknownData(7U, getMethodName(this, __func__) + ": 1");

const uint16_t lenSthInHierarchy2s = ds.readUint16();

mCtx.mLogger.trace("lenSthInHierarchy2s = {}", lenSthInHierarchy2s);

for(std::size_t i{0U}; i < lenSthInHierarchy2s; ++i)
{
sthInHierarchy2s.push_back(dynamic_pointer_cast<StructSthInHierarchy2>(parser.readStructure()));

ds.printUnknownData(4U, getMethodName(this, __func__) + ": 1.53");

const std::string someName = ds.readStringLenZeroTerm();

mCtx.mLogger.trace("someName = {}", someName);
}

const uint16_t lenNetDbIdMappings = ds.readUint16();

Expand Down
11 changes: 11 additions & 0 deletions src/Streams/StreamHierarchy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "Structures/StructNetDbIdMapping.hpp"
#include "Structures/StructSomeHierarchyBase.hpp"
#include "Structures/StructSthInHierarchy1.hpp"
#include "Structures/StructSthInHierarchy2.hpp"
#include "Structures/StructSthInHierarchy3.hpp"
#include "Structures/StructT0x5b.hpp"

Expand All @@ -36,6 +37,7 @@ class StreamHierarchy : public Stream
aVisitor.visit(*this);
}

std::vector<std::unique_ptr<StructSthInHierarchy2>> sthInHierarchy2s;
std::vector<std::unique_ptr<StructNetDbIdMapping>> netDbIdMappings;
std::vector<std::unique_ptr<StructSthInHierarchy3>> sthInHierarchy3s;
std::vector<std::unique_ptr<StructT0x5b>> t0x5bs;
Expand All @@ -51,6 +53,15 @@ static std::string to_string(const StreamHierarchy& aObj)

str += fmt::format("{}:\n", nameof::nameof_type<decltype(aObj)>());

str += fmt::format("{}sthInHierarchy2s:\n", indent(1));
for(size_t i = 0u; i < aObj.sthInHierarchy2s.size(); ++i)
{
if(aObj.sthInHierarchy2s[i])
{
str += indent(fmt::format("[{}]: {}", i, aObj.sthInHierarchy2s[i]->to_string()), 2);
}
}

str += fmt::format("{}netDbIdMappings:\n", indent(1));
for(size_t i = 0u; i < aObj.netDbIdMappings.size(); ++i)
{
Expand Down

0 comments on commit bd56f42

Please sign in to comment.