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

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

Definition at line 72 of file QualityMetric.h.

Member Function Documentation

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

Definition at line 161 of file QualityMetric.cc.

References source.

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

162 {
163  auto itFound = m_instance.m_sources.find(id);
164  if (itFound == m_instance.m_sources.end())
165  {
166  // try to make a new one
167  std::unique_ptr<QualityMetricUniqueSource> source(new QualityMetricUniqueSource(now));
168  auto insertResult = m_instance.m_sources.insert(std::make_pair(id, source.get()));
169  itFound = insertResult.first;
170  if (insertResult.second)
171  { // Insert was successful; release our reference.
172  source.release();
173  } // Otherwise, we raced with a different thread and they won; we will delete our new QM source.
174  }
175  return itFound->second->newSource(now);
176 }
static std::string const source
Definition: EdmProvDump.cc:47
static QualityMetricFactory m_instance
Definition: QualityMetric.h:70

Friends And Related Function Documentation

friend class Source
friend

Definition at line 64 of file QualityMetric.h.

Member Data Documentation

QualityMetricFactory QualityMetricFactory::m_instance
staticprivate

Definition at line 70 of file QualityMetric.h.

Referenced by XrdAdaptor::QualityMetric::get().

MetricMap XrdAdaptor::QualityMetricFactory::m_sources
private

Definition at line 73 of file QualityMetric.h.