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 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 62 of file QualityMetric.h.

Member Typedef Documentation

◆ MetricMap

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

Definition at line 70 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.

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 }

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

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

Friends And Related Function Documentation

◆ Source

friend class Source
friend

Definition at line 63 of file QualityMetric.h.

Member Data Documentation

◆ m_instance

QualityMetricFactory QualityMetricFactory::m_instance
staticprivate

Definition at line 68 of file QualityMetric.h.

Referenced by get().

◆ m_sources

MetricMap XrdAdaptor::QualityMetricFactory::m_sources
private

Definition at line 71 of file QualityMetric.h.

Referenced by get().

XrdAdaptor::QualityMetricUniqueSource
Definition: QualityMetric.h:93
fileCollector.now
now
Definition: fileCollector.py:207
source
static const std::string source
Definition: EdmProvDump.cc:47
XrdAdaptor::QualityMetricFactory::m_sources
MetricMap m_sources
Definition: QualityMetric.h:71
XrdAdaptor::QualityMetricFactory::m_instance
static QualityMetricFactory m_instance
Definition: QualityMetric.h:68