CMS 3D CMS Logo

List of all members | Private Types | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends
XrdAdaptor::QualityMetricFactory Class Reference

#include <QualityMetric.h>

Private Types

typedef oneapi::tbb::concurrent_unordered_map< std::string, QualityMetricUniqueSource * > MetricMap
 

Static Private Member Functions

static std::unique_ptr< QualityMetricSourceget (timespec now, const std::string &id)
 

Private Attributes

MetricMap m_sources
 

Static Private Attributes

static QualityMetricFactory m_instance
 

Friends

class Source
 

Detailed Description

Definition at line 67 of file QualityMetric.h.

Member Typedef Documentation

◆ MetricMap

typedef oneapi::tbb::concurrent_unordered_map<std::string, QualityMetricUniqueSource *> XrdAdaptor::QualityMetricFactory::MetricMap
private

Definition at line 75 of file QualityMetric.h.

Member Function Documentation

◆ get()

std::unique_ptr< QualityMetricSource > QualityMetricFactory::get ( timespec  now,
const std::string &  id 
)
staticprivate

Definition at line 134 of file QualityMetric.cc.

References m_instance, m_sources, submitPVValidationJobs::now, and source.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), and submitPVValidationJobs.BetterConfigParser::getResultingSection().

134  {
135  auto itFound = m_instance.m_sources.find(id);
136  if (itFound == m_instance.m_sources.end()) {
137  // try to make a new one
138  std::unique_ptr<QualityMetricUniqueSource> source(new QualityMetricUniqueSource(now));
139  auto insertResult = m_instance.m_sources.insert(std::make_pair(id, source.get()));
140  itFound = insertResult.first;
141  if (insertResult.second) { // Insert was successful; release our reference.
142  source.release();
143  } // Otherwise, we raced with a different thread and they won; we will delete our new QM source.
144  }
145  return itFound->second->newSource(now);
146 }
static std::string const source
Definition: EdmProvDump.cc:49
static QualityMetricFactory m_instance
Definition: QualityMetric.h:73

Friends And Related Function Documentation

◆ Source

friend class Source
friend

Definition at line 68 of file QualityMetric.h.

Member Data Documentation

◆ m_instance

QualityMetricFactory QualityMetricFactory::m_instance
staticprivate

Definition at line 73 of file QualityMetric.h.

Referenced by get().

◆ m_sources

MetricMap XrdAdaptor::QualityMetricFactory::m_sources
private

Definition at line 76 of file QualityMetric.h.

Referenced by get().