ATLAS Offline Software
Loading...
Searching...
No Matches
GeoGetIds.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
4 */
11
12
13#ifndef GEOMODELUTILITIES_GEOGETIDS_H
14#define GEOMODELUTILITIES_GEOGETIDS_H
15
18
19#include "GeoModelKernel/GeoNodeAction.h"
20
21
28{
29public:
30 virtual ~IGeoGetIdsAction() = default;
31 virtual void operator() (int id) = 0;
32};
33
34
40 : public GeoNodeAction
41{
42public:
43 GeoGetIds (IGeoGetIdsAction& action, int depthLimit = 1);
44 virtual void handleSerialTransformer (const GeoSerialTransformer *sT) override;
45 virtual void handleIdentifierTag (const GeoIdentifierTag *idTag) override;
46 virtual void handleSerialIdentifier(const GeoSerialIdentifier *sI) override;
47
48
49private:
51 const GeoSerialIdentifier *m_serialIdentifier = nullptr;
52};
53
54
58template <class FUNCTION>
60 : public IGeoGetIdsAction
61{
62public:
63 GeoGetIdsAction (FUNCTION f) : m_f (f) {}
64 virtual void operator() (int id) override
65 {
66 m_f (id);
67 }
68 FUNCTION m_f;
69};
70
71
72
81template <class FUNCTION>
82void geoGetIds (FUNCTION f, const GeoGraphNode* node, int depthLimit = 1)
83{
85 GeoGetIds visitor (act, depthLimit);
86 node->exec (&visitor);
87}
88
89
90#endif // not GEOMODELUTILITIES_GEOGETIDS_H
void geoGetIds(FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
Template helper for running the visitor.
Definition GeoGetIds.h:82
Callback object calling a templated functional.
Definition GeoGetIds.h:61
virtual void operator()(int id) override
Definition GeoGetIds.h:64
FUNCTION m_f
Definition GeoGetIds.h:68
GeoGetIdsAction(FUNCTION f)
Definition GeoGetIds.h:63
Visitor to traverse a GeoModel graph and make a callback for each identifier found.
Definition GeoGetIds.h:41
virtual void handleIdentifierTag(const GeoIdentifierTag *idTag) override
Definition GeoGetIds.cxx:34
virtual void handleSerialIdentifier(const GeoSerialIdentifier *sI) override
Definition GeoGetIds.cxx:41
IGeoGetIdsAction & m_action
Definition GeoGetIds.h:50
virtual void handleSerialTransformer(const GeoSerialTransformer *sT) override
Definition GeoGetIds.cxx:23
GeoGetIds(IGeoGetIdsAction &action, int depthLimit=1)
Definition GeoGetIds.cxx:15
const GeoSerialIdentifier * m_serialIdentifier
Definition GeoGetIds.h:51
Ensure that the extensions for the Vector3D are properly loaded.
Definition GeoGetIds.h:28
virtual void operator()(int id)=0
virtual ~IGeoGetIdsAction()=default
Definition node.h:24