Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add annotations for offset based references #198

Open
VeaaC opened this issue Jan 5, 2021 · 0 comments
Open

Add annotations for offset based references #198

VeaaC opened this issue Jan 5, 2021 · 0 comments

Comments

@VeaaC
Copy link
Collaborator

VeaaC commented Jan 5, 2021

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant