CMS 3D CMS Logo

Public Member Functions | Private Attributes

edm::ProcessDesc Class Reference

#include <ProcessDesc.h>

List of all members.

Public Member Functions

void addDefaultService (std::string const &service)
 add a service if it's not already there
void addService (ParameterSet &pset)
void addService (std::string const &service)
 add a service as an empty pset
void addServices (std::vector< std::string > const &defaultServices, std::vector< std::string > const &forcedServices)
 add some defaults services, and some forced
std::string dump () const
std::string getDependencies (std::string const &modulename)
 get the dependencies for this module
boost::shared_ptr< ParameterSetgetProcessPSet () const
 get the ParameterSet that describes the process
boost::shared_ptr< std::vector
< ParameterSet > > 
getServicesPSets () const
 get the descriptions of the services
 ProcessDesc (std::string const &config)
 construct from the configuration language string
 ProcessDesc (ParameterSet const &pset)
 ~ProcessDesc ()

Private Attributes

boost::shared_ptr< ParameterSetpset_
boost::shared_ptr< std::vector
< ParameterSet > > 
services_

Detailed Description

Definition at line 12 of file ProcessDesc.h.


Constructor & Destructor Documentation

edm::ProcessDesc::ProcessDesc ( ParameterSet const &  pset) [explicit]

Definition at line 18 of file ProcessDesc.cc.

  : pset_(new ParameterSet(pset)), services_(new std::vector<ParameterSet>())
  {
  }
edm::ProcessDesc::ProcessDesc ( std::string const &  config) [explicit]

construct from the configuration language string

Definition at line 26 of file ProcessDesc.cc.

References edm::errors::Configuration, and Exception.

  : pset_(new ParameterSet),
    services_(new std::vector<ParameterSet>()) {
    throw edm::Exception(errors::Configuration,"Old config strings no longer accepted");
  }
edm::ProcessDesc::~ProcessDesc ( )

Definition at line 23 of file ProcessDesc.cc.

                            {
  }

Member Function Documentation

void edm::ProcessDesc::addDefaultService ( std::string const &  service)

add a service if it's not already there

Definition at line 54 of file ProcessDesc.cc.

References addService(), AlCaRecoCosmics_cfg::name, and services_.

Referenced by addServices().

                                                              {
    typedef std::vector<edm::ParameterSet>::iterator Iter;
    for(Iter it = services_->begin(), itEnd = services_->end(); it != itEnd; ++it) {
        std::string name = it->getParameter<std::string>("@service_type");

        if (name == service) {
          // If the service is already there move it to the end so
          // it will be created before all the others already there
          // This means we use the order from the default services list
          // and the parameters from the configuration file
          while (true) {
            Iter iterNext = it + 1;
            if (iterNext == itEnd) return;
            iter_swap(it, iterNext);
            ++it;
          }
        }
    }
    addService(service);
  }
void edm::ProcessDesc::addService ( std::string const &  service)

add a service as an empty pset

Definition at line 48 of file ProcessDesc.cc.

References edm::ParameterSet::addParameter(), and addService().

                                                       {
    ParameterSet newpset;
    newpset.addParameter<std::string>("@service_type",service);
    addService(newpset);
  }
void edm::ProcessDesc::addService ( ParameterSet pset)

Definition at line 43 of file ProcessDesc.cc.

References services_.

Referenced by addDefaultService(), addService(), and addServices().

                                                 {
    services_->push_back(pset);
  }
void edm::ProcessDesc::addServices ( std::vector< std::string > const &  defaultServices,
std::vector< std::string > const &  forcedServices 
)

add some defaults services, and some forced

Definition at line 76 of file ProcessDesc.cc.

References addDefaultService(), addService(), i, j, and services_.

                                                                            {
    // Add the forced and default services to services_.
    // In services_, we want the default services first, then the forced
    // services, then the services from the configuration.  It is efficient
    // and convenient to add them in reverse order.  Then after we are done
    // adding, we reverse the std::vector again to get the desired order.
    std::reverse(services_->begin(), services_->end());
    for(std::vector<std::string>::const_reverse_iterator j = forcedServices.rbegin(),
                                            jEnd = forcedServices.rend();
         j != jEnd; ++j) {
      addService(*j);
    }
    for(std::vector<std::string>::const_reverse_iterator i = defaultServices.rbegin(),
                                            iEnd = defaultServices.rend();
         i != iEnd; ++i) {
      addDefaultService(*i);
    }
    std::reverse(services_->begin(), services_->end());
  }
std::string edm::ProcessDesc::dump ( void  ) const

Definition at line 97 of file ProcessDesc.cc.

References dbtoconf::out, pset_, and services_.

                                    {
    std::string out = pset_->dump();
    for (std::vector<ParameterSet>::const_iterator it = services_->begin(), itEnd = services_->end(); it != itEnd; ++it) {
      out += it->dump();
    }
    return out;
  }
std::string edm::ProcessDesc::getDependencies ( std::string const &  modulename)

get the dependencies for this module

the return string is a list of comma-separated names of the modules on which modulename depends

boost::shared_ptr< edm::ParameterSet > edm::ProcessDesc::getProcessPSet ( ) const

get the ParameterSet that describes the process

Definition at line 33 of file ProcessDesc.cc.

References pset_.

                                    {
    return pset_;
  }
boost::shared_ptr< std::vector< ParameterSet > > edm::ProcessDesc::getServicesPSets ( ) const

get the descriptions of the services

Definition at line 38 of file ProcessDesc.cc.

References services_.

                                      {
    return services_;
  }

Member Data Documentation

boost::shared_ptr<ParameterSet> edm::ProcessDesc::pset_ [private]

Definition at line 46 of file ProcessDesc.h.

Referenced by dump(), and getProcessPSet().

boost::shared_ptr<std::vector<ParameterSet> > edm::ProcessDesc::services_ [private]

Definition at line 47 of file ProcessDesc.h.

Referenced by addDefaultService(), addService(), addServices(), dump(), and getServicesPSets().