BOSS 7.0.5
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)
 
 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 ()
 
static const InterfaceID & interfaceID ()
 

Protected Types

typedef map< string, BaseHolder * > ContainerType
 
typedef map< string, BaseHolder * > ContainerType
 

Protected Attributes

ContainerType m_map
 

Detailed Description

Member Typedef Documentation

◆ ContainerType [1/2]

◆ ContainerType [2/2]

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

Constructor & Destructor Documentation

◆ HltStoreSvc() [1/2]

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

Definition at line 15 of file HltStoreSvc.cxx.

15 : Service(name, sl)
16{ }

◆ ~HltStoreSvc() [1/2]

HltStoreSvc::~HltStoreSvc ( )

Definition at line 18 of file HltStoreSvc.cxx.

19{ }

◆ HltStoreSvc() [2/2]

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

◆ ~HltStoreSvc() [2/2]

HltStoreSvc::~HltStoreSvc ( )

Member Function Documentation

◆ clear() [1/2]

bool HltStoreSvc::clear ( void  )
inline

Definition at line 108 of file EventFilter/HltUtilities/HltStore/HltStore-01-00-04/HltStore/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 }

◆ clear() [2/2]

bool HltStoreSvc::clear ( void  )
inline

Definition at line 108 of file InstallArea/include/HltStore/HltStore/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 }

◆ erase() [1/2]

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

Definition at line 95 of file EventFilter/HltUtilities/HltStore/HltStore-01-00-04/HltStore/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 }

◆ erase() [2/2]

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

Definition at line 95 of file InstallArea/include/HltStore/HltStore/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() [1/2]

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

◆ exists() [2/2]

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

◆ finalize() [1/2]

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}

◆ finalize() [2/2]

virtual StatusCode HltStoreSvc::finalize ( )
virtual

◆ get() [1/2]

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

Definition at line 76 of file EventFilter/HltUtilities/HltStore/HltStore-01-00-04/HltStore/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().

◆ get() [2/2]

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

Definition at line 76 of file InstallArea/include/HltStore/HltStore/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 }

◆ initialize() [1/2]

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}

◆ initialize() [2/2]

virtual StatusCode HltStoreSvc::initialize ( )
virtual

◆ interfaceID() [1/2]

static const InterfaceID & HltStoreSvc::interfaceID ( )
inlinestatic

Definition at line 32 of file EventFilter/HltUtilities/HltStore/HltStore-01-00-04/HltStore/HltStoreSvc.h.

32{ return IID_IHltStoreSvc; }

◆ interfaceID() [2/2]

static const InterfaceID & HltStoreSvc::interfaceID ( )
inlinestatic

Definition at line 32 of file InstallArea/include/HltStore/HltStore/HltStoreSvc.h.

32{ return IID_IHltStoreSvc; }

◆ max_size() [1/2]

int HltStoreSvc::max_size ( )

Definition at line 77 of file HltStoreSvc.cxx.

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

Referenced by sListLength().

◆ max_size() [2/2]

int HltStoreSvc::max_size ( )

◆ printKeys() [1/2]

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}

◆ printKeys() [2/2]

void HltStoreSvc::printKeys ( )

◆ put() [1/2]

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

Definition at line 60 of file EventFilter/HltUtilities/HltStore/HltStore-01-00-04/HltStore/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().

◆ put() [2/2]

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

Definition at line 60 of file InstallArea/include/HltStore/HltStore/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 }

◆ queryInterface() [1/2]

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}

◆ queryInterface() [2/2]

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

◆ size() [1/2]

int HltStoreSvc::size ( )

Definition at line 73 of file HltStoreSvc.cxx.

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

Referenced by sListLength().

◆ size() [2/2]

int HltStoreSvc::size ( )

◆ sListLength() [1/2]

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

◆ sListLength() [2/2]

string HltStoreSvc::sListLength ( )

Member Data Documentation

◆ m_map


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