CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
L1TriggerKeyListExt Class Reference

#include <L1TriggerKeyListExt.h>

Public Types

typedef std::map< std::string, std::string > KeyToToken
 
typedef std::map< std::string, KeyToTokenRecordToKeyToToken
 

Public Member Functions

bool addKey (const std::string &tscKey, const std::string &payloadToken, bool overwriteKey=false)
 
bool addKey (const std::string &recordType, const std::string &key, const std::string &payloadToken, bool overwriteKey=false)
 
 L1TriggerKeyListExt ()
 
std::string objectKey (const std::string &recordName, const std::string &payloadToken) const
 
const RecordToKeyToTokenrecordTypeToKeyToTokenMap () const
 
std::string token (const std::string &tscKey) const
 
std::string token (const std::string &recordName, const std::string &dataType, const std::string &key) const
 
std::string token (const std::string &recordType, const std::string &key) const
 
std::string tscKey (const std::string &triggerKeyPayloadToken) const
 
const KeyToTokentscKeyToTokenMap () const
 
virtual ~L1TriggerKeyListExt ()
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

RecordToKeyToToken m_recordKeyToken
 
KeyToToken m_tscKeyToToken
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 10 of file L1TriggerKeyListExt.h.

Member Typedef Documentation

typedef std::map< std::string, std::string > L1TriggerKeyListExt::KeyToToken

Definition at line 17 of file L1TriggerKeyListExt.h.

typedef std::map< std::string, KeyToToken > L1TriggerKeyListExt::RecordToKeyToToken

Definition at line 18 of file L1TriggerKeyListExt.h.

Constructor & Destructor Documentation

L1TriggerKeyListExt::L1TriggerKeyListExt ( )

Definition at line 3 of file L1TriggerKeyListExt.cc.

4 {
5 }
L1TriggerKeyListExt::~L1TriggerKeyListExt ( )
virtual

Definition at line 12 of file L1TriggerKeyListExt.cc.

13 {
14 }

Member Function Documentation

bool L1TriggerKeyListExt::addKey ( const std::string &  tscKey,
const std::string &  payloadToken,
bool  overwriteKey = false 
)

Definition at line 33 of file L1TriggerKeyListExt.cc.

References m_tscKeyToToken, and mps_fire::result.

Referenced by L1CondDBPayloadWriterExt::analyze(), and recordTypeToKeyToTokenMap().

36 {
37  std::pair< KeyToToken::iterator, bool > result =
38  m_tscKeyToToken.insert( std::make_pair( tscKey, payloadToken ) ) ;
39 
40  if( !result.second && overwriteKey )
41  {
42  // Erase previous entry
43  m_tscKeyToToken.erase( result.first ) ;
44 
45  // Try again
46  result = m_tscKeyToToken.insert( std::make_pair( tscKey,
47  payloadToken ) ) ;
48  }
49 
50  return result.second ;
51 }
std::string tscKey(const std::string &triggerKeyPayloadToken) const
bool L1TriggerKeyListExt::addKey ( const std::string &  recordType,
const std::string &  key,
const std::string &  payloadToken,
bool  overwriteKey = false 
)

Definition at line 54 of file L1TriggerKeyListExt.cc.

References m_recordKeyToken, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

58 {
59  RecordToKeyToToken::iterator it = m_recordKeyToken.find( recordType ) ;
60 
61  if( it == m_recordKeyToken.end() )
62  {
63  it = m_recordKeyToken.insert( std::make_pair( recordType,
64  KeyToToken() ) ).first ;
65  }
66 
67  std::pair< KeyToToken::iterator, bool > result =
68  it->second.insert( std::make_pair( key, payloadToken ) ) ;
69 
70  if( !result.second && overwriteKey )
71  {
72  // Erase previous entry
73  it->second.erase( result.first ) ;
74 
75  // Try again
76  result = it->second.insert( std::make_pair( key, payloadToken ) ) ;
77  }
78 
79  return result.second ;
80 }
RecordToKeyToToken m_recordKeyToken
std::map< std::string, std::string > KeyToToken
std::string L1TriggerKeyListExt::objectKey ( const std::string &  recordName,
const std::string &  payloadToken 
) const

Definition at line 169 of file L1TriggerKeyListExt.cc.

References m_recordKeyToken, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by L1O2OTestAnalyzerExt::analyze(), and recordTypeToKeyToTokenMap().

171 {
172  RecordToKeyToToken::const_iterator iRecordType = m_recordKeyToken.begin() ;
173  for( ; iRecordType != m_recordKeyToken.end() ; ++iRecordType )
174  {
175  // Extract record name from recordType
176  std::string recordInMap( iRecordType->first, 0,
177  iRecordType->first.find_first_of("@") ) ;
178  if( recordInMap == recordName )
179  {
180  // Find object key with matching payload token.
181  KeyToToken::const_iterator iKey = iRecordType->second.begin();
182  KeyToToken::const_iterator eKey = iRecordType->second.end() ;
183  for( ; iKey != eKey ; ++iKey )
184  {
185  if( iKey->second == payloadToken )
186  {
187  return iKey->first ;
188  }
189  }
190  }
191  }
192 
193  return std::string() ;
194 }
RecordToKeyToToken m_recordKeyToken
const RecordToKeyToToken& L1TriggerKeyListExt::recordTypeToKeyToTokenMap ( ) const
inline
template<class Archive >
void L1TriggerKeyListExt::serialize ( Archive &  ar,
const unsigned int  version 
)
private
std::string L1TriggerKeyListExt::token ( const std::string &  tscKey) const

Definition at line 87 of file L1TriggerKeyListExt.cc.

References m_tscKeyToToken, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by L1CondDBPayloadWriterExt::analyze(), L1CondDBIOVWriterExt::analyze(), L1ConfigOnlineProdBaseExt< TRcd, TData >::getObjectKey(), L1SubsystemKeysOnlineProdExt::produce(), and token().

88 {
89  KeyToToken::const_iterator it = m_tscKeyToToken.find( tscKey ) ;
90 
91  if( it == m_tscKeyToToken.end() )
92  {
93  return std::string() ;
94  }
95  else
96  {
97  return it->second;
98  }
99 }
std::string tscKey(const std::string &triggerKeyPayloadToken) const
std::string L1TriggerKeyListExt::token ( const std::string &  recordName,
const std::string &  dataType,
const std::string &  key 
) const
std::string L1TriggerKeyListExt::token ( const std::string &  recordType,
const std::string &  key 
) const

Definition at line 111 of file L1TriggerKeyListExt.cc.

References m_recordKeyToken, and AlCaHLTBitMon_QueryRunRegistry::string.

113 {
114  RecordToKeyToToken::const_iterator it = m_recordKeyToken.find( recordType ) ;
115 
116  if( it == m_recordKeyToken.end() )
117  {
118  return std::string() ;
119  }
120  else
121  {
122  KeyToToken::const_iterator it2 = it->second.find( key ) ;
123 
124  if( it2 == it->second.end() )
125  {
126  return std::string() ;
127  }
128  else
129  {
130  return it2->second ;
131  }
132  }
133 }
RecordToKeyToToken m_recordKeyToken
std::string L1TriggerKeyListExt::tscKey ( const std::string &  triggerKeyPayloadToken) const

Definition at line 197 of file L1TriggerKeyListExt.cc.

References m_tscKeyToToken, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by L1O2OTestAnalyzerExt::analyze(), and recordTypeToKeyToTokenMap().

198 {
199  // Find object key with matching payload token.
200  KeyToToken::const_iterator iKey = m_tscKeyToToken.begin();
201  KeyToToken::const_iterator eKey = m_tscKeyToToken.end() ;
202  for( ; iKey != eKey ; ++iKey )
203  {
204  if( iKey->second == triggerKeyPayloadToken )
205  {
206  return iKey->first ;
207  }
208  }
209 
210  return std::string() ;
211 }
const KeyToToken& L1TriggerKeyListExt::tscKeyToTokenMap ( ) const
inline

Definition at line 34 of file L1TriggerKeyListExt.h.

References m_tscKeyToToken.

Referenced by L1O2OTestAnalyzerExt::analyze().

35  { return m_tscKeyToToken ; }

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 78 of file L1TriggerKeyListExt.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 78 of file L1TriggerKeyListExt.h.

Member Data Documentation

RecordToKeyToToken L1TriggerKeyListExt::m_recordKeyToken
private

Definition at line 76 of file L1TriggerKeyListExt.h.

Referenced by addKey(), objectKey(), recordTypeToKeyToTokenMap(), and token().

KeyToToken L1TriggerKeyListExt::m_tscKeyToToken
private

Definition at line 72 of file L1TriggerKeyListExt.h.

Referenced by addKey(), token(), tscKey(), and tscKeyToTokenMap().