Skip to content

Commit

Permalink
Reduce unnecessary template instantiations
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Sep 11, 2023
1 parent 48a4bf6 commit 844f9bf
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions python/templates/Collection.cc.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
{{ include }}
{% endfor %}

#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
#include "nlohmann/json.hpp"
#endif

// standard includes
#include <stdexcept>
#include <iomanip>
Expand Down
2 changes: 1 addition & 1 deletion python/templates/Collection.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "podio/CollectionIDTable.h"

#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
#include "nlohmann/json.hpp"
#include "nlohmann/json_fwd.hpp"
#endif

#include <string>
Expand Down
4 changes: 4 additions & 0 deletions python/templates/MutableObject.cc.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
{{ include }}
{% endfor %}

#ifdef PODIO_JSON_OUTPUT && !defined(__CLING__)
#include "nlohmann/json.hpp"
#endif

#include <ostream>

{{ utils.namespace_open(class.namespace) }}
Expand Down
2 changes: 1 addition & 1 deletion python/templates/MutableObject.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <cstddef>

#ifdef PODIO_JSON_OUTPUT
#include "nlohmann/json.hpp"
#include "nlohmann/json_fwd.hpp"
#endif

{{ utils.forward_decls(forward_declarations) }}
Expand Down
4 changes: 4 additions & 0 deletions python/templates/Object.cc.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
{{ include }}
{% endfor %}

#ifdef PODIO_JSON_OUTPUT && !defined(__CLING__)
#include "nlohmann/json.hpp"
#endif

#include <ostream>

{{ utils.namespace_open(class.namespace) }}
Expand Down
4 changes: 2 additions & 2 deletions python/templates/Object.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include <ostream>
#include <cstddef>

#ifdef PODIO_JSON_OUTPUT
#include "nlohmann/json.hpp"
#ifdef PODIO_JSON_OUTPUT && !defined(__CLING__)
#include "nlohmann/json_fwd.hpp"
#endif

{{ utils.forward_decls(forward_declarations) }}
Expand Down
2 changes: 1 addition & 1 deletion python/templates/macros/declarations.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
{%- endmacro %}

{% macro json_output(type, prefix='') %}
#ifdef PODIO_JSON_OUTPUT
#ifdef PODIO_JSON_OUTPUT && !defined(__CLING__)
void to_json(nlohmann::json& j, const {{ prefix }}{{ type }}& value);
#endif
{% endmacro %}

0 comments on commit 844f9bf

Please sign in to comment.