HltStoreSvc Class Reference

#include <HltStoreSvc.h>

List of all members.

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


Detailed Description

Definition at line 16 of file HltStoreSvc.h.


Member Typedef Documentation

typedef map<string, BaseHolder*> HltStoreSvc::ContainerType [protected]

Definition at line 36 of file HltStoreSvc.h.


Constructor & Destructor Documentation

HltStoreSvc::HltStoreSvc ( const std::string name,
ISvcLocator *  sl 
)

Definition at line 15 of file HltStoreSvc.cxx.

00015                                                                  : Service(name, sl) 
00016 { }

HltStoreSvc::~HltStoreSvc (  ) 

Definition at line 18 of file HltStoreSvc.cxx.

00019 { }


Member Function Documentation

bool HltStoreSvc::clear ( void   )  [inline]

Definition at line 108 of file HltStoreSvc.h.

References m_map.

00108                    {
00109     for (ContainerType::iterator it = m_map.begin(); it != m_map.end(); it++) {
00110       delete (*it).second;
00111     }
00112     m_map.erase(m_map.begin(), m_map.end());
00113     return true;
00114   }

bool HltStoreSvc::erase ( const std::string name  )  [inline]

Definition at line 95 of file HltStoreSvc.h.

References m_map.

00095                                     {
00096     ContainerType::iterator it = m_map.find(name);
00097     if(it != m_map.end()) {
00098       delete (*it).second;
00099       m_map.erase(it);
00100       return true;
00101     }
00102     return false;
00103   }

bool HltStoreSvc::exists ( const std::string name  ) 

Definition at line 116 of file HltStoreSvc.cxx.

References m_map.

00116                                               {
00117   return (m_map.find(name) != m_map.end());
00118 }

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 }

template<class T>
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 (  ) 

Definition at line 66 of file HltStoreSvc.cxx.

References m_map.

00066                            {
00067   ContainerType::iterator pos;
00068   for (pos = m_map.begin(); pos != m_map.end(); ++pos) {
00069     cout << pos->first << endl;
00070   }
00071 }

template<class T>
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 }


Member Data Documentation

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().


Generated on Tue Nov 29 23:19:41 2016 for BOSS_7.0.2 by  doxygen 1.4.7