ATLAS Offline Software
LWHistAthMonWrapper.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 
7 struct LWHistAthMonWrapper::LWHistAthenaMonCustomData
8 {
9  std::string streamName;
10  std::string key;
11 };
12 
13 inline void LWHistAthMonWrapper::setStreamName(LWHist*h, const std::string& streamName)
14 {
15 
16  if (!h->getCustomData())
17  h->setCustomData(new LWHistAthenaMonCustomData);
18  reinterpret_cast<LWHistAthenaMonCustomData*>(h->getCustomData())->streamName = streamName;
19 }
20 
21 inline void LWHistAthMonWrapper::setKey(LWHist*h, const std::string& key)
22 {
23  if (!h->getCustomData())
24  h->setCustomData(new LWHistAthenaMonCustomData);
25  reinterpret_cast<LWHistAthenaMonCustomData*>(h->getCustomData())->key = key;
26 }
27 
28 inline const std::string& LWHistAthMonWrapper::streamName(LWHist*h)
29 {
30  // cppcheck-suppress assertWithSideEffect
31  assert(h->getCustomData());
32  return reinterpret_cast<LWHistAthenaMonCustomData*>(h->getCustomData())->streamName;
33 
34 }
35 
36 inline const std::string& LWHistAthMonWrapper::key(LWHist*h)
37 {
38  // cppcheck-suppress assertWithSideEffect
39  assert(h->getCustomData());
40  return reinterpret_cast<LWHistAthenaMonCustomData*>(h->getCustomData())->key;
41 }
42 
43 inline void LWHistAthMonWrapper::removeCustomData(LWHist*h)
44 {
45  char *c = reinterpret_cast<char*>(h->getCustomData());
46  if (c)
47  delete reinterpret_cast<LWHistAthenaMonCustomData*>(c);
48  h->setCustomData(0);
49 }
50 
51 inline void LWHistAthMonWrapper::deleteLWHist(LWHist*h)
52 {
53  removeCustomData(h);
54  LWHist::safeDelete(h);
55 }