diff --git a/python/templates/MutableObject.cc.jinja2 b/python/templates/MutableObject.cc.jinja2 index d94b4f32c..329a0f830 100644 --- a/python/templates/MutableObject.cc.jinja2 +++ b/python/templates/MutableObject.cc.jinja2 @@ -12,8 +12,6 @@ #include "nlohmann/json.hpp" #endif -#include - {{ utils.namespace_open(class.namespace) }} {{ macros.constructors_destructors(class.bare_type, Members, multi_relations=OneToManyRelations + VectorMembers, prefix='Mutable') }} diff --git a/python/templates/Obj.cc.jinja2 b/python/templates/Obj.cc.jinja2 index 1f935ca46..b127fcce7 100644 --- a/python/templates/Obj.cc.jinja2 +++ b/python/templates/Obj.cc.jinja2 @@ -57,7 +57,7 @@ {%- endwith %} {% for relation in OneToOneRelations %} - if (m_{{ relation.name }}) delete m_{{ relation.name }}; + delete m_{{ relation.name }}; {% endfor %} } {%- endif %} diff --git a/python/templates/macros/declarations.jinja2 b/python/templates/macros/declarations.jinja2 index 5ef5b8707..a329c599a 100644 --- a/python/templates/macros/declarations.jinja2 +++ b/python/templates/macros/declarations.jinja2 @@ -121,7 +121,7 @@ {% macro single_relation_setters(relations, get_syntax) %} {% for relation in relations %} /// Set the {{ relation.description }} - void {{ relation.setter_name(get_syntax) }}({{ relation.full_type }} value); + void {{ relation.setter_name(get_syntax) }}(const {{ relation.full_type }}& value); {% endfor %} {%- endmacro %} diff --git a/python/templates/macros/implementations.jinja2 b/python/templates/macros/implementations.jinja2 index d3f367fdf..c1c8221bd 100644 --- a/python/templates/macros/implementations.jinja2 +++ b/python/templates/macros/implementations.jinja2 @@ -123,10 +123,8 @@ const {{ relation.full_type }} {{ class_type }}::{{ relation.getter_name(get_syn {% macro single_relation_setters(class, relations, get_syntax, prefix='') %} {% set class_type = prefix + class.bare_type %} {% for relation in relations %} -void {{ class_type }}::{{ relation.setter_name(get_syntax) }}({{ relation.full_type }} value) { - if (m_obj->m_{{ relation.name }}) { - delete m_obj->m_{{ relation.name }}; - } +void {{ class_type }}::{{ relation.setter_name(get_syntax) }}(const {{ relation.full_type }}& value) { + delete m_obj->m_{{ relation.name }}; m_obj->m_{{ relation.name }} = new {{ relation.full_type }}(value); } @@ -182,10 +180,7 @@ podio::RelationRange<{{ relation.full_type }}> {{ class_type }}::{{ relation.get {% macro common_object_funcs(class, prefix='') %} {% set full_type = prefix + class.bare_type %} bool {{ full_type }}::isAvailable() const { - if (m_obj) { - return true; - } - return false; + return m_obj; } const podio::ObjectID {{ full_type }}::getObjectID() const { diff --git a/python/templates/macros/utils.jinja2 b/python/templates/macros/utils.jinja2 index 56511a6fe..c2686222a 100644 --- a/python/templates/macros/utils.jinja2 +++ b/python/templates/macros/utils.jinja2 @@ -30,7 +30,6 @@ namespace {{ nsp }} { #include "{{ incfolder }}Mutable{{ type }}.h" #include "{{ incfolder }}{{ type }}Obj.h" #include "{{ incfolder }}{{ type }}Data.h" -#include "{{ incfolder }}{{ type }}Collection.h" {%- endmacro %}