CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Types | Private Attributes

edm::rootfix::LockService Class Reference

#include <LockService.h>

List of all members.

Public Member Functions

boost::mutexgetLock ()
 LockService (const edm::ParameterSet &, edm::ActivityRegistry &)
void postBeginJob ()
void postEndJob ()
void postEventProcessing (const edm::Event &, const edm::EventSetup &)
void postModule (const edm::ModuleDescription &)
void postSource ()
void postSourceConstruction (const edm::ModuleDescription &)
void preEventProcessing (const edm::EventID &, const edm::Timestamp &)
void preModule (const edm::ModuleDescription &)
void preSource ()
void preSourceConstruction (const edm::ModuleDescription &)
 ~LockService ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Types

typedef std::vector< std::string > Labels

Private Attributes

Labels labels_
boost::mutexlock_
boost::shared_ptr
< boost::mutex::scoped_lock > 
locker_
bool lockSources_

Detailed Description

Definition at line 31 of file LockService.h.


Member Typedef Documentation

typedef std::vector<std::string> edm::rootfix::LockService::Labels [private]

Definition at line 60 of file LockService.h.


Constructor & Destructor Documentation

LockService::LockService ( const edm::ParameterSet iPS,
edm::ActivityRegistry reg 
)

Definition at line 13 of file LockService.cc.

References FDEBUG, postModule(), postSource(), postSourceConstruction(), preModule(), preSource(), preSourceConstruction(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPostSource(), edm::ActivityRegistry::watchPostSourceConstruction(), edm::ActivityRegistry::watchPreModule(), edm::ActivityRegistry::watchPreSource(), and edm::ActivityRegistry::watchPreSourceConstruction().

                                               :
  lock_(*getGlobalMutex()),
  locker_(),
  labels_(iPS.getUntrackedParameter<Labels>("labels")),
  lockSources_(iPS.getUntrackedParameter<bool>("lockSources")) {
  reg.watchPreSourceConstruction(this,&LockService::preSourceConstruction);
  reg.watchPostSourceConstruction(this,&LockService::postSourceConstruction);

  // reg.watchPostBeginJob(this,&LockService::postBeginJob);
  // reg.watchPostEndJob(this,&LockService::postEndJob);

  // reg.watchPreProcessEvent(this,&LockService::preEventProcessing);
  // reg.watchPostProcessEvent(this,&LockService::postEventProcessing);
  reg.watchPreSource(this,&LockService::preSource);
  reg.watchPostSource(this,&LockService::postSource);

  reg.watchPreModule(this,&LockService::preModule);
  reg.watchPostModule(this,&LockService::postModule);

  FDEBUG(4) << "In LockServices" << std::endl;
}
LockService::~LockService ( )

Definition at line 36 of file LockService.cc.

                          {
}

Member Function Documentation

void LockService::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Definition at line 39 of file LockService.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::addUntracked().

                                                                             {
  edm::ParameterSetDescription desc;
  std::vector<std::string> defaultVector;
  desc.addUntracked<std::vector<std::string> >("labels",defaultVector);
  desc.addUntracked<bool>("lockSources",true);
  descriptions.add("LockService", desc);
}
boost::mutex& edm::rootfix::LockService::getLock ( ) [inline]

Definition at line 39 of file LockService.h.

References lock_.

{ return lock_; }
void LockService::postBeginJob ( )

Definition at line 61 of file LockService.cc.

                               {
}
void LockService::postEndJob ( )

Definition at line 64 of file LockService.cc.

                             {
}
void LockService::postEventProcessing ( const edm::Event ,
const edm::EventSetup  
)

Definition at line 70 of file LockService.cc.

                                                                     {
}
void LockService::postModule ( const edm::ModuleDescription )

Definition at line 93 of file LockService.cc.

References FDEBUG, and locker_.

Referenced by LockService().

                                                     {
  FDEBUG(4) << "destroyed a locked in LockService" << std::endl;
  locker_.reset();
}
void LockService::postSource ( )

Definition at line 80 of file LockService.cc.

References FDEBUG, and locker_.

Referenced by LockService().

                             {
  FDEBUG(4) << "destroyed a locked in LockService" << std::endl;
  locker_.reset();
}
void LockService::postSourceConstruction ( const edm::ModuleDescription )

Definition at line 56 of file LockService.cc.

References FDEBUG, and locker_.

Referenced by LockService().

                                                                 {
  FDEBUG(4) << "destroyed a locked in LockService" << std::endl;
  locker_.reset();
}
void LockService::preEventProcessing ( const edm::EventID ,
const edm::Timestamp  
)

Definition at line 67 of file LockService.cc.

                                                                           {
}
void LockService::preModule ( const edm::ModuleDescription desc)

Definition at line 85 of file LockService.cc.

References FDEBUG, spr::find(), labels_, lock_, locker_, and edm::ModuleDescription::moduleLabel().

Referenced by LockService().

                                                         {
  if(!labels_.empty() && find(labels_.begin(), labels_.end(), desc.moduleLabel()) != labels_.end()) {
    //search_all(labels_, desc.moduleLabel()))
    FDEBUG(4) << "made a new locked in LockService" << std::endl;
    locker_.reset(new boost::mutex::scoped_lock(lock_));
  }
}
void LockService::preSource ( )

Definition at line 73 of file LockService.cc.

References FDEBUG, lock_, locker_, and lockSources_.

Referenced by LockService().

                            {
  if(lockSources_) {
    FDEBUG(4) << "made a new locked in LockService" << std::endl;
    locker_.reset(new boost::mutex::scoped_lock(lock_));
  }
}
void LockService::preSourceConstruction ( const edm::ModuleDescription desc)

Definition at line 47 of file LockService.cc.

References FDEBUG, spr::find(), labels_, lock_, locker_, and edm::ModuleDescription::moduleLabel().

Referenced by LockService().

                                                                     {
  if(!labels_.empty() &&
     find(labels_.begin(), labels_.end(), desc.moduleLabel()) != labels_.end()) {
     //search_all(labels_, desc.moduleLabel()))
      FDEBUG(4) << "made a new locked in LockService" << std::endl;
      locker_.reset(new boost::mutex::scoped_lock(lock_));
    }
}

Member Data Documentation

Definition at line 61 of file LockService.h.

Referenced by preModule(), and preSourceConstruction().

Definition at line 58 of file LockService.h.

Referenced by getLock(), preModule(), preSource(), and preSourceConstruction().

boost::shared_ptr<boost::mutex::scoped_lock> edm::rootfix::LockService::locker_ [private]

Definition at line 62 of file LockService.h.

Referenced by preSource().