BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
HltStoreSvc Class Reference

#include <HltStoreSvc.h>

+ Inheritance diagram for HltStoreSvc:

Classes

class  BaseHolder
 
class  Holder
 

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
 

Detailed Description

Definition at line 16 of file HltStoreSvc.h.

Member Typedef Documentation

◆ ContainerType

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

Definition at line 38 of file HltStoreSvc.h.

Constructor & Destructor Documentation

◆ HltStoreSvc()

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

Definition at line 15 of file HltStoreSvc.cxx.

15 : Service(name, sl)
16{ }

◆ ~HltStoreSvc()

HltStoreSvc::~HltStoreSvc ( )

Definition at line 18 of file HltStoreSvc.cxx.

19{ }

Member Function Documentation

◆ clear()

bool HltStoreSvc::clear ( void  )
inline

Definition at line 108 of file HltStoreSvc.h.

108 {
109 for (ContainerType::iterator it = m_map.begin(); it != m_map.end(); it++) {
110 delete (*it).second;
111 }
112 m_map.erase(m_map.begin(), m_map.end());
113 return true;
114 }
ContainerType m_map
Definition: HltStoreSvc.h:145

◆ erase()

bool HltStoreSvc::erase ( const std::string &  name)
inline

Definition at line 95 of file HltStoreSvc.h.

95 {
96 ContainerType::iterator it = m_map.find(name);
97 if(it != m_map.end()) {
98 delete (*it).second;
99 m_map.erase(it);
100 return true;
101 }
102 return false;
103 }

◆ exists()

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

Definition at line 116 of file HltStoreSvc.cxx.

116 {
117 return (m_map.find(name) != m_map.end());
118}

Referenced by sListLength().

◆ finalize()

StatusCode HltStoreSvc::finalize ( )
virtual

Definition at line 53 of file HltStoreSvc.cxx.

54{
55 ContainerType::iterator pos;
56 for (pos = m_map.begin(); pos != m_map.end(); ++pos) {
57// delete (*pos).second;
58 }
59 m_map.erase(m_map.begin(),m_map.end());
60 return StatusCode::SUCCESS;
61}

◆ get()

template<class T >
bool HltStoreSvc::get ( const std::string &  name,
T &  value 
)
inline

Definition at line 76 of file HltStoreSvc.h.

76 {
77 //std::cout << "HltStoreSvc::get() "<<"start"<<std::endl;
78 ContainerType::iterator it = m_map.find(name);
79 //std::cout << "HltStoreSvc::get() "<<"middle"<<std::endl;
80 if(it != m_map.end()) {
81 if(Holder<T>* ptr = static_cast<Holder<T>* >((*it).second)) {
82 value = ptr->value();
83 return true;
84 }
85 }
86 //std::cout << "HltStoreSvc::get() "<<"end"<<std::endl;
87 return false;
88 }

Referenced by CheckEFResult::execute(), EFSectorHits::execute(), EFtoTDS::execute(), IEFAlgorithm::initialize(), EFEventLoopMgr::initialize(), and HltProcessor::HltCriteria::satisfyCriteria().

◆ initialize()

StatusCode HltStoreSvc::initialize ( )
virtual

Definition at line 32 of file HltStoreSvc.cxx.

33{
34 StatusCode sc;
35
36 MsgStream log(messageService(), name());
37 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
38
39 sc = Service::initialize();
40 if ( sc.isFailure() ) return sc;
41
42 /*
43 sc = service( "HltStoreSvc", m_HltStore);
44 if( sc.isFailure() ) {
45 log<<MSG::WARNING<<"Unable to get service HltStore"<<endreq;
46 return sc;
47 }
48 log << MSG::DEBUG << "(*p)" << (unsigned long)m_HltStore << endreq;
49 */
50 return StatusCode::SUCCESS;
51}

◆ interfaceID()

static const InterfaceID & HltStoreSvc::interfaceID ( )
inlinestatic

Definition at line 32 of file HltStoreSvc.h.

32{ return IID_IHltStoreSvc; }

◆ max_size()

int HltStoreSvc::max_size ( )

Definition at line 77 of file HltStoreSvc.cxx.

77 {
78 return m_map.max_size();
79}

Referenced by sListLength().

◆ printKeys()

void HltStoreSvc::printKeys ( )

Definition at line 66 of file HltStoreSvc.cxx.

66 {
67 ContainerType::iterator pos;
68 for (pos = m_map.begin(); pos != m_map.end(); ++pos) {
69 cout << pos->first << endl;
70 }
71}

◆ put()

template<class T >
bool HltStoreSvc::put ( const std::string &  name,
const T &  value 
)
inline

Definition at line 60 of file HltStoreSvc.h.

60 {
61 Holder<T> *ptr = new Holder<T>(value);
62 if(BaseHolder *old = m_map[name]) {
63 std::cout << "demanded key already exists, overwrite old one" << std::endl;
64 delete old;
65 }
66 m_map[name] = ptr;
67 return true;
68 }

Referenced by StepHandler::initialize(), EFChargedTrack::initialize(), EFDetectorHits::initialize(), EFFlightTime::initialize(), EFGlobalEnergy::initialize(), EFProcessCluster::initialize(), and EFSectorHits::initialize().

◆ queryInterface()

StatusCode HltStoreSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvIF 
)
virtual

Definition at line 21 of file HltStoreSvc.cxx.

22{
23 if ( IID_IHltStoreSvc.versionMatch(riid) ) {
24// *ppvIF = static_cast<IHltStoreSvc*> (this);
25 *ppvIF = (HltStoreSvc*)this;
26 } else {
27 return Service::queryInterface(riid, ppvIF) ;
28 }
29 return StatusCode::SUCCESS;
30}

◆ size()

int HltStoreSvc::size ( )

Definition at line 73 of file HltStoreSvc.cxx.

73 {
74 return m_map.size();
75}

Referenced by sListLength().

◆ sListLength()

string HltStoreSvc::sListLength ( )

Definition at line 86 of file HltStoreSvc.cxx.

86 {
87 unsigned int iListLength = this->size();
88 iListLength += 1;
89 ostrstream ListLength;
90
91 //convert integer into std::string
92 ListLength << iListLength;
93 ListLength << '\0';
94 string stringListLength = ListLength.str();
95 if (this->exists(stringListLength)){
96 stringListLength = "unset";
97 for (int i = 0; i < this->max_size(); i++){
98 iListLength += 1;
99 ListLength << iListLength;
100 ListLength << '\0';
101 stringListLength = ListLength.str();
102 if (!(this->exists(stringListLength))) {
103 ListLength.freeze(0);
104 return stringListLength;
105 }
106 }
107 }
108
109 ListLength.freeze(0);
110 return stringListLength;
111}
bool exists(const std::string &name)
int max_size()
Definition: HltStoreSvc.cxx:77

Member Data Documentation

◆ m_map

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


The documentation for this class was generated from the following files: