ATLAS Offline Software
EventDataBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef _InDet_EventDataBase_H_
5 #define _InDet_EventDataBase_H_
6 
7 #include <stdexcept>
8 #include <string>
9 #include <typeinfo>
10 
11 namespace Trk {
12 
15  template <class T_Derived, class T_Base>
16  class EventDataBase : public T_Base
17  {
18  protected:
19  inline static T_Derived &getPrivateEventData(T_Base &virt_event_data)
20  {
21  T_Derived *event_data = dynamic_cast<T_Derived *>(&virt_event_data);
22  if (!event_data) { throwMismtach(); }
23  return *event_data;
24  }
25 
26  static void throwMismtach() {
27  throw std::logic_error(std::string("EventData mismatch, expecting ")
28  +typeid(T_Derived).name() + "::EventData.");
29  }
30 
31  };
32 }
33 #endif
Trk::EventDataBase
Base for a helper class to pass mutable storage to tools.
Definition: EventDataBase.h:17
Trk::EventDataBase::throwMismtach
static void throwMismtach()
Definition: EventDataBase.h:26
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Trk::EventDataBase::getPrivateEventData
static T_Derived & getPrivateEventData(T_Base &virt_event_data)
Definition: EventDataBase.h:19