Skip to content

Commit

Permalink
Add openPMD_Series_iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett committed Oct 29, 2023
1 parent d9ed4ef commit 56e9ba0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/openPMD/binding/c/Container_Iteration.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ extern "C"

typedef struct openPMD_Container_Iteration openPMD_Container_Iteration;

// returns a non-owning pointer
const openPMD_Attributable *
openPMD_Container_Iteration_getConstAttributable(
const openPMD_Container_Iteration *container);

// returns a non-owning pointer
openPMD_Attributable *openPMD_Container_Iteration_getAttributable(
openPMD_Container_Iteration *container);

Expand Down
3 changes: 3 additions & 0 deletions include/openPMD/binding/c/Container_Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ extern "C"

typedef struct openPMD_Container_Mesh openPMD_Container_Mesh;

// returns a non-owning pointer
const openPMD_Attributable *openPMD_Container_Mesh_getConstAttributable(
const openPMD_Container_Mesh *container);

// returns a non-owning pointer
openPMD_Attributable *
openPMD_Container_Mesh_getAttributable(openPMD_Container_Mesh *container);

Expand Down
2 changes: 2 additions & 0 deletions include/openPMD/binding/c/Iteration.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ extern "C"

typedef struct openPMD_Iteration openPMD_Iteration;

// returns a non-owning pointer
const openPMD_Attributable *
openPMD_Iteration_getConstAttributable(const openPMD_Iteration *iteration);

// returns a non-owning pointer
openPMD_Attributable *
openPMD_Iteration_getAttributable(openPMD_Iteration *iteration);

Expand Down
11 changes: 11 additions & 0 deletions include/openPMD/binding/c/Series.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <openPMD/config.hpp>

#include <openPMD/binding/c/Container_Iteration.h>
#include <openPMD/binding/c/IO/Access.h>
#include <openPMD/binding/c/IterationEncoding.h>
#include <openPMD/binding/c/ReadIterations.h>
Expand All @@ -20,9 +21,11 @@ extern "C"

typedef struct openPMD_Series openPMD_Series;

// returns a non-owning pointer
const openPMD_Attributable *
openPMD_Series_getConstAttributable(const openPMD_Series *series);

// returns a non-owning pointer
openPMD_Attributable *
openPMD_Series_getAttributable(openPMD_Series *series);

Expand All @@ -41,6 +44,14 @@ extern "C"

void openPMD_Series_delete(openPMD_Series *series);

// returns a non-owning pointer
const openPMD_Container_Iteration *
openPMD_Series_constIterations(const openPMD_Series *series);

// returns a non-owning pointer
openPMD_Container_Iteration *
openPMD_Series_iterations(openPMD_Series *series);

bool openPMD_Series_has_value(const openPMD_Series *series);

char *openPMD_Series_openPMD(const openPMD_Series *series);
Expand Down
13 changes: 13 additions & 0 deletions src/binding/c/Series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ void openPMD_Series_delete(openPMD_Series *series)
delete cxx_series;
}

const openPMD_Container_Iteration *
openPMD_Series_constIterations(const openPMD_Series *series)
{
const auto cxx_series = (const openPMD::Series *)series;
return (const openPMD_Container_Iteration *)&cxx_series->iterations;
}

openPMD_Container_Iteration *openPMD_Series_iterations(openPMD_Series *series)
{
const auto cxx_series = (openPMD::Series *)series;
return (openPMD_Container_Iteration *)&cxx_series->iterations;
}

bool openPMD_Series_has_value(const openPMD_Series *series)
{
const auto cxx_series = (const openPMD::Series *)series;
Expand Down

0 comments on commit 56e9ba0

Please sign in to comment.