scene/tables/connections.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include <cstdint> | ||
| 5 | #include <initializer_list> | ||
| 6 | #include <span> | ||
| 7 | #include <string_view> | ||
| 8 | #include <vector> | ||
| 9 | |||
| 10 | #include "chrono_batch_render/stage/schema/ids.h" | ||
| 11 | #include "chrono_batch_render/stage/schema/schema.h" | ||
| 12 | |||
| 13 | namespace chrono::batch_render { | ||
| 14 | |||
| 15 | class Structure; | ||
| 16 | struct ChangeSet; | ||
| 17 | |||
| 18 | class ConnectionCache { | ||
| 19 | public: | ||
| 20 | 28 | struct Connection { | |
| 21 | std::string_view input; | ||
| 22 | uint32_t source = kNoPrim; | ||
| 23 | std::string_view output; | ||
| 24 | }; | ||
| 25 | |||
| 26 | 706 | ConnectionCache(Structure& structure, std::initializer_list<SchemaId> schemas) | |
| 27 | 706 | : m_structure(structure), m_schemas(schemas) {} | |
| 28 | |||
| 29 | void Update(const ChangeSet& changes); | ||
| 30 | |||
| 31 | 523 | std::span<const Connection> Get(uint32_t prim) const { | |
| 32 | 523 | return prim < m_connections.size() ? std::span<const Connection>(m_connections[prim]) | |
| 33 | 523 | : std::span<const Connection>(); | |
| 34 | } | ||
| 35 | |||
| 36 | private: | ||
| 37 | void Read(std::span<const uint32_t> owners); | ||
| 38 | |||
| 39 | Structure& m_structure; | ||
| 40 | std::vector<SchemaId> m_schemas; | ||
| 41 | std::vector<std::vector<Connection>> m_connections; | ||
| 42 | std::vector<uint32_t> m_rowPrims; | ||
| 43 | }; | ||
| 44 | |||
| 45 | } | ||
| 46 |