ATLAS Offline Software
Loading...
Searching...
No Matches
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
18namespace cool{
19 class ChannelSelection;
20}
21
22
23namespace 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:
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
unsigned int nchans() const
Number of channels in the folder.
const std::string & tag() const
Simply the tag string passed to the constructor.
std::string iov() const
Formatted iov as '[<since>, <until>]'.
const cool::ChannelSelection m_chansel
Definition Cool2Json.h:83
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
const std::string m_spec
Definition Cool2Json.h:86
static std::string formatPoolRef(const cool::IObjectIteratorPtr &itr)
std::string description() const
Folder description string.
Definition Cool2Json.cxx:81
const std::string & payloadSpec() const
Payload specification for this folder.
Definition Cool2Json.cxx:91
static std::string formatAttrList(const cool::IObjectIteratorPtr &itr)
static std::string delimiter()
json standard delimiter ', '
static std::string formatCvp(const cool::IObjectIteratorPtr &itr)
const cool::ValidityKey m_stop
Definition Cool2Json.h:82
const cool::IFolderPtr m_pFolder
Definition Cool2Json.h:80
std::string iovBase() const
'time' (ns of epoch) or 'run-lumi'
friend std::ostream & operator<<(std::ostream &o, const Cool2Json &c)
std::string payload()
Payload (data for the given channel selection and iov)
Definition Cool2Json.cxx:97
static std::string open()
json open tag, '{'
static std::string close()
json close tag, '}'
const cool::ValidityKey m_start
Definition Cool2Json.h:81
const std::string m_tag
Definition Cool2Json.h:84
const std::string m_desc
Definition Cool2Json.h:85
std::ostream & operator<<(std::ostream &o, const Cool2Json &c)