test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
< QualityMetricSource
get (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 61 of file QualityMetric.h.

Member Typedef Documentation

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

Definition at line 71 of file QualityMetric.h.

Member Function Documentation

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

Definition at line 160 of file QualityMetric.cc.

References m_instance, m_sources, and source.

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

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

Friends And Related Function Documentation

friend class Source
friend

Definition at line 63 of file QualityMetric.h.

Member Data Documentation

QualityMetricFactory QualityMetricFactory::m_instance
staticprivate

Definition at line 69 of file QualityMetric.h.

Referenced by get().

MetricMap XrdAdaptor::QualityMetricFactory::m_sources
private

Definition at line 72 of file QualityMetric.h.

Referenced by get().