Skip to content

Commit

Permalink
Merge pull request #4546 from wmtan/UseCplusplus11InFramework
Browse files Browse the repository at this point in the history
Replace boost:: with std:: where feasible in framework
  • Loading branch information
ktf committed Jul 9, 2014
2 parents 24ad2b3 + d98e082 commit 554d20d
Show file tree
Hide file tree
Showing 53 changed files with 278 additions and 239 deletions.
Expand Up @@ -13,6 +13,8 @@
#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
#include "DataFormats/SiStripDigi/interface/SiStripProcessedRawDigi.h"

#include "boost/bind.hpp"

#include <functional>

SiStripProcessedRawDigiProducer::SiStripProcessedRawDigiProducer(edm::ParameterSet const& conf)
Expand Down
2 changes: 2 additions & 0 deletions DQM/SiStripMonitorHardware/src/SiStripFEDEmulator.cc
Expand Up @@ -2,6 +2,8 @@
#include "DQM/SiStripMonitorHardware/interface/SiStripFEDEmulator.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "boost/bind.hpp"

using edm::LogError;
using edm::LogInfo;
using edm::LogWarning;
Expand Down
5 changes: 2 additions & 3 deletions DataFormats/Common/interface/DetSetAlgorithm.h
Expand Up @@ -2,9 +2,8 @@
#define DataFormats_Common_DetSetAlgorithm_h

#include "DataFormats/Common/interface/DetSetVectorNew.h"
#include <boost/ref.hpp>
#include <boost/function.hpp>
#include <algorithm>
#include <functional>

//FIXME remove New when ready
namespace edmNew {
Expand All @@ -24,7 +23,7 @@ namespace edmNew {
typename DSTV::Range range = detsetRangeFromPair(v,sel);
for(typename DSTV::const_iterator id=range.first; id!=range.second; id++)
std::for_each((*id).begin(), (*id).end(),
boost::function<void(const data_type &)>(boost::ref(f)));
std::function<void(const data_type &)>(std::ref(f)));
}

namespace dstvdetails {
Expand Down
8 changes: 7 additions & 1 deletion DataFormats/Common/interface/DetSetVector.h
Expand Up @@ -41,8 +41,10 @@ behavior (usually a core dump).

#include "boost/concept_check.hpp"
#include "boost/mpl/if.hpp"
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
#else
#include "boost/bind.hpp"

#endif

#include "DataFormats/Common/interface/CMS_CLASS_VERSION.h"
#include "DataFormats/Common/interface/DetSet.h"
Expand Down Expand Up @@ -380,7 +382,11 @@ namespace edm {
{
std::transform(this->begin(), this->end(),
std::back_inserter(result),
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
std::bind(&DetSet<T>::id,std::placeholders::_1));
#else
boost::bind(&DetSet<T>::id,_1));
#endif
}

template <class T>
Expand Down
15 changes: 14 additions & 1 deletion DataFormats/Common/interface/OneToManyWithQualityGeneric.h
Expand Up @@ -3,10 +3,14 @@
#include "DataFormats/Common/interface/AssociationMapHelpers.h"
#include "DataFormats/Common/interface/Ref.h"
#include "DataFormats/Common/interface/RefProd.h"
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
#include <functional>
#else
#include "boost/bind.hpp"
#endif
#include <map>
#include <vector>
#include <algorithm>
#include <boost/bind.hpp>

#include "DataFormats/Common/interface/MapRefViewTrait.h"

Expand Down Expand Up @@ -78,13 +82,22 @@ namespace edm {
static void sort(map_type & m) {
// using namespace boost::lambda;
for(typename map_type::iterator i = m.begin(), iEnd = m.end(); i != iEnd; ++i) {
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
using std::placeholders::_1;
using std::placeholders::_2;
#endif
map_assoc & v = i->second;
// Q std::pair<index, Q>::*quality = &std::pair<index, Q>::second;
// std::sort(v.begin(), v.end(),
// bind(quality, boost::lambda::_2) < bind(quality, boost::lambda::_1));
std::sort(v.begin(), v.end(),
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
std::bind(std::less<Q>(),
std::bind(&std::pair<index, Q>::second,_2), std::bind( &std::pair<index, Q>::second,_1)
#else
boost::bind(std::less<Q>(),
boost::bind(&std::pair<index, Q>::second,_2), boost::bind( &std::pair<index, Q>::second,_1)
#endif
)
);

Expand Down
2 changes: 1 addition & 1 deletion DataFormats/Common/src/DataFrameContainer.cc
Expand Up @@ -35,7 +35,7 @@ namespace edm {
}
{
// std::transform(indices.begin(),indices.end(),indices.begin(),
// boost::bind(std::multiplies<int>(),m_stride,_1));
// std::bind(std::multiplies<int>(),m_stride,std::placeholders::_1));
DataContainer tmp(m_data.size());
size_type s = m_stride*sizeof(data_type);
for(size_type j=0, i=0; i!=indices.size(); ++i, j+=m_stride)
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/Common/test/DataFrame_t.cpp
Expand Up @@ -8,7 +8,6 @@
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <boost/bind.hpp>
#include <numeric>
#include <cstring>

Expand Down Expand Up @@ -42,9 +41,10 @@ class TestDataFrame: public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_REGISTRATION(TestDataFrame);

TestDataFrame::TestDataFrame() : sv1(10),sv2(10){
using std::placeholders::_1;
edm::DataFrame::data_type v[10] = {0,1,2,3,4,5,6,7,8,9};
std::copy(v,v+10,sv1.begin());
std::transform(sv1.begin(),sv1.end(),sv2.begin(),boost::bind(std::plus<edm::DataFrame::data_type>(),10,_1));
std::transform(sv1.begin(),sv1.end(),sv2.begin(),std::bind(std::plus<edm::DataFrame::data_type>(),10,_1));
}


Expand Down
4 changes: 2 additions & 2 deletions DataFormats/Common/test/exDSTV.cpp
@@ -1,7 +1,7 @@
#include "DataFormats/Common/interface/DetSetVectorNew.h"
#include "FWCore/Utilities/interface/Exception.h"
#include <iostream>
#include <boost/function.hpp>
#include <functional>

struct T {

Expand Down Expand Up @@ -40,7 +40,7 @@ int main() try {
DST d2 = dstv.insert(4,3);
d2[0].v=4.15;

std::for_each(dstv.begin(),dstv.end(),boost::function<void(DST const&)>(print0));
std::for_each(dstv.begin(),dstv.end(),std::function<void(DST const&)>(print0));

return 0;
} catch(cms::Exception const& e) {
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/FWLite/src/EventSetup.cc
Expand Up @@ -13,7 +13,6 @@
// system include files
#include <cassert>
#include <algorithm>
#include "boost/bind.hpp"
#include "TTree.h"
#include "TFile.h"
#include "TKey.h"
Expand Down Expand Up @@ -71,9 +70,10 @@ EventSetup::~EventSetup()
//
void
EventSetup::syncTo(const edm::EventID& iID, const edm::Timestamp& iTime) {
using std::placeholders::_1;
std::for_each(m_records.begin(),
m_records.end(),
boost::bind(&Record::syncTo,_1,iID,iTime));
std::bind(&Record::syncTo,_1,iID,iTime));
}

//
Expand Down
5 changes: 2 additions & 3 deletions FWCore/Framework/interface/ConstProductRegistry.h
Expand Up @@ -22,8 +22,6 @@ Description: Provides a 'service' interface to the ProductRegistry
#include <vector>
#include <string>

#include "boost/bind.hpp"

// user include files
#include "FWCore/Framework/src/SignallingProductRegistry.h"
#include "FWCore/ServiceRegistry/interface/connect_but_block_self.h"
Expand Down Expand Up @@ -68,8 +66,9 @@ namespace edm {
template< class T, class TMethod>
void watchProductAdditions(T const& iObj, TMethod iMethod)
{
using std::placeholders::_1;
serviceregistry::connect_but_block_self(reg_->productAddedSignal_,
boost::bind(iMethod, iObj,_1));
std::bind(iMethod, iObj,_1));
}

private:
Expand Down
7 changes: 3 additions & 4 deletions FWCore/Framework/interface/ESWatcher.h
Expand Up @@ -19,8 +19,7 @@
//

// system include files
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <functional>

// user include files
#include "FWCore/Framework/interface/EventSetup.h"
Expand All @@ -45,7 +44,7 @@ namespace edm {

template <class TObj, class TMemFunc>
ESWatcher(TObj const& iObj, TMemFunc iFunc):
callback_(boost::bind(iFunc,iObj,_1)),
callback_(std::bind(iFunc,iObj,std::placeholders::_1)),
cacheId_(0)
{}
//virtual ~ESWatcher();
Expand All @@ -70,7 +69,7 @@ namespace edm {
const ESWatcher& operator=(const ESWatcher&); // stop default

// ---------- member data --------------------------------
boost::function<void (const T&)> callback_;
std::function<void (const T&)> callback_;
unsigned long long cacheId_;
};
}
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/Schedule.h
Expand Up @@ -111,7 +111,7 @@ namespace edm {
typedef std::vector<std::string> vstring;
typedef std::shared_ptr<Worker> WorkerPtr;
typedef std::vector<Worker*> AllWorkers;
typedef std::vector<boost::shared_ptr<OutputModuleCommunicator> > AllOutputModuleCommunicators;
typedef std::vector<std::shared_ptr<OutputModuleCommunicator> > AllOutputModuleCommunicators;

typedef std::vector<Worker*> Workers;

Expand Down
7 changes: 2 additions & 5 deletions FWCore/Framework/src/EDLooperBase.cc
Expand Up @@ -26,9 +26,6 @@
#include "FWCore/ServiceRegistry/interface/ParentContext.h"
#include "FWCore/ServiceRegistry/interface/StreamContext.h"

#include "boost/bind.hpp"


namespace edm {

EDLooperBase::EDLooperBase() : iCounter_(0), act_table_(nullptr), moduleChanger_(nullptr),
Expand Down Expand Up @@ -83,8 +80,8 @@ namespace edm {

std::set<edm::eventsetup::EventSetupRecordKey> const& keys = modifyingRecords();
for_all(keys,
boost::bind(&eventsetup::EventSetupProvider::resetRecordPlusDependentRecords,
esp, _1));
std::bind(&eventsetup::EventSetupProvider::resetRecordPlusDependentRecords,
esp, std::placeholders::_1));
}

void EDLooperBase::beginOfJob(const edm::EventSetup&) { beginOfJob();}
Expand Down
7 changes: 3 additions & 4 deletions FWCore/Framework/src/EventProcessor.cc
Expand Up @@ -60,7 +60,6 @@
#include "MessageForSource.h"
#include "MessageForParent.h"

#include "boost/bind.hpp"
#include "boost/thread/xtime.hpp"

#include <exception>
Expand Down Expand Up @@ -615,11 +614,11 @@ namespace edm {
}
schedule_->endJob(c);
if(hasSubProcess()) {
c.call(boost::bind(&SubProcess::doEndJob, subProcess_.get()));
c.call(std::bind(&SubProcess::doEndJob, subProcess_.get()));
}
c.call(boost::bind(&InputSource::doEndJob, input_.get()));
c.call(std::bind(&InputSource::doEndJob, input_.get()));
if(looper_) {
c.call(boost::bind(&EDLooperBase::endOfJob, looper_));
c.call(std::bind(&EDLooperBase::endOfJob, looper_));
}
auto actReg = actReg_.get();
c.call([actReg](){actReg->postEndJobSignal_();});
Expand Down
29 changes: 18 additions & 11 deletions FWCore/Framework/src/EventSetupRecordProvider.cc
Expand Up @@ -12,7 +12,6 @@

// system include files
#include <algorithm>
#include "boost/bind.hpp"

// user include files
#include "FWCore/Framework/interface/EventSetupRecordProvider.h"
Expand Down Expand Up @@ -108,11 +107,12 @@ EventSetupRecordProvider::setValidityInterval(const ValidityInterval& iInterval)
void
EventSetupRecordProvider::setDependentProviders(const std::vector< boost::shared_ptr<EventSetupRecordProvider> >& iProviders)
{
using std::placeholders::_1;
boost::shared_ptr< DependentRecordIntervalFinder > newFinder(
new DependentRecordIntervalFinder(key()));

boost::shared_ptr<EventSetupRecordIntervalFinder> old = swapFinder(newFinder);
for_all(iProviders, boost::bind(std::mem_fun(&DependentRecordIntervalFinder::addProviderWeAreDependentOn), &(*newFinder), _1));
for_all(iProviders, std::bind(std::mem_fun(&DependentRecordIntervalFinder::addProviderWeAreDependentOn), &(*newFinder), _1));
//if a finder was already set, add it as a depedency. This is done to ensure that the IOVs properly change even if the
// old finder does not update each time a dependent record does change
if(old.get() != 0) {
Expand All @@ -122,7 +122,8 @@ EventSetupRecordProvider::setDependentProviders(const std::vector< boost::shared
void
EventSetupRecordProvider::usePreferred(const DataToPreferredProviderMap& iMap)
{
for_all(providers_, boost::bind(&EventSetupRecordProvider::addProxiesToRecord,this,_1,iMap));
using std::placeholders::_1;
for_all(providers_, std::bind(&EventSetupRecordProvider::addProxiesToRecord,this,_1,iMap));
if (1 < multipleFinders_->size()) {

boost::shared_ptr<IntersectingIOVRecordIntervalFinder> intFinder(new IntersectingIOVRecordIntervalFinder(key_));
Expand Down Expand Up @@ -170,8 +171,10 @@ EventSetupRecordProvider::addRecordTo(EventSetupProvider& iEventSetupProvider) {
void
EventSetupRecordProvider::resetTransients()
{
if(checkResetTransients()) {
for_all(providers_, boost::bind(&DataProxyProvider::resetProxiesIfTransient,_1,key_));

using std::placeholders::_1;
if(checkResetTransients()) {
for_all(providers_, std::bind(&DataProxyProvider::resetProxiesIfTransient,_1,key_));
}
}

Expand Down Expand Up @@ -227,12 +230,13 @@ EventSetupRecordProvider::setValidityIntervalFor(const IOVSyncValue& iTime)
void
EventSetupRecordProvider::resetProxies()
{
using std::placeholders::_1;
cacheReset();
for_all(providers_, boost::bind(&DataProxyProvider::resetProxies,_1,key_));
for_all(providers_, std::bind(&DataProxyProvider::resetProxies,_1,key_));
//some proxies only clear if they were accessed transiently,
// since resetProxies resets that flag, calling resetTransients
// will force a clear
for_all(providers_, boost::bind(&DataProxyProvider::resetProxiesIfTransient,_1,key_));
for_all(providers_, std::bind(&DataProxyProvider::resetProxiesIfTransient,_1,key_));

}

Expand All @@ -248,8 +252,9 @@ EventSetupRecordProvider::fillReferencedDataKeys(std::map<DataKey, ComponentDesc

void
EventSetupRecordProvider::resetRecordToProxyPointers(DataToPreferredProviderMap const& iMap) {
using std::placeholders::_1;
record().clearProxies();
for_all(providers_, boost::bind(&EventSetupRecordProvider::addProxiesToRecord, this, _1, iMap));
for_all(providers_, std::bind(&EventSetupRecordProvider::addProxiesToRecord, this, _1, iMap));
}

void
Expand All @@ -274,20 +279,22 @@ EventSetupRecordProvider::dependentRecords() const
std::set<ComponentDescription>
EventSetupRecordProvider::proxyProviderDescriptions() const
{
using std::placeholders::_1;
std::set<ComponentDescription> descriptions;
std::transform(providers_.begin(), providers_.end(),
std::inserter(descriptions,descriptions.end()),
boost::bind(&DataProxyProvider::description,_1));
std::bind(&DataProxyProvider::description,_1));
return descriptions;
}

boost::shared_ptr<DataProxyProvider>
EventSetupRecordProvider::proxyProvider(const ComponentDescription& iDesc) const {
using std::placeholders::_1;
std::vector<boost::shared_ptr<DataProxyProvider> >::const_iterator itFound =
std::find_if(providers_.begin(),providers_.end(),
boost::bind(std::equal_to<ComponentDescription>(),
std::bind(std::equal_to<ComponentDescription>(),
iDesc,
boost::bind(&DataProxyProvider::description,_1)));
std::bind(&DataProxyProvider::description,_1)));
if(itFound == providers_.end()){
return boost::shared_ptr<DataProxyProvider>();
}
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/src/Path.cc
Expand Up @@ -7,7 +7,6 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <algorithm>
#include "boost/bind.hpp"

namespace edm {
Path::Path(int bitpos, std::string const& path_name,
Expand Down Expand Up @@ -159,8 +158,9 @@ namespace edm {

void
Path::clearCounters() {
using std::placeholders::_1;
timesRun_ = timesPassed_ = timesFailed_ = timesExcept_ = 0;
for_all(workers_, boost::bind(&WorkerInPath::clearCounters, _1));
for_all(workers_, std::bind(&WorkerInPath::clearCounters, _1));
}

void
Expand Down

0 comments on commit 554d20d

Please sign in to comment.