ATLAS Offline Software
CoWLibrary.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "CoWTools/CoWLibrary.h"
6 #include <memory>
7 
8 namespace CoWTools{
9  void CoWLibrary::parseRecord(std::istream &in){
10  //std::cout<<"Got record line "<<line<<std::endl;
11  auto mr=std::make_shared<CoWRecord>(m_summary);
12  mr->parseRecord(in);
13  m_ms+=mr->m_ms;
14  }
15 
16  // std::ostream & operator<<(std::ostream &out, const CoWLibrary &l){
17  // out<<"library = "<<l.m_libName<<std::endl;
18  // out<<l.m_ms<<std::endl;
19  // out<<"-------------------------------------------------------"<<std::endl;
20  // return out;
21  // }
22 
23  std::shared_ptr<CoWLibrary> CoWLibrary::fromRecord(std::istream &in, bool summary){
24  std::string libLine;
25  if(std::getline(in,libLine).eof()){
26  //std::cerr<<libLine<<std::endl;
27  std::cerr<<"Returning 0"<<std::endl;
28  return 0;
29  }
30  int len=0;
31  int nfields=0;
32  std::string libName="Anonymous";
33  char buff[2048];
34  //std::cerr<<"LibLine="<<libLine<<std::endl;
35  sscanf(libLine.c_str(),"%*s %*s %*s %*s %*s%n",
36  &len
37  );
38  if(libLine.size()>(uint)(len+1)){
39  nfields=sscanf(libLine.substr(len+1).c_str(),"%2047s",buff);
40  if(nfields>0){
41  libName=buff;
42  //std::cout<<"Found lib "<<libName<<std::endl;
43  }
44  }else{
45  libName="Anonymous";
46  }
47  auto lib=std::make_shared<CoWTools::CoWLibrary>(libName,summary);
49  r.parseRecord(in);
50  lib->m_ms+=r;
51  return lib;
52  }
53 
54  std::ostream & operator<<(std::ostream &os, const CoWTools::CoWLibrary &l){
55  // char buff[1024];
56  // snprintf(buff,1024,"Library= %s"
57  // );
58  // out<<buff;
59 
60  os<<" Lib= "<<l.m_libName<<" "<<l.m_ms;
61  return os;
62  }
63 }
get_hdefs.buff
buff
Definition: get_hdefs.py:61
beamspotman.r
def r
Definition: beamspotman.py:676
checkPlugins.libName
libName
Definition: checkPlugins.py:143
CoWTools::CoWLibrary
Definition: CoWLibrary.h:16
CoWTools::CoWLibrary::parseRecord
void parseRecord(std::istream &in)
Definition: CoWLibrary.cxx:9
CoWTools::operator<<
std::ostream & operator<<(std::ostream &os, const CoWTools::CoWLibrary &l)
Definition: CoWLibrary.cxx:54
CoWTools::CoWLibrary::m_ms
CoWRecordStats m_ms
Definition: CoWLibrary.h:23
CoWTools::CoWLibrary::fromRecord
static std::shared_ptr< CoWLibrary > fromRecord(std::istream &in, bool summary)
Definition: CoWLibrary.cxx:23
CoWTools::CoWLibrary::m_summary
bool m_summary
Definition: CoWLibrary.h:26
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
ReadOfcFromCool.nfields
nfields
Definition: ReadOfcFromCool.py:114
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
python.update_ci_reference_files.mr
mr
Definition: update_ci_reference_files.py:415
CoWTools::CoWRecordStats
Definition: CoWRecordStats.h:13
CoWTools
Definition: CoWLibrary.h:15
CoWLibrary.h
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65