Skip to content

Add annotations for offset based references #198

@VeaaC

Description

@VeaaC

In flatdata archives users often use a pattern in which they reference other resources with relative references, e.g.:

struct Node
{
    @range(edge_refs)
    first_edge_ref : u32;
}

struct Edge
{
    target_ref : u32;
    value : u32;
}

struct GraphIndex
{
    @range(node_refs)
    first_node_ref : u32;
    @range(edge_refs)
    first_edge_ref : u32;
}

archive Ch
{
    // this actually  is a relative reference: first_edge_ref +  GraphIndex.first_edge_ref
    @explicit_reference( Node.first_edge_ref, edges )
    nodes : vector< Node >;
   // this actually  is a relative reference: target_ref +  GraphIndex.first_node_ref
    @explicit_reference( Edge.target_ref, nodes )
    edges : vector< Edge >;
    index: vector< GraphIndex >;
}

It would be nice to add a special reference annotation to make this more visible for the user (and maybe enable code generation later on)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions