Add topology builder

This commit is contained in:
superkor
2026-01-15 20:02:28 -05:00
committed by Johnathon Slightham
parent 9aa5737040
commit 4ab51dc9b0
3 changed files with 82 additions and 27 deletions

View File

@@ -0,0 +1,26 @@
#ifndef TOPOLOGYBUILDER
#define TOPOLOGYBUILDER
#include "SerializedMessage.h"
#include <vector>
#include "constants/datalink.h"
#include "constants/rmt.h"
#include "flatbuffers_generated/Topology_generated.h"
#include "flatbuffers/flatbuffers.h"
namespace Flatbuffers {
class TopologyBuilder {
public:
TopologyBuilder() : builder_(RIP_MAX_ROUTES*(sizeof(Topology::NeighbourBlob) + sizeof(Topology::ChannelBoardConn)*MAX_CHANNELS)) {}
SerializedMessage build_topology(const std::vector<flatbuffers::Offset<Topology::NeighbourBlob>>& topology);
flatbuffers::Offset<Topology::NeighbourBlob> build_neighbour_info(uint16_t board_id, const std::vector<Topology::ChannelBoardConn>& connections);
Topology::ChannelBoardConn build_connections(uint8_t channel, uint16_t board_id);
private:
flatbuffers::FlatBufferBuilder builder_;
};
}
#endif //TOPOLOGYBUILDER