00001 #include "GaudiKernel/Kernel.h"
00002 #include "GaudiKernel/IInterface.h"
00003 #include "GaudiKernel/StatusCode.h"
00004
00005 #include "GaudiKernel/SvcFactory.h"
00006 #include "GaudiKernel/MsgStream.h"
00007 #include "HltStore/HltStoreSvc.h"
00008
00009 #include <strstream>
00010 #include <algorithm>
00011
00012 static SvcFactory<HltStoreSvc> s_factory;
00013
00014
00015 HltStoreSvc::HltStoreSvc( const std::string& name, ISvcLocator* sl ) : Service(name, sl)
00016 { }
00017
00018 HltStoreSvc::~HltStoreSvc()
00019 { }
00020
00021 StatusCode HltStoreSvc::queryInterface (const InterfaceID& riid, void** ppvIF )
00022 {
00023 if ( IID_IHltStoreSvc.versionMatch(riid) ) {
00024
00025 *ppvIF = (HltStoreSvc*)this;
00026 } else {
00027 return Service::queryInterface(riid, ppvIF) ;
00028 }
00029 return StatusCode::SUCCESS;
00030 }
00031
00032 StatusCode HltStoreSvc::initialize ( )
00033 {
00034 StatusCode sc;
00035
00036 MsgStream log(messageService(), name());
00037 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
00038
00039 sc = Service::initialize();
00040 if ( sc.isFailure() ) return sc;
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 return StatusCode::SUCCESS;
00051 }
00052
00053 StatusCode HltStoreSvc::finalize ( )
00054 {
00055 ContainerType::iterator pos;
00056 for (pos = m_map.begin(); pos != m_map.end(); ++pos) {
00057
00058 }
00059 m_map.erase(m_map.begin(),m_map.end());
00060 return StatusCode::SUCCESS;
00061 }
00062
00063
00064
00065
00066 void HltStoreSvc::printKeys(){
00067 ContainerType::iterator pos;
00068 for (pos = m_map.begin(); pos != m_map.end(); ++pos) {
00069 cout << pos->first << endl;
00070 }
00071 }
00072
00073 int HltStoreSvc::size(){
00074 return m_map.size();
00075 }
00076
00077 int HltStoreSvc::max_size(){
00078 return m_map.max_size();
00079 }
00080
00081
00082
00083
00084
00085
00086 string HltStoreSvc::sListLength(){
00087 unsigned int iListLength = this->size();
00088 iListLength += 1;
00089 ostrstream ListLength;
00090
00091
00092 ListLength << iListLength;
00093 ListLength << '\0';
00094 string stringListLength = ListLength.str();
00095 if (this->exists(stringListLength)){
00096 stringListLength = "unset";
00097 for (int i = 0; i < this->max_size(); i++){
00098 iListLength += 1;
00099 ListLength << iListLength;
00100 ListLength << '\0';
00101 stringListLength = ListLength.str();
00102 if (!(this->exists(stringListLength))) {
00103 ListLength.freeze(0);
00104 return stringListLength;
00105 }
00106 }
00107 }
00108
00109 ListLength.freeze(0);
00110 return stringListLength;
00111 }
00112
00113
00114
00115
00116 bool HltStoreSvc::exists(const std::string& name) {
00117 return (m_map.find(name) != m_map.end());
00118 }
00119