diff --git a/include/openPMD/binding/c/Container_Iteration.h b/include/openPMD/binding/c/Container_Iteration.h index 0efb934e23..75268afeea 100644 --- a/include/openPMD/binding/c/Container_Iteration.h +++ b/include/openPMD/binding/c/Container_Iteration.h @@ -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); diff --git a/include/openPMD/binding/c/Container_Mesh.h b/include/openPMD/binding/c/Container_Mesh.h index 42e757418b..13e59c6cfb 100644 --- a/include/openPMD/binding/c/Container_Mesh.h +++ b/include/openPMD/binding/c/Container_Mesh.h @@ -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); diff --git a/include/openPMD/binding/c/Iteration.h b/include/openPMD/binding/c/Iteration.h index aff8333355..f4bbccb7b3 100644 --- a/include/openPMD/binding/c/Iteration.h +++ b/include/openPMD/binding/c/Iteration.h @@ -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); diff --git a/include/openPMD/binding/c/Series.h b/include/openPMD/binding/c/Series.h index a9ca6035f4..588948d8c8 100644 --- a/include/openPMD/binding/c/Series.h +++ b/include/openPMD/binding/c/Series.h @@ -3,6 +3,7 @@ #include +#include #include #include #include @@ -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); @@ -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); diff --git a/src/binding/c/Series.cpp b/src/binding/c/Series.cpp index c8b306ed73..b41d70f395 100644 --- a/src/binding/c/Series.cpp +++ b/src/binding/c/Series.cpp @@ -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;