b767b5b85e
App C++ ImGui que abre cualquier operations.db del registry y lo visualiza
como grafo con shapes/iconos/layouts/filtros/labels.
Composicion del registry:
- viz/graph_renderer + graph_force_layout(_gpu) + graph_layouts +
graph_viewport + graph_labels + graph_icons + graph_sources
- core: toolbar, modal_dialog, select, text_input, tree_view, page_header,
fullscreen_window, button, badge, empty_state
Capas:
- data.{h,cpp} — dispatcher GraphLoadFn (operations hoy; json/graphml manana).
- types_registry.{h,cpp} — parser YAML minimal + tabler_codepoint_by_name +
apply_types_yaml + IconAtlas builder.
- views.{h,cpp} — Toolbar, Legend, Inspector, Stats, modal Filters/Open.
- layout_store.{h,cpp} — graph_explorer.db SQLite con tabla layouts(graph_hash,
node_id, x, y, pinned, updated_at). UPSERT por nodo.
- main.cpp — CLI (--input/--types/--layout) + fn::run_app + bucle
force layout (CPU/GPU toggle) + render con 3 columnas (Legend / Viewport /
Inspector+Stats).
examples/types.yaml: 10 entidades OSINT (Person/Email/Domain/Phone/Org/IBAN/
Account/Document/Address/Url) + 5 relaciones (owns/knows/located_in/
transfers_to/member_of) con shapes Tabler reales.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
struct GraphData;
|
|
|
|
namespace ge {
|
|
|
|
// Persistencia de posiciones de nodos en `graph_explorer.db` (SQLite junto al
|
|
// exe). Una unica tabla:
|
|
//
|
|
// layouts(graph_hash TEXT, node_id TEXT, x REAL, y REAL,
|
|
// pinned INTEGER, updated_at INTEGER,
|
|
// PRIMARY KEY(graph_hash, node_id))
|
|
//
|
|
// `graph_hash` se calcula a partir del path absoluto del input (operations.db
|
|
// o similar). Mismo input → mismas posiciones recuperables. `node_id` es
|
|
// el `user_data` del nodo formateado en hex (lo que `graph_load_from_operations`
|
|
// rellena con el FNV1a del id de la BD origen).
|
|
|
|
// Devuelve un hash estable del path canonico. 0 si path es null/vacio.
|
|
uint64_t compute_graph_hash(const char* path);
|
|
|
|
// Asegura que la BD existe y la tabla esta creada. Devuelve true en exito.
|
|
bool layout_store_open(const char* db_path);
|
|
void layout_store_close();
|
|
|
|
// Guarda las posiciones (y NF_PINNED) de todos los nodos del grafo bajo la
|
|
// clave `graph_hash`. UPSERT por (graph_hash, node_id). Devuelve el numero
|
|
// de filas escritas (>= 0). En error, devuelve -1.
|
|
int layout_store_save(uint64_t graph_hash, const GraphData& graph);
|
|
|
|
// Aplica las posiciones guardadas al grafo. Recorre los nodos y, para cada
|
|
// uno cuyo `user_data` exista en la tabla con el hash dado, sobrescribe
|
|
// `x`, `y`, y los flags `NF_PINNED`. Nodos sin entrada se quedan tal cual.
|
|
// Devuelve el numero de nodos actualizados.
|
|
int layout_store_load(uint64_t graph_hash, GraphData& graph);
|
|
|
|
} // namespace ge
|