ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigInDetAnalysis
TrigInDetAnalysis
TIDAFeatureStore.h
Go to the documentation of this file.
1
/* emacs: this is -*- c++ -*- */
13
14
15
#ifndef TIDA_FEATURESTORE_H
16
#define TIDA_FEATURESTORE_H
17
18
#include <iostream>
19
#include <map>
20
21
#include "
TIDAFeature.h
"
22
23
24
namespace
TIDA
{
25
26
class
FeatureStore
:
public
std::map<std::string, TIDA::FeatureBase*> {
27
28
public
:
29
30
typedef
std::map<std::string, FeatureBase*>
map_type
;
31
32
public
:
33
34
FeatureStore
() { }
35
36
~FeatureStore
() {
37
const_iterator itr = begin();
38
const_iterator iend = end();
39
while
( itr!=iend )
delete
(itr++)->second;
40
}
41
42
43
template
<
typename
T>
44
void
insert
( T* t,
const
std::string& key ) {
45
TIDA::Feature<T>
* tt =
new
TIDA::Feature<T>
(t);
46
_insert
( tt, key );
47
}
48
49
50
template
<
typename
T>
51
int
find
( T*& t,
const
std::string& key ) {
52
TIDA::FeatureBase
* f =
_find
(key);
53
if
( f ) {
54
TIDA::Feature<T>
* fdptr =
dynamic_cast<
TIDA::Feature<T>
*
>
(f);
55
if
( fdptr ) {
56
t = fdptr->
cptr
();
57
return
0;
58
}
59
else
return
-2;
60
}
61
return
-1;
62
}
63
64
private
:
65
66
void
_insert
(
TIDA::FeatureBase
* f,
const
std::string& key ) {
67
map_type::insert( value_type( key, f ) );
68
}
69
70
TIDA::FeatureBase
*
_find
(
const
std::string& key ) {
71
iterator itr=map_type::find(key);
72
if
( itr!=end() )
return
itr->second;
73
else
return
0;
74
}
75
76
77
};
78
79
}
80
81
82
83
inline
std::ostream&
operator<<
( std::ostream& s,
const
TIDA::FeatureStore
& f ) {
84
TIDA::FeatureStore::const_iterator itr = f.begin();
85
TIDA::FeatureStore::const_iterator iend = f.end();
86
while
( itr!=iend ) {
87
if
( itr->first.size()>5 ) s <<
"\t[ "
<< itr->first <<
":\t"
<< itr->second <<
" ]\n"
;
88
else
s <<
"\t[ "
<< itr->first <<
":\t\t"
<< itr->second <<
" ]\n"
;
89
++itr;
90
}
91
return
s;
92
}
93
94
95
#endif
// FEATURESTORE_H
96
97
98
99
100
101
102
103
104
105
operator<<
std::ostream & operator<<(std::ostream &s, const TIDA::FeatureStore &f)
Definition
TIDAFeatureStore.h:83
TIDAFeature.h
wrapper class to wrap objects such that they can be added to a generic store
TIDA::FeatureBase
very basic Feature base class just so that we can store derived classes onto the store
Definition
TIDAFeature.h:29
TIDA::FeatureStore
Definition
TIDAFeatureStore.h:26
TIDA::FeatureStore::~FeatureStore
~FeatureStore()
Definition
TIDAFeatureStore.h:36
TIDA::FeatureStore::_find
TIDA::FeatureBase * _find(const std::string &key)
Definition
TIDAFeatureStore.h:70
TIDA::FeatureStore::insert
void insert(T *t, const std::string &key)
Definition
TIDAFeatureStore.h:44
TIDA::FeatureStore::map_type
std::map< std::string, FeatureBase * > map_type
Definition
TIDAFeatureStore.h:30
TIDA::FeatureStore::find
int find(T *&t, const std::string &key)
Definition
TIDAFeatureStore.h:51
TIDA::FeatureStore::_insert
void _insert(TIDA::FeatureBase *f, const std::string &key)
Definition
TIDAFeatureStore.h:66
TIDA::FeatureStore::FeatureStore
FeatureStore()
Definition
TIDAFeatureStore.h:34
TIDA::Feature
actual template of the Feature wrapper - stores a pointer to an object and inherits from FeatureBase
Definition
TIDAFeature.h:55
TIDA::Feature::cptr
T * cptr()
Definition
TIDAFeature.h:67
TIDA
Test for xAOD.
Definition
Filter_AcceptAll.h:22
Generated on
for ATLAS Offline Software by
1.17.0