#include <HltStoreSvc.h>
Public Member Functions | |
HltStoreSvc (const std::string &name, ISvcLocator *sl) | |
~HltStoreSvc () | |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvIF) |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
void | printKeys () |
int | size () |
int | max_size () |
string | sListLength () |
bool | exists (const std::string &name) |
template<class T> | |
bool | put (const std::string &name, const T &value) |
template<class T> | |
bool | get (const std::string &name, T &value) |
bool | erase (const std::string &name) |
bool | clear (void) |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
Protected Types | |
typedef map< string, BaseHolder * > | ContainerType |
Protected Attributes | |
ContainerType | m_map |
Classes | |
class | BaseHolder |
class | Holder |
Definition at line 16 of file HltStoreSvc.h.
typedef map<string, BaseHolder*> HltStoreSvc::ContainerType [protected] |
Definition at line 36 of file HltStoreSvc.h.
HltStoreSvc::HltStoreSvc | ( | const std::string & | name, | |
ISvcLocator * | sl | |||
) |
HltStoreSvc::~HltStoreSvc | ( | ) |
bool HltStoreSvc::clear | ( | void | ) | [inline] |
bool HltStoreSvc::erase | ( | const std::string & | name | ) | [inline] |
bool HltStoreSvc::exists | ( | const std::string & | name | ) |
StatusCode HltStoreSvc::finalize | ( | ) | [virtual] |
Definition at line 53 of file HltStoreSvc.cxx.
References m_map, and boss::pos.
00054 { 00055 ContainerType::iterator pos; 00056 for (pos = m_map.begin(); pos != m_map.end(); ++pos) { 00057 // delete (*pos).second; 00058 } 00059 m_map.erase(m_map.begin(),m_map.end()); 00060 return StatusCode::SUCCESS; 00061 }
bool HltStoreSvc::get | ( | const std::string & | name, | |
T & | value | |||
) | [inline] |
Definition at line 76 of file HltStoreSvc.h.
References m_map.
Referenced by EFtoTDS::execute(), EFSectorHits::execute(), CheckEFResult::execute(), EFEventLoopMgr::initialize(), IEFAlgorithm::initialize(), and HltProcessor::HltCriteria::satisfyCriteria().
00076 { 00077 //std::cout << "HltStoreSvc::get() "<<"start"<<std::endl; 00078 ContainerType::iterator it = m_map.find(name); 00079 //std::cout << "HltStoreSvc::get() "<<"middle"<<std::endl; 00080 if(it != m_map.end()) { 00081 if(Holder<T>* ptr = static_cast<Holder<T>* >((*it).second)) { 00082 value = ptr->value(); 00083 return true; 00084 } 00085 } 00086 //std::cout << "HltStoreSvc::get() "<<"end"<<std::endl; 00087 return false; 00088 }
StatusCode HltStoreSvc::initialize | ( | ) | [virtual] |
Definition at line 32 of file HltStoreSvc.cxx.
References Bes_Common::INFO.
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 sc = service( "HltStoreSvc", m_HltStore); 00044 if( sc.isFailure() ) { 00045 log<<MSG::WARNING<<"Unable to get service HltStore"<<endreq; 00046 return sc; 00047 } 00048 log << MSG::DEBUG << "(*p)" << (unsigned long)m_HltStore << endreq; 00049 */ 00050 return StatusCode::SUCCESS; 00051 }
static const InterfaceID& HltStoreSvc::interfaceID | ( | ) | [inline, static] |
Definition at line 32 of file HltStoreSvc.h.
References IID_IHltStoreSvc().
00032 { return IID_IHltStoreSvc; }
int HltStoreSvc::max_size | ( | ) |
Definition at line 77 of file HltStoreSvc.cxx.
References m_map.
Referenced by sListLength().
00077 { 00078 return m_map.max_size(); 00079 }
void HltStoreSvc::printKeys | ( | ) |
bool HltStoreSvc::put | ( | const std::string & | name, | |
const T & | value | |||
) | [inline] |
Definition at line 60 of file HltStoreSvc.h.
References m_map.
Referenced by EFSectorHits::initialize(), EFProcessCluster::initialize(), EFGlobalEnergy::initialize(), EFFlightTime::initialize(), EFDetectorHits::initialize(), EFChargedTrack::initialize(), and StepHandler::initialize().
00060 { 00061 Holder<T> *ptr = new Holder<T>(value); 00062 if(BaseHolder *old = m_map[name]) { 00063 std::cout << "demanded key already exists, overwrite old one" << std::endl; 00064 delete old; 00065 } 00066 m_map[name] = ptr; 00067 return true; 00068 }
StatusCode HltStoreSvc::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvIF | |||
) | [virtual] |
Definition at line 21 of file HltStoreSvc.cxx.
References IID_IHltStoreSvc().
00022 { 00023 if ( IID_IHltStoreSvc.versionMatch(riid) ) { 00024 // *ppvIF = static_cast<IHltStoreSvc*> (this); 00025 *ppvIF = (HltStoreSvc*)this; 00026 } else { 00027 return Service::queryInterface(riid, ppvIF) ; 00028 } 00029 return StatusCode::SUCCESS; 00030 }
int HltStoreSvc::size | ( | ) |
Definition at line 73 of file HltStoreSvc.cxx.
References m_map.
Referenced by sListLength().
00073 { 00074 return m_map.size(); 00075 }
string HltStoreSvc::sListLength | ( | ) |
Definition at line 86 of file HltStoreSvc.cxx.
References genRecEmupikp::i, max_size(), size(), and deljobs::string.
00086 { 00087 unsigned int iListLength = this->size(); 00088 iListLength += 1; 00089 ostrstream ListLength; 00090 00091 //convert integer into std::string 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 }
ContainerType HltStoreSvc::m_map [protected] |
Definition at line 145 of file HltStoreSvc.h.
Referenced by clear(), erase(), exists(), finalize(), get(), max_size(), printKeys(), put(), and size().