ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
IOVDbNamespace::BasicFolder Class Reference

#include <BasicFolder.h>

Collaboration diagram for IOVDbNamespace::BasicFolder:

Public Member Functions

 BasicFolder ()
 
void setVectorPayloadFlag (const bool flag)
 
bool isVectorPayload () const
 
void setIov (const std::pair< cool::ValidityKey, cool::ValidityKey > &iov)
 
void addChannelPayload (const cool::ChannelId &channelId, const std::string &name, const coral::AttributeList &payload)
 
void addChannelPayload (const cool::ChannelId &channelId, const coral::AttributeList &payload)
 
void addChannelPayload (const cool::ChannelId &channelId, const std::string &name, const std::vector< coral::AttributeList > &payload)
 
void addChannelPayload (const cool::ChannelId &channelId, const std::vector< coral::AttributeList > &payload)
 
coral::AttributeList getPayload (const cool::ChannelId &channelId)
 
coral::AttributeList getPayload (const std::string &channelName)
 
std::vector< coral::AttributeList > getVectorPayload (const cool::ChannelId &channelId)
 
std::vector< coral::AttributeList > getVectorPayload (const std::string &channelName)
 
const std::vector< cool::ChannelId > & channelIds ()
 
std::pair< cool::ValidityKey, cool::ValidityKey > iov ()
 
bool empty () const
 
std::string jsonPayload (const std::string &folderDescription, const std::string &spec)
 

Private Attributes

std::map< int, coral::AttributeList > m_payload
 
std::map< int, std::vector< coral::AttributeList > > m_vectorPayload
 
std::map< std::string, int > m_name2Channel
 
std::map< int, std::string > m_channel2Name
 
bool m_isVectorPayload
 
std::vector< cool::ChannelId > m_channels
 
std::pair< cool::ValidityKey, cool::ValidityKey > m_iov
 

Detailed Description

Definition at line 21 of file BasicFolder.h.

Constructor & Destructor Documentation

◆ BasicFolder()

IOVDbNamespace::BasicFolder::BasicFolder ( )

Definition at line 20 of file BasicFolder.cxx.

20  :
21  m_payload{},
26  m_channels{},
27  m_iov{infiniteIov} {
28 
29  }

Member Function Documentation

◆ addChannelPayload() [1/4]

void IOVDbNamespace::BasicFolder::addChannelPayload ( const cool::ChannelId &  channelId,
const coral::AttributeList &  payload 
)

Definition at line 59 of file BasicFolder.cxx.

59  {
60 
61  m_channels.push_back(channelId);
63  }

◆ addChannelPayload() [2/4]

void IOVDbNamespace::BasicFolder::addChannelPayload ( const cool::ChannelId &  channelId,
const std::string &  name,
const coral::AttributeList &  payload 
)

Definition at line 52 of file BasicFolder.cxx.

◆ addChannelPayload() [3/4]

void IOVDbNamespace::BasicFolder::addChannelPayload ( const cool::ChannelId &  channelId,
const std::string &  name,
const std::vector< coral::AttributeList > &  payload 
)

Definition at line 67 of file BasicFolder.cxx.

◆ addChannelPayload() [4/4]

void IOVDbNamespace::BasicFolder::addChannelPayload ( const cool::ChannelId &  channelId,
const std::vector< coral::AttributeList > &  payload 
)

Definition at line 74 of file BasicFolder.cxx.

74  {
75  m_channels.push_back(channelId);
77  }

◆ channelIds()

const std::vector< cool::ChannelId > & IOVDbNamespace::BasicFolder::channelIds ( )

Definition at line 111 of file BasicFolder.cxx.

111  {
112  return m_channels;
113  }

◆ empty()

bool IOVDbNamespace::BasicFolder::empty ( ) const

Definition at line 31 of file BasicFolder.cxx.

31  {
32  return m_channels.empty();
33  }

◆ getPayload() [1/2]

coral::AttributeList IOVDbNamespace::BasicFolder::getPayload ( const cool::ChannelId &  channelId)

Definition at line 81 of file BasicFolder.cxx.

81  {
82  return m_payload.find(channelId)->second;
83  }

◆ getPayload() [2/2]

coral::AttributeList IOVDbNamespace::BasicFolder::getPayload ( const std::string &  channelName)

Definition at line 86 of file BasicFolder.cxx.

86  {
87  if (m_isVectorPayload) return invalidPayload;
88  const auto chanPtr= m_name2Channel.find(channelName);
89  bool nameExists = (chanPtr != m_name2Channel.end());
90  if (not nameExists) return invalidPayload;
91  const cool::ChannelId channel=chanPtr->second;
92  return getPayload(channel);
93  }

◆ getVectorPayload() [1/2]

std::vector< coral::AttributeList > IOVDbNamespace::BasicFolder::getVectorPayload ( const cool::ChannelId &  channelId)

Definition at line 96 of file BasicFolder.cxx.

96  {
97  return m_vectorPayload.find(channelId)->second;
98  }

◆ getVectorPayload() [2/2]

std::vector< coral::AttributeList > IOVDbNamespace::BasicFolder::getVectorPayload ( const std::string &  channelName)

Definition at line 101 of file BasicFolder.cxx.

101  {
102  if (not m_isVectorPayload) return invalidVectorPayload;
103  const auto chanPtr= m_name2Channel.find(channelName);
104  bool nameExists = (chanPtr != m_name2Channel.end());
105  if (not nameExists) return invalidVectorPayload;
106  const cool::ChannelId channel=chanPtr->second;
107  return getVectorPayload(channel);
108  }

◆ iov()

std::pair< cool::ValidityKey, cool::ValidityKey > IOVDbNamespace::BasicFolder::iov ( )

Definition at line 116 of file BasicFolder.cxx.

116  {
117  return m_iov;
118  }

◆ isVectorPayload()

bool IOVDbNamespace::BasicFolder::isVectorPayload ( ) const

Definition at line 41 of file BasicFolder.cxx.

41  {
42  return m_isVectorPayload;
43  }

◆ jsonPayload()

std::string IOVDbNamespace::BasicFolder::jsonPayload ( const std::string &  folderDescription,
const std::string &  spec 
)

Definition at line 119 of file BasicFolder.cxx.

119  {
121  std::string sep="";
122  std::string result("\"data_array\" : [");
123  std::sort(m_channels.begin(), m_channels.end());
124  for (auto &chId : m_channels){
125  result+=sep;
126  result+=s_openJson+quote(std::to_string(chId))+" : ";
127  switch (ftype){
129  {
130  const std::vector<coral::AttributeList>& vAtt = getVectorPayload(chId);
131  std::string os="";
132  std::string sep="";
133  os+='[';//vector of vectors
134  for (auto &att : vAtt){
135  os+=sep;
136  os+=jsonAttributeList(att);
137  if (sep.empty()) sep =s_delimiterJson;
138  }
139  os+=']';
140  result+=os;
141  break;
142  }
146  {
147  const coral::AttributeList& att = getPayload(chId);
148  result +=jsonAttributeList(att);
149  break;
150  }
152  {
153  const coral::AttributeList& att = getPayload(chId);
154  std::ostringstream os;
155  att[0].toOutputStream(os);
156  auto res=os.str();
157  const std::string sep(" : ");
158  const auto separatorPosition = res.find(sep);
159  const std::string payloadOnly=res.substr(separatorPosition+3);
160  result += quote(payloadOnly);
161  break;
162  }
164  {
165  result += " CoraCool";
166  break;
167  }
168  default:
169  result+=" a_data_value";
170  }
171  if (sep.empty()) sep=",";
172  result+=s_closeJson;
173  }
174  result+=']';
175  return result;
176  }

◆ setIov()

void IOVDbNamespace::BasicFolder::setIov ( const std::pair< cool::ValidityKey, cool::ValidityKey > &  iov)

Definition at line 46 of file BasicFolder.cxx.

46  {
47  m_iov=iov;
48  }

◆ setVectorPayloadFlag()

void IOVDbNamespace::BasicFolder::setVectorPayloadFlag ( const bool  flag)

Definition at line 36 of file BasicFolder.cxx.

36  {
38  }

Member Data Documentation

◆ m_channel2Name

std::map<int, std::string> IOVDbNamespace::BasicFolder::m_channel2Name
private

Definition at line 51 of file BasicFolder.h.

◆ m_channels

std::vector<cool::ChannelId> IOVDbNamespace::BasicFolder::m_channels
private

Definition at line 54 of file BasicFolder.h.

◆ m_iov

std::pair<cool::ValidityKey, cool::ValidityKey> IOVDbNamespace::BasicFolder::m_iov
private

Definition at line 55 of file BasicFolder.h.

◆ m_isVectorPayload

bool IOVDbNamespace::BasicFolder::m_isVectorPayload
private

Definition at line 53 of file BasicFolder.h.

◆ m_name2Channel

std::map<std::string, int> IOVDbNamespace::BasicFolder::m_name2Channel
private

Definition at line 50 of file BasicFolder.h.

◆ m_payload

std::map<int, coral::AttributeList> IOVDbNamespace::BasicFolder::m_payload
private

Definition at line 47 of file BasicFolder.h.

◆ m_vectorPayload

std::map<int, std::vector<coral::AttributeList> > IOVDbNamespace::BasicFolder::m_vectorPayload
private

Definition at line 48 of file BasicFolder.h.


The documentation for this class was generated from the following files:
get_generator_info.result
result
Definition: get_generator_info.py:21
IOVDbNamespace::BasicFolder::getPayload
coral::AttributeList getPayload(const cool::ChannelId &channelId)
Definition: BasicFolder.cxx:81
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
IOVDbNamespace::BasicFolder::m_channels
std::vector< cool::ChannelId > m_channels
Definition: BasicFolder.h:54
IOVDbNamespace::PoolRefColl
@ PoolRefColl
Definition: FolderTypes.h:31
IOVDbNamespace::BasicFolder::m_iov
std::pair< cool::ValidityKey, cool::ValidityKey > m_iov
Definition: BasicFolder.h:55
IOVDbNamespace::PoolRef
@ PoolRef
Definition: FolderTypes.h:30
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
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
IOVDbNamespace::CoolVector
@ CoolVector
Definition: FolderTypes.h:33
IOVDbNamespace::CoraCool
@ CoraCool
Definition: FolderTypes.h:32
IOVDbNamespace::AttrListColl
@ AttrListColl
Definition: FolderTypes.h:29
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
grepfile.sep
sep
Definition: grepfile.py:38
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
IOVDbNamespace::jsonAttributeList
std::string jsonAttributeList(const coral::AttributeList &atrlist)
Produce a representation of a coral::AttributeList as a json string.
Definition: IOVDbJsonStringFunctions.cxx:40
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::iov
std::pair< cool::ValidityKey, cool::ValidityKey > iov()
Definition: BasicFolder.cxx:116
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
IOVDbNamespace::AttrList
@ AttrList
Definition: FolderTypes.h:28
IOVDbNamespace::BasicFolder::m_channel2Name
std::map< int, std::string > m_channel2Name
Definition: BasicFolder.h:51
IOVDbNamespace::determineFolderType
FolderType determineFolderType(const std::string &folderDescription, const std::string &spec, const std::vector< cool::ChannelId > &chans)
Determine folder type with optional check using clid service to check clid matches typename.
Definition: FolderTypes.cxx:17
IOVDbNamespace::BasicFolder::getVectorPayload
std::vector< coral::AttributeList > getVectorPayload(const cool::ChannelId &channelId)
Definition: BasicFolder.cxx:96
IOVDbNamespace::quote
std::string quote(const std::string &sentence)
Enclose a string in ".
Definition: IOVDbStringFunctions.cxx:85
IOVDbNamespace::BasicFolder::m_vectorPayload
std::map< int, std::vector< coral::AttributeList > > m_vectorPayload
Definition: BasicFolder.h:48
IOVDbNamespace::FolderType
FolderType
Definition: FolderTypes.h:26