#include <Cool2Json.h>
|
| | Cool2Json (const cool::IFolderPtr &pFolder, const cool::ValidityKey &since, const cool::ValidityKey &until, const cool::ChannelSelection &m_chansel, const std::string &folderTag) |
| std::string | description () const |
| | Folder description string.
|
| const std::string & | payloadSpec () const |
| | Payload specification for this folder.
|
| std::string | payload () |
| | Payload (data for the given channel selection and iov)
|
| std::string | iov () const |
| | Formatted iov as '[<since>, <until>]'.
|
| unsigned int | nchans () const |
| | Number of channels in the folder.
|
| std::string | iovBase () const |
| | 'time' (ns of epoch) or 'run-lumi'
|
| const std::string & | tag () const |
| | Simply the tag string passed to the constructor.
|
|
| static std::string | open () |
| | json open tag, '{'
|
| static std::string | close () |
| | json close tag, '}'
|
| static std::string | delimiter () |
| | json standard delimiter ', '
|
|
| static std::string | formatCvp (const cool::IObjectIteratorPtr &itr) |
| static std::string | formatAttrList (const cool::IObjectIteratorPtr &itr) |
| static std::string | formatPoolRef (const cool::IObjectIteratorPtr &itr) |
Definition at line 26 of file Cool2Json.h.
◆ FolderType
| Enumerator |
|---|
| AttrList | |
| AttrListColl | |
| PoolRef | |
| PoolRefColl | |
| CoraCool | |
| CoolVector | |
| JSON | |
| NUM_FOLDER_TYPES | |
Definition at line 70 of file Cool2Json.h.
◆ Cool2Json()
| IOVDbNamespace::Cool2Json::Cool2Json |
( |
const cool::IFolderPtr & | pFolder, |
|
|
const cool::ValidityKey & | since, |
|
|
const cool::ValidityKey & | until, |
|
|
const cool::ChannelSelection & | m_chansel, |
|
|
const std::string & | folderTag ) |
Definition at line 59 of file Cool2Json.cxx.
63 :
69 m_desc(pFolder->description()),
70 m_spec(spec2String(pFolder)),
72 const auto & channums=pFolder->listChannels();
73
74
75 for (const auto &i:channums){
77 }
78 }
const cool::ChannelSelection m_chansel
const cool::ValidityKey m_stop
const cool::IFolderPtr m_pFolder
const cool::ValidityKey m_start
◆ close()
| std::string IOVDbNamespace::Cool2Json::close |
( |
| ) |
|
|
static |
◆ delimiter()
| std::string IOVDbNamespace::Cool2Json::delimiter |
( |
| ) |
|
|
static |
json standard delimiter ', '
◆ description()
| std::string IOVDbNamespace::Cool2Json::description |
( |
| ) |
const |
Folder description string.
Definition at line 81 of file Cool2Json.cxx.
81 {
83 saneXml = std::regex_replace(saneXml, std::regex("\\\\\""), "\"");
84 std::string
out =
"\"node_description\" : \"";
88 }
std::string sanitiseXml(const std::string &pseudoXmlString)
for use when converting cool folder description JSON
◆ formatAttrList()
| std::string IOVDbNamespace::Cool2Json::formatAttrList |
( |
const cool::IObjectIteratorPtr & | itr | ) |
|
|
staticprivate |
Definition at line 176 of file Cool2Json.cxx.
176 {
177 const cool::IObject&
ref=itr->currentRef();
178 const coral::AttributeList& atrlist=
ref.payload().attributeList();
181 }
const boost::regex ref(r_ef)
std::string jsonAttributeList(const coral::AttributeList &atrlist)
Produce a representation of a coral::AttributeList as a json string.
◆ formatCvp()
| std::string IOVDbNamespace::Cool2Json::formatCvp |
( |
const cool::IObjectIteratorPtr & | itr | ) |
|
|
staticprivate |
Definition at line 158 of file Cool2Json.cxx.
158 {
160 const cool::IObject&
ref=itr->currentRef();
161 cool::IRecordIterator& pitr=
ref.payloadIterator();
162 auto pvec=pitr.fetchAllAsVector();
165 for (
const auto & vitr:*
pvec){
167 const coral::AttributeList& atrlist=(vitr)->attributeList();
170 }
173 }
static const std::string s_delimiterJson
json standard delimiter ', '
◆ formatPoolRef()
| std::string IOVDbNamespace::Cool2Json::formatPoolRef |
( |
const cool::IObjectIteratorPtr & | itr | ) |
|
|
staticprivate |
Definition at line 184 of file Cool2Json.cxx.
184 {
185 const cool::IObject&
ref=itr->currentRef();
186 const coral::AttributeList& atrlist=
ref.payload().attributeList();
187 std::ostringstream
os;
188 atrlist[0].toOutputStream(os);
190 const std::string
sep(
" : ");
191 const auto separatorPosition =
res.find(sep);
192 const std::string payloadOnly=
res.substr(separatorPosition+3);
193 return quote(payloadOnly);
194 }
std::pair< std::vector< unsigned int >, bool > res
std::string quote(const std::string &sentence)
Enclose a string in ".
◆ iov()
| std::string IOVDbNamespace::Cool2Json::iov |
( |
| ) |
const |
Formatted iov as '[<since>, <until>]'.
Definition at line 197 of file Cool2Json.cxx.
197 {
198 std::string iovString("\"iov\" : ");
199 return iovString+
"["+std::to_string(
m_start)+
", "+std::to_string(
m_stop)+
"]";
200 }
◆ iovBase()
| std::string IOVDbNamespace::Cool2Json::iovBase |
( |
| ) |
const |
'time' (ns of epoch) or 'run-lumi'
Definition at line 143 of file Cool2Json.cxx.
143 {
145
146 if (
m_desc.find(
"<timeStamp>run-lumi</timeStamp>") != std::string::npos)
result =
"run-lumi";
147 if (
m_desc.find(
"<timeStamp>run-event</timeStamp>") != std::string::npos)
result =
"run-lumi";
148 if (
m_desc.find(
"<timeStamp>time</timeStamp>") != std::string::npos)
result =
"time";
150 }
◆ nchans()
| unsigned int IOVDbNamespace::Cool2Json::nchans |
( |
| ) |
const |
◆ open()
| std::string IOVDbNamespace::Cool2Json::open |
( |
| ) |
|
|
static |
◆ payload()
| std::string IOVDbNamespace::Cool2Json::payload |
( |
| ) |
|
Payload (data for the given channel selection and iov)
Definition at line 97 of file Cool2Json.cxx.
97 {
98 std::string
result(
"\"data_array\" : [");
102 while (itr->goToNext()){
103 const cool::IObject&
ref=itr->currentRef();
105 const long long cId=
ref.channelId();
107 switch (ftype){
110 break;
113 break;
116 break;
119 break;
122 break;
125 break;
126 default:
128 }
131 }
133 itr->close();
135 }
static std::string formatPoolRef(const cool::IObjectIteratorPtr &itr)
static std::string formatAttrList(const cool::IObjectIteratorPtr &itr)
static std::string formatCvp(const cool::IObjectIteratorPtr &itr)
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.
static const std::string s_closeJson
json close tag, '}'
static const std::string s_openJson
json open tag, '{'
◆ payloadSpec()
| const std::string & IOVDbNamespace::Cool2Json::payloadSpec |
( |
| ) |
const |
Payload specification for this folder.
Definition at line 91 of file Cool2Json.cxx.
◆ tag()
| const std::string & IOVDbNamespace::Cool2Json::tag |
( |
| ) |
const |
Simply the tag string passed to the constructor.
Definition at line 153 of file Cool2Json.cxx.
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | o, |
|
|
const Cool2Json & | c ) |
|
friend |
Definition at line 202 of file Cool2Json.cxx.
202 {
203 o <<
c.description() << std::endl;
204 return o;
205 }
◆ m_chansel
| const cool::ChannelSelection IOVDbNamespace::Cool2Json::m_chansel |
|
private |
◆ m_desc
| const std::string IOVDbNamespace::Cool2Json::m_desc |
|
private |
◆ m_nchans
| unsigned int IOVDbNamespace::Cool2Json::m_nchans |
|
private |
◆ m_pFolder
| const cool::IFolderPtr IOVDbNamespace::Cool2Json::m_pFolder |
|
private |
◆ m_spec
| const std::string IOVDbNamespace::Cool2Json::m_spec |
|
private |
◆ m_start
| const cool::ValidityKey IOVDbNamespace::Cool2Json::m_start |
|
private |
◆ m_stop
| const cool::ValidityKey IOVDbNamespace::Cool2Json::m_stop |
|
private |
◆ m_tag
| const std::string IOVDbNamespace::Cool2Json::m_tag |
|
private |
The documentation for this class was generated from the following files: