Skip to content

Commit

Permalink
Undo some intermediate changes for a cleaner diff
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Nov 21, 2023
1 parent 9a6d497 commit b935bbc
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 18 deletions.
4 changes: 1 addition & 3 deletions python/templates/MutableObject.cc.jinja2
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "podio/utilities/MaybeSharedPtr.h"
{% import "macros/utils.jinja2" as utils %}
{% import "macros/implementations.jinja2" as macros %}
// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
Expand All @@ -17,8 +16,7 @@

{{ utils.namespace_open(class.namespace) }}

{{ macros.common_constructors_destructors(class.bare_type, Members, prefix='Mutable') }}

{{ macros.constructors_destructors(class.bare_type, Members, prefix='Mutable') }}
Mutable{{ class.bare_type }}::operator {{ class.bare_type }}() const { return {{ class.bare_type }}(m_obj); }

{{ macros.member_getters(class, Members, use_get_syntax, prefix='Mutable') }}
Expand Down
5 changes: 1 addition & 4 deletions python/templates/MutableObject.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public:
using object_type = {{ class.bare_type }};
using collection_type = {{ class.bare_type }}Collection;

{{ macros.common_constructors_destructors(class.bare_type, Members, prefix='Mutable') }}
{{ macros.constructors_destructors(class.bare_type, Members, prefix='Mutable') }}

/// conversion to const object
operator {{ class.bare_type }}() const;
Expand All @@ -54,9 +54,6 @@ public:
{{ utils.if_present(MutableExtraCode, "declaration") }}
{{ macros.common_object_funcs(class.bare_type, prefix='Mutable') }}

/// disconnect from {{ class.bare_type }}Obj instance
void unlink() { m_obj = podio::utils::MaybeSharedPtr<{{ class.bare_type }}Obj>{nullptr}; }

private:
/// constructor from existing {{ class.bare_type }}Obj
explicit Mutable{{ class.bare_type }}(podio::utils::MaybeSharedPtr<{{ class.bare_type }}Obj> obj);
Expand Down
4 changes: 1 addition & 3 deletions python/templates/Object.cc.jinja2
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "podio/utilities/MaybeSharedPtr.h"
{% import "macros/utils.jinja2" as utils %}
{% import "macros/implementations.jinja2" as macros %}
// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
Expand All @@ -17,15 +16,14 @@

{{ utils.namespace_open(class.namespace) }}

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

{{ class.bare_type }}::{{ class.bare_type }}({{ class.bare_type }}Obj* obj) : m_obj(podio::utils::MaybeSharedPtr<{{ class.bare_type }}Obj>(obj)) {}

{{ class.bare_type }} {{ class.bare_type }}::makeEmpty() {
return {nullptr};
}


{{ macros.member_getters(class, Members, use_get_syntax) }}
{{ macros.single_relation_getters(class, OneToOneRelations, use_get_syntax) }}
{{ macros.multi_relation_handling(class, OneToManyRelations + VectorMembers, use_get_syntax) }}
Expand Down
5 changes: 1 addition & 4 deletions python/templates/Object.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public:
using mutable_type = Mutable{{ class.bare_type }};
using collection_type = {{ class.bare_type }}Collection;

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

static {{ class.bare_type }} makeEmpty();

Expand All @@ -51,9 +51,6 @@ public:
{{ utils.if_present(ExtraCode, "declaration") }}
{{ macros.common_object_funcs(class.bare_type) }}

/// disconnect from {{ class.bare_type }}Obj instance
void unlink() { m_obj = podio::utils::MaybeSharedPtr<{{ class.bare_type }}Obj>{nullptr}; }

private:
/// constructor from existing {{ class.bare_type }}Obj
explicit {{ class.bare_type}}(podio::utils::MaybeSharedPtr<{{ class.bare_type }}Obj> obj);
Expand Down
2 changes: 1 addition & 1 deletion python/templates/SIOBlock.cc.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace {
// library actually needs linking to the core library. Otherwise it is
// possible that the registry is not populated when the SioBlock library is
// loaded, e.g. when using the python bindings.
const auto elem = {{ class.full_type }}::makeEmpty();
const auto elem = {{ class.full_type }}{};
}

{% endwith %}
Expand Down
6 changes: 4 additions & 2 deletions python/templates/macros/declarations.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
{% endmacro %}


{% macro common_constructors_destructors(type, members, prefix='') %}
{% macro constructors_destructors(type, members, prefix='') %}
{% set full_type = prefix + type %}
/// Default constructor
/// default constructor
{{ full_type }}();

{%if members %}
Expand All @@ -82,6 +82,8 @@
{% set full_type = prefix + type %}
/// check whether the object is actually available
bool isAvailable() const;
/// disconnect from {{ type }}Obj instance
void unlink() { m_obj = podio::utils::MaybeSharedPtr<{{ type }}Obj>{nullptr}; }

{% set inverse_type = type if prefix else 'Mutable' + type %}
bool operator==(const {{ full_type }}& other) const { return m_obj == other.m_obj; }
Expand Down
2 changes: 1 addition & 1 deletion python/templates/macros/implementations.jinja2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro common_constructors_destructors(type, members, prefix='') %}
{% macro constructors_destructors(type, members, prefix='') %}
{% set full_type = prefix + type %}

{{ full_type }}::{{ full_type }}() :
Expand Down

0 comments on commit b935bbc

Please sign in to comment.