Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
// -*- C++ -*-
//
// Package:     ServiceRegistry
// Class  :     ServiceRegistry
//
// Implementation:
//     <Notes on implementation>
//
// Original Author:  Chris Jones
//         Created:  Mon Sep  5 13:33:19 EDT 2005
//

// user include files
#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"

// system include files

namespace edm {
  //
  // constants, enums and typedefs
  //

  //
  // static data member definitions
  //

  //
  // constructors and destructor
  //
  ServiceRegistry::ServiceRegistry() {}

  // ServiceRegistry::ServiceRegistry(ServiceRegistry const& rhs) {
  //    // do actual copying here;
  // }

  ServiceRegistry::~ServiceRegistry() {}

  //
  // assignment operators
  //
  // ServiceRegistry const& ServiceRegistry::operator=(ServiceRegistry const& rhs) {
  //   //An exception safe implementation is
  //   ServiceRegistry temp(rhs);
  //   swap(rhs);
  //
  //   return *this;
  // }

  //
  // member functions
  //
  ServiceToken ServiceRegistry::setContext(ServiceToken const& iNewToken) {
    ServiceToken returnValue(manager_);
    manager_ = iNewToken.manager_;
    return returnValue;
  }

  void ServiceRegistry::unsetContext(ServiceToken const& iOldToken) { manager_ = iOldToken.manager_; }

  //
  // const member functions
  //
  ServiceToken ServiceRegistry::presentToken() const { return manager_; }

  //
  // static member functions
  //

  ServiceToken ServiceRegistry::createServicesFromConfig(std::unique_ptr<ParameterSet> params) {
    auto serviceSets = params->popVParameterSet(std::string("services"));
    //create the services
    return ServiceToken(ServiceRegistry::createSet(serviceSets));
  }

  ServiceToken ServiceRegistry::createSet(std::vector<ParameterSet>& iPS) {
    using namespace serviceregistry;
    auto returnValue = std::make_shared<ServicesManager>(iPS);
    return ServiceToken(returnValue);
  }

  ServiceToken ServiceRegistry::createSet(std::vector<ParameterSet>& iPS,
                                          ServiceToken iToken,
                                          serviceregistry::ServiceLegacy iLegacy,
                                          bool associate) {
    using namespace serviceregistry;
    auto returnValue = std::make_shared<ServicesManager>(iToken, iLegacy, iPS, associate);
    return ServiceToken(returnValue);
  }

  ServiceRegistry& ServiceRegistry::instance() {
    static thread_local ServiceRegistry s_registry;
    return s_registry;
  }
}  // namespace edm