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