ATLAS Offline Software
BasicFolder.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 // @file BasicFolder.h
5 // Header for FolderTypes utilities
6 // @author Shaun Roe
7 // @date May 2019
8 #ifndef IOVDbSvc_BasicFolder_h
9 #define IOVDbSvc_BasicFolder_h
10 
11 #include <utility>
12 #include "CoolKernel/ValidityKey.h" //a typedef
13 #include "CoolKernel/ChannelId.h"
14 #include <string>
15 #include <vector>
16 #include "CoralBase/AttributeList.h"
17 #include <map>
18 
19 namespace IOVDbNamespace{
20 //@Basic data structure to hold the folder data retrieved from CREST or file
22  public:
23  BasicFolder();
24  void setVectorPayloadFlag(const bool flag);
25  bool isVectorPayload() const;
26  //
27  void setIov(const std::pair<cool::ValidityKey, cool::ValidityKey> & iov);
28  //add attributeList
29  void addChannelPayload(const cool::ChannelId & channelId, const std::string & name, const coral::AttributeList & payload);
30  void addChannelPayload(const cool::ChannelId & channelId, const coral::AttributeList & payload);
31  //add vector payload
32  void addChannelPayload(const cool::ChannelId & channelId, const std::string & name, const std::vector<coral::AttributeList> & payload);
33  void addChannelPayload(const cool::ChannelId & channelId, const std::vector<coral::AttributeList> & payload);
34  //
35  coral::AttributeList getPayload(const cool::ChannelId & channelId);
36  coral::AttributeList getPayload(const std::string & channelName);
37  std::vector<coral::AttributeList> getVectorPayload(const cool::ChannelId & channelId);
38  std::vector<coral::AttributeList> getVectorPayload(const std::string & channelName);
39  const std::vector<cool::ChannelId>& channelIds();
40  std::pair<cool::ValidityKey, cool::ValidityKey> iov();
41  //
42  bool empty() const;
43  std::string jsonPayload(const std::string & folderDescription, const std::string & spec);
44 
45  private:
46  //ugh, should be templated, and consider using hashmaps
47  std::map<int, coral::AttributeList> m_payload;
48  std::map<int, std::vector<coral::AttributeList>> m_vectorPayload;
49  //could use single bidirectional map
50  std::map<std::string, int> m_name2Channel;
51  std::map<int, std::string> m_channel2Name;
52  //ugliness
54  std::vector<cool::ChannelId> m_channels;
55  std::pair<cool::ValidityKey, cool::ValidityKey> m_iov;
56 };
57 
58 }
59 #endif
60 
IOVDbNamespace::BasicFolder::isVectorPayload
bool isVectorPayload() const
Definition: BasicFolder.cxx:41
IOVDbNamespace::BasicFolder::getPayload
coral::AttributeList getPayload(const cool::ChannelId &channelId)
Definition: BasicFolder.cxx:81
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
IOVDbNamespace::BasicFolder::m_channels
std::vector< cool::ChannelId > m_channels
Definition: BasicFolder.h:54
IOVDbNamespace::BasicFolder::m_iov
std::pair< cool::ValidityKey, cool::ValidityKey > m_iov
Definition: BasicFolder.h:55
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
IOVDbNamespace::BasicFolder::m_isVectorPayload
bool m_isVectorPayload
Definition: BasicFolder.h:53
IOVDbNamespace::BasicFolder::m_name2Channel
std::map< std::string, int > m_name2Channel
Definition: BasicFolder.h:50
master.flag
bool flag
Definition: master.py:29
IOVDbNamespace::BasicFolder::m_payload
std::map< int, coral::AttributeList > m_payload
Definition: BasicFolder.h:47
IOVDbNamespace::BasicFolder::empty
bool empty() const
Definition: BasicFolder.cxx:31
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
IOVDbNamespace::BasicFolder
Definition: BasicFolder.h:21
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
IOVDbNamespace::BasicFolder::addChannelPayload
void addChannelPayload(const cool::ChannelId &channelId, const std::string &name, const coral::AttributeList &payload)
Definition: BasicFolder.cxx:52
IOVDbNamespace::BasicFolder::BasicFolder
BasicFolder()
Definition: BasicFolder.cxx:20
IOVDbNamespace::BasicFolder::iov
std::pair< cool::ValidityKey, cool::ValidityKey > iov()
Definition: BasicFolder.cxx:116
IOVDbNamespace::BasicFolder::channelIds
const std::vector< cool::ChannelId > & channelIds()
Definition: BasicFolder.cxx:111
IOVDbNamespace::BasicFolder::m_channel2Name
std::map< int, std::string > m_channel2Name
Definition: BasicFolder.h:51
IOVDbNamespace::BasicFolder::setVectorPayloadFlag
void setVectorPayloadFlag(const bool flag)
Definition: BasicFolder.cxx:36
IOVDbNamespace::BasicFolder::getVectorPayload
std::vector< coral::AttributeList > getVectorPayload(const cool::ChannelId &channelId)
Definition: BasicFolder.cxx:96
IOVDbNamespace::BasicFolder::m_vectorPayload
std::map< int, std::vector< coral::AttributeList > > m_vectorPayload
Definition: BasicFolder.h:48
IOVDbNamespace::BasicFolder::jsonPayload
std::string jsonPayload(const std::string &folderDescription, const std::string &spec)
Definition: BasicFolder.cxx:119
IOVDbNamespace::BasicFolder::setIov
void setIov(const std::pair< cool::ValidityKey, cool::ValidityKey > &iov)
Definition: BasicFolder.cxx:46
IOVDbNamespace
Definition: Base64Codec.cxx:16