ATLAS Offline Software
Cool2Json.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 Cool2Json.h
5 // Header for Cool2Json class
6 // @author Shaun Roe
7 // @date 04 October 2017
8 #ifndef IOVDbSvc_Cool2Json_h
9 #define IOVDbSvc_Cool2Json_h
10 
11 #include <string>
12 #include <iostream>
13 
14 #include "CoolKernel/ValidityKey.h"//its a typedef
15 #include "CoolKernel/IFolder.h"
16 #include "CoolKernel/pointers.h" //IFolderPtr etc, typedefs
17 
18 namespace cool{
19  class ChannelSelection;
20 }
21 
22 
23 namespace IOVDbNamespace {
24  //@brief Formatter helper class
25  //Formats cool attributes, lists to json string representation and provides JSON
26  class Cool2Json{
27  //@stream insertion
28  friend std::ostream& operator<<(std::ostream& o, const Cool2Json &c);
29  //
30  public:
31  //class methods
32 
33  //@Constructor sets internal variables
34  Cool2Json(const cool::IFolderPtr & pFolder, const cool::ValidityKey & since,
35  const cool::ValidityKey & until, const cool::ChannelSelection & m_chansel,
36  const std::string& folderTag);
37 
39  std::string description() const;
40 
42  const std::string& payloadSpec() const;
43 
45  std::string payload();
46 
48  std::string iov() const;
49 
51  unsigned int nchans() const;
52 
54  std::string iovBase() const;
55 
57  const std::string& tag() const;
58 
60  static std::string open();
61 
63  static std::string close();
64 
66  static std::string delimiter();
67 
68 
69  private:
70  enum FolderType {
79  };
80  const cool::IFolderPtr m_pFolder;
81  const cool::ValidityKey m_start;
82  const cool::ValidityKey m_stop;
83  const cool::ChannelSelection m_chansel;
84  const std::string m_tag;
85  const std::string m_desc;
86  const std::string m_spec;
87  unsigned int m_nchans;
88  static std::string formatCvp(const cool::IObjectIteratorPtr & itr);
89  static std::string formatAttrList(const cool::IObjectIteratorPtr & itr);
90  static std::string formatPoolRef(const cool::IObjectIteratorPtr & itr);
91  };
92 
93 
94  std::ostream &operator<<(std::ostream &o, const Cool2Json &c);
95 
96 
97 }
98 
99 
100 #endif
IOVDbNamespace::Cool2Json::m_nchans
unsigned int m_nchans
Definition: Cool2Json.h:87
IOVDbNamespace::Cool2Json
Definition: Cool2Json.h:26
IOVDbNamespace::Cool2Json::formatCvp
static std::string formatCvp(const cool::IObjectIteratorPtr &itr)
Definition: Cool2Json.cxx:157
IOVDbNamespace::Cool2Json::open
static std::string open()
json open tag, '{'
IOVDbNamespace::operator<<
std::ostream & operator<<(std::ostream &o, const Cool2Json &c)
Definition: Cool2Json.cxx:201
IOVDbNamespace::Cool2Json::m_desc
const std::string m_desc
Definition: Cool2Json.h:85
IOVDbNamespace::Cool2Json::m_stop
const cool::ValidityKey m_stop
Definition: Cool2Json.h:82
IOVDbNamespace::Cool2Json::Cool2Json
Cool2Json(const cool::IFolderPtr &pFolder, const cool::ValidityKey &since, const cool::ValidityKey &until, const cool::ChannelSelection &m_chansel, const std::string &folderTag)
Definition: Cool2Json.cxx:59
IOVDbNamespace::Cool2Json::CoolVector
@ CoolVector
Definition: Cool2Json.h:76
cool
Definition: CoolTagInfo.h:12
dq_defect_copy_defect_database.since
def since
Definition: dq_defect_copy_defect_database.py:54
dq_defect_copy_defect_database.until
def until
Definition: dq_defect_copy_defect_database.py:55
IOVDbNamespace::Cool2Json::m_pFolder
const cool::IFolderPtr m_pFolder
Definition: Cool2Json.h:80
IOVDbNamespace::Cool2Json::m_start
const cool::ValidityKey m_start
Definition: Cool2Json.h:81
IOVDbNamespace::Cool2Json::operator<<
friend std::ostream & operator<<(std::ostream &o, const Cool2Json &c)
Definition: Cool2Json.cxx:201
IOVDbNamespace::Cool2Json::payload
std::string payload()
Payload (data for the given channel selection and iov)
Definition: Cool2Json.cxx:96
IOVDbNamespace::Cool2Json::FolderType
FolderType
Definition: Cool2Json.h:70
IOVDbNamespace::Cool2Json::JSON
@ JSON
Definition: Cool2Json.h:77
IOVDbNamespace::Cool2Json::delimiter
static std::string delimiter()
json standard delimiter ', '
IOVDbNamespace::Cool2Json::m_spec
const std::string m_spec
Definition: Cool2Json.h:86
IOVDbNamespace::Cool2Json::m_tag
const std::string m_tag
Definition: Cool2Json.h:84
IOVDbNamespace::Cool2Json::payloadSpec
const std::string & payloadSpec() const
Payload specification for this folder.
Definition: Cool2Json.cxx:90
IOVDbNamespace::Cool2Json::CoraCool
@ CoraCool
Definition: Cool2Json.h:75
CaloCondBlobAlgs_fillNoiseFromASCII.folderTag
folderTag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:52
IOVDbNamespace::Cool2Json::formatPoolRef
static std::string formatPoolRef(const cool::IObjectIteratorPtr &itr)
Definition: Cool2Json.cxx:183
IOVDbNamespace::Cool2Json::formatAttrList
static std::string formatAttrList(const cool::IObjectIteratorPtr &itr)
Definition: Cool2Json.cxx:175
IOVDbNamespace::Cool2Json::NUM_FOLDER_TYPES
@ NUM_FOLDER_TYPES
Definition: Cool2Json.h:78
IOVDbNamespace::Cool2Json::AttrListColl
@ AttrListColl
Definition: Cool2Json.h:72
IOVDbNamespace::Cool2Json::tag
const std::string & tag() const
Simply the tag string passed to the constructor.
Definition: Cool2Json.cxx:152
IOVDbNamespace::Cool2Json::PoolRef
@ PoolRef
Definition: Cool2Json.h:73
IOVDbNamespace::Cool2Json::iov
std::string iov() const
Formatted iov as '[<since>, <until>]'.
Definition: Cool2Json.cxx:196
IOVDbNamespace::Cool2Json::close
static std::string close()
json close tag, '}'
IOVDbNamespace::Cool2Json::description
std::string description() const
Folder description string.
Definition: Cool2Json.cxx:81
IOVDbNamespace::Cool2Json::iovBase
std::string iovBase() const
'time' (ns of epoch) or 'run-lumi'
Definition: Cool2Json.cxx:142
IOVDbNamespace::Cool2Json::nchans
unsigned int nchans() const
Number of channels in the folder.
Definition: Cool2Json.cxx:137
IOVDbNamespace::Cool2Json::AttrList
@ AttrList
Definition: Cool2Json.h:71
IOVDbNamespace::Cool2Json::PoolRefColl
@ PoolRefColl
Definition: Cool2Json.h:74
python.compressB64.c
def c
Definition: compressB64.py:93
IOVDbNamespace::Cool2Json::m_chansel
const cool::ChannelSelection m_chansel
Definition: Cool2Json.h:83
IOVDbNamespace
Definition: Base64Codec.cxx:16