ATLAS Offline Software
Loading...
Searching...
No Matches
CaloIDHelper_IDDetDescrCnv.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4/**
5 * @file CaloIdCnv/CaloIDHelper_IDDetDescrCnv.icc
6 * @author scott snyder <snyder@bnl.gov>
7 * @date Aug, 2012
8 * @brief Common code for creating calo ID helpers in the detector store.
9 */
10
11
12#include "AthenaKernel/StorableConversions.h"
13#include "AthenaKernel/errorcheck.h"
14
15
16namespace CaloIdCnv {
17
18
19/**
20 * @brief Helper function to actually create a new helper.
21 * @param svcloc Gaudi service locator.
22 * @param helperKey The StoreGate key of the helper being created.
23 * @param idhelper[out] Set to the created helper.
24 *
25 * The default implementation just does @c new with the default constructor;
26 * however, this function may be overridden for specific types.
27 */
28template <class T>
29StatusCode make_CaloIDHelper (ISvcLocator* /*svcloc*/,
30 const std::string& /*helperKey*/,
31 T* & idhelper)
32{
33 idhelper = new T;
34 return StatusCode::SUCCESS;
35}
36
37
38/**
39 * @brief Return the CLID of the class we create.
40 * Required by the converter infrastructure.
41 */
42template <class T>
43CLID CaloIDHelper_IDDetDescrCnv_T<T>::classID()
44{
45 return ClassID_traits<T>::ID();
46}
47
48
49/**
50 * @brief Constructor.
51 * @param svcloc Gaudi service locator.
52 */
53template <class T>
54CaloIDHelper_IDDetDescrCnv_T<T>::CaloIDHelper_IDDetDescrCnv_T
55 (ISvcLocator* svcloc)
56 : CaloIDHelper_IDDetDescrCnv (classID(), svcloc)
57{
58}
59
60
61/**
62 * @brief Create the helper object.
63 * @param helperKey StoreGate key of the helper.
64 * @param idhelper[out] Set to a pointer to the new helper.
65 * @param pObj[out] Set to a reference to the created helper.
66 */
67template <class T>
68StatusCode
69CaloIDHelper_IDDetDescrCnv_T<T>::createHelper (const std::string& helperKey,
70 IdHelper* & idhelper,
71 DataObject*& pObj)
72{
73 T* helper = 0;
74 //make_CaloIDHelper can only return StatusCode::SUCCESS
75 make_CaloIDHelper (serviceLocator(), helperKey, helper).ignore();
76 idhelper = helper;
77 pObj = SG::asStorable(helper);
78 return StatusCode::SUCCESS;
79}
80
81
82} // namespace CaloIdCnv