Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up headers with include-what-you-use #567

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 4
- Regex: '.*'
Priority: 3
- Regex: '<[[:alnum:]._]+>'
Priority: 5
Comment on lines +64 to +65
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Regex: '<[[:alnum:]._]+>'
Priority: 5
- Regex: '<[[:alnum:]._]+>'
Priority: 5
- Regex: '^(<"podio/)'
Priority: 1

To keep the podio ones at the top?

- Regex: '^(<"podio/)'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: BeforeHash
Expand Down
1 change: 1 addition & 0 deletions include/podio/CollectionBufferFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <functional>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions include/podio/DatamodelRegistry.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef PODIO_DATAMODELREGISTRY_H
#define PODIO_DATAMODELREGISTRY_H

#include <cstddef>
#include <string>
#include <string_view>
#include <tuple>
Expand Down
5 changes: 5 additions & 0 deletions include/podio/GenericParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
#include "podio/utilities/TypeHelpers.h"

#include <algorithm>
#include <cstddef>
#include <initializer_list>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#if PODIO_ENABLE_SIO
Expand Down
13 changes: 7 additions & 6 deletions include/podio/RNTupleReader.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
#ifndef PODIO_RNTUPLEREADER_H
#define PODIO_RNTUPLEREADER_H

#include "podio/GenericParameters.h"
#include "podio/ROOTFrameData.h"
#include "podio/SchemaEvolution.h"
#include "podio/podioVersion.h"
#include "podio/utilities/DatamodelRegistryIOHelpers.h"
#include <ROOT/RVersion.hxx>
#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 31, 0)
#include <ROOT/RNTupleReader.hxx>
#endif

#include <memory>
#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>

#include <ROOT/RNTuple.hxx>
#include <RVersion.h>
#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 31, 0)
#include <ROOT/RNTupleReader.hxx>
#endif

namespace podio {
class CollectionIDTable;

/**
This class has the function to read available data from disk
Expand Down
18 changes: 14 additions & 4 deletions include/podio/RNTupleWriter.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
#ifndef PODIO_RNTUPLEWRITER_H
#define PODIO_RNTUPLEWRITER_H

#include "podio/Frame.h"
#include "TFile.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would move this to the other ROOT includes (might be solved by the addition to clang-format above).

#include "podio/SchemaEvolution.h"
#include "podio/utilities/DatamodelRegistryIOHelpers.h"
#include "podio/utilities/RootHelpers.h"

#include "TFile.h"
#include <ROOT/RNTuple.hxx>
#include <ROOT/RNTupleModel.hxx>
#include <ROOT/RVersion.hxx>

#include <cstdint>

namespace ROOT {
namespace Experimental {
class REntry;
} // namespace Experimental
} // namespace ROOT
#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 31, 0)
#include <ROOT/RNTupleWriter.hxx>
#endif

#include <memory>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>

namespace podio {
class Frame;
class GenericParameters;
tmadlener marked this conversation as resolved.
Show resolved Hide resolved

/// The RNTupleWriter writes podio files into ROOT files using the new RNTuple
/// format.
Expand Down
1 change: 1 addition & 0 deletions include/podio/ROOTFrameData.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>

namespace podio {

Expand Down
3 changes: 1 addition & 2 deletions include/podio/ROOTLegacyReader.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#ifndef PODIO_ROOTLEGACYREADER_H
#define PODIO_ROOTLEGACYREADER_H

#include "TChain.h"
#include "podio/ROOTFrameData.h"
#include "podio/podioVersion.h"
#include "podio/utilities/RootHelpers.h"

#include "TChain.h"

#include <memory>
#include <string>
#include <tuple>
Expand Down
12 changes: 4 additions & 8 deletions include/podio/ROOTReader.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
#ifndef PODIO_ROOTREADER_H
#define PODIO_ROOTREADER_H

#include "TChain.h"
#include "podio/ROOTFrameData.h"
#include "podio/SchemaEvolution.h"
#include "podio/podioVersion.h"
#include "podio/utilities/DatamodelRegistryIOHelpers.h"
#include "podio/utilities/RootHelpers.h"

#include "TChain.h"

#include <cstddef>
#include <memory>
#include <string>
#include <string_view>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

// forward declarations
class TClass;
class TFile;
class TTree;

namespace podio {

namespace detail {
Expand All @@ -30,7 +27,6 @@ namespace detail {

} // namespace detail

class CollectionBase;
class CollectionIDTable;
class GenericParameters;
struct CollectionReadBuffers;
Expand Down
4 changes: 1 addition & 3 deletions include/podio/ROOTWriter.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#ifndef PODIO_ROOTWRITER_H
#define PODIO_ROOTWRITER_H

#include "TFile.h"
#include "podio/CollectionIDTable.h"
#include "podio/utilities/DatamodelRegistryIOHelpers.h"
#include "podio/utilities/RootHelpers.h"

#include "TFile.h"

#include <memory>
#include <string>
#include <tuple>
Expand All @@ -18,7 +17,6 @@ class TTree;

namespace podio {
class Frame;
class CollectionBase;
class GenericParameters;

/// The ROOTWriter writes podio files into ROOT files using TTrees.
Expand Down
8 changes: 8 additions & 0 deletions include/podio/Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
#define PODIO_READER_H

#include "podio/Frame.h"
#include "podio/FrameCategories.h"
#include "podio/podioVersion.h"

#include <cstddef>
#include <memory>
#include <stdexcept>
#include <string>
#include <string_view>
#include <vector>

namespace podio {

/// Generic (type erased) reader class that can handle different I/O backends
Expand Down
1 change: 0 additions & 1 deletion include/podio/SIOBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <podio/GenericParameters.h>
#include <podio/podioVersion.h>
#include <podio/utilities/TypeHelpers.h>

#include <sio/block.h>
#include <sio/io_device.h>
#include <sio/version.h>
Expand Down
1 change: 0 additions & 1 deletion include/podio/SIOBlockUserData.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "podio/CollectionBuffers.h"
#include "podio/SIOBlock.h"
#include "podio/UserDataCollection.h"

#include <sio/api.h>
#include <sio/io_device.h>
#include <sio/version.h>
Expand Down
1 change: 0 additions & 1 deletion include/podio/SIOFrameData.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "podio/CollectionIDTable.h"
#include "podio/GenericParameters.h"
#include "podio/SIOBlock.h"

#include <sio/buffer.h>
#include <sio/definitions.h>

Expand Down
1 change: 0 additions & 1 deletion include/podio/SIOLegacyReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "podio/SIOBlock.h"
#include "podio/SIOFrameData.h"
#include "podio/podioVersion.h"

#include <sio/definitions.h>

#include <memory>
Expand Down
1 change: 0 additions & 1 deletion include/podio/SIOReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "podio/SIOFrameData.h"
#include "podio/podioVersion.h"
#include "podio/utilities/DatamodelRegistryIOHelpers.h"

#include <sio/definitions.h>

#include <memory>
Expand Down
1 change: 0 additions & 1 deletion include/podio/SIOWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "podio/SIOBlock.h"
#include "podio/utilities/DatamodelRegistryIOHelpers.h"

#include <sio/definitions.h>

#include <string>
Expand Down
1 change: 1 addition & 0 deletions include/podio/SchemaEvolution.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef PODIO_SCHEMAEVOLUTION_H
#define PODIO_SCHEMAEVOLUTION_H

#include <cstddef>
#include <cstdint>
#include <functional>
#include <string>
Expand Down
12 changes: 12 additions & 0 deletions include/podio/UserDataCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
#include "podio/SchemaEvolution.h"
#include "podio/utilities/TypeHelpers.h"

#include <cstddef>
#include <cstdint>
#include <iostream>
#include <string_view>
#include <tuple>
#include <type_traits>
#include <vector>

namespace podio {
class ICollectionProvider;
} // namespace podio

#define PODIO_ADD_USER_TYPE(type) \
template <> \
constexpr const char* userDataTypeName<type>() { \
Expand Down
5 changes: 5 additions & 0 deletions include/podio/Writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
#define PODIO_WRITER_H

#include "podio/Frame.h"
#include "podio/FrameCategories.h"

#include <memory>
#include <string>
#include <vector>

namespace podio {

Expand Down
7 changes: 4 additions & 3 deletions include/podio/utilities/DatamodelRegistryIOHelpers.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#ifndef PODIO_UTILITIES_DATAMODELREGISTRYIOHELPERS_H
#define PODIO_UTILITIES_DATAMODELREGISTRYIOHELPERS_H

#include "podio/CollectionBase.h"
#include "podio/DatamodelRegistry.h"

#include <cstddef>
#include <set>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include <vector>

namespace podio {
class CollectionBase;
tmadlener marked this conversation as resolved.
Show resolved Hide resolved

/// Helper class to collect the datamodel (JSON) definitions that should be
/// written.
Expand Down
12 changes: 9 additions & 3 deletions include/podio/utilities/RootHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@

#include "podio/GenericParameters.h"

#include "ROOT/RVec.hxx"
#include "TBranch.h"

#include <cstdint>
#include <string>
#include <tuple>
#include <vector>

class TBranch;
namespace ROOT {
namespace VecOps {
template <typename T>
class RVec;
} // namespace VecOps
} // namespace ROOT

namespace podio {
class CollectionBase;

Expand Down
4 changes: 4 additions & 0 deletions src/CollectionBufferFactory.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "podio/CollectionBufferFactory.h"

#include "podio/CollectionBuffers.h"

#include <cstddef>
#include <utility>

namespace podio {
CollectionBufferFactory& CollectionBufferFactory::mutInstance() {
static CollectionBufferFactory factory;
Expand Down
3 changes: 3 additions & 0 deletions src/CollectionIDTable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#include "MurmurHash3.h"

#include <algorithm>
#include <cstddef>
#include <iostream>
#include <iterator>
#include <utility>

namespace podio {

Expand Down
1 change: 1 addition & 0 deletions src/DataSource.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "podio/DataSource.h"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

#include "podio/Reader.h"

// podio
Expand Down
5 changes: 5 additions & 0 deletions src/DatamodelRegistryIOHelpers.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include "podio/utilities/DatamodelRegistryIOHelpers.h"

#include "podio/CollectionBase.h"
#include "podio/DatamodelRegistry.h"

#include <algorithm>
#include <iostream>
#include <iterator>

namespace podio {
Expand Down
Loading
Loading