Skip to content

Commit

Permalink
python/templates: add references between Objects and Collection types
Browse files Browse the repository at this point in the history
  • Loading branch information
veprbl committed Aug 23, 2023
1 parent 60dcd12 commit ad1160e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/templates/Collection.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ A Collection is identified by an ID.
*/
class {{ class.bare_type }}Collection : public podio::CollectionBase {
public:
using value_type = {{ class.bare_type }};
using const_iterator = {{ class.bare_type }}CollectionIterator;
using iterator = {{ class.bare_type }}MutableCollectionIterator;

Expand Down
2 changes: 2 additions & 0 deletions python/templates/MutableObject.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class Mutable{{ class.bare_type }} {
friend class {{ class.bare_type }};

public:
using object_type = {{ class.bare_type }};
using collection_type = {{ class.bare_type }}Collection;

{{ macros.constructors_destructors(class.bare_type, Members, prefix='Mutable') }}
/// conversion to const object
Expand Down
4 changes: 4 additions & 0 deletions python/templates/Object.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

{{ utils.namespace_open(class.namespace) }}
class Mutable{{ class.bare_type }};
class {{ class.bare_type }}Collection;

{{ macros.class_description(class.bare_type, Description, Author) }}
class {{ class.bare_type }} {
Expand All @@ -31,6 +32,9 @@ class {{ class.bare_type }} {
friend class {{ class.bare_type }}CollectionIterator;

public:
using mutable_type = Mutable{{ class.bare_type }};
using collection_type = {{ class.bare_type }}Collection;

{{ macros.constructors_destructors(class.bare_type, Members) }}

public:
Expand Down

0 comments on commit ad1160e

Please sign in to comment.