Skip to content

Commit

Permalink
Merge pull request #545 from Dr15Jones/renameToExceptionActions
Browse files Browse the repository at this point in the history
Changed generic 'action' names to be more descriptive.
  • Loading branch information
ktf committed Aug 16, 2013
2 parents 5833afd + fe408e4 commit c881bea
Show file tree
Hide file tree
Showing 23 changed files with 109 additions and 109 deletions.
38 changes: 0 additions & 38 deletions FWCore/Framework/interface/Actions.h

This file was deleted.

6 changes: 3 additions & 3 deletions FWCore/Framework/interface/EDLooperBase.h
Expand Up @@ -63,7 +63,7 @@ namespace edm {
class EventSetupRecordKey;
class EventSetupProvider;
}
class ActionTable;
class ExceptionToActionTable;
class ProcessContext;
class ScheduleInfo;
class StreamContext;
Expand Down Expand Up @@ -99,7 +99,7 @@ namespace edm {
///Override this method if you need to monitor the state of the processing
virtual void attachTo(ActivityRegistry&);

void setActionTable(ActionTable const* actionTable) { act_table_ = actionTable; }
void setActionTable(ExceptionToActionTable const* actionTable) { act_table_ = actionTable; }

virtual std::set<eventsetup::EventSetupRecordKey> modifyingRecords() const;

Expand Down Expand Up @@ -143,7 +143,7 @@ namespace edm {


unsigned int iCounter_;
ActionTable const* act_table_;
ExceptionToActionTable const* act_table_;

std::auto_ptr<ScheduleInfo> scheduleInfo_;
ModuleChanger const* moduleChanger_;
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/interface/EventProcessor.h
Expand Up @@ -40,7 +40,7 @@ namespace statemachine {

namespace edm {

class ActionTable;
class ExceptionToActionTable;
class BranchIDListHelper;
class EDLooperBase;
class HistoryAppender;
Expand Down Expand Up @@ -316,7 +316,7 @@ namespace edm {
std::unique_ptr<InputSource> input_;
std::unique_ptr<eventsetup::EventSetupsController> espController_;
boost::shared_ptr<eventsetup::EventSetupProvider> esp_;
std::unique_ptr<ActionTable const> act_table_;
std::unique_ptr<ExceptionToActionTable const> act_table_;
boost::shared_ptr<ProcessConfiguration const> processConfiguration_;
ProcessContext processContext_;
std::auto_ptr<Schedule> schedule_;
Expand Down
38 changes: 38 additions & 0 deletions FWCore/Framework/interface/ExceptionActions.h
@@ -0,0 +1,38 @@
#ifndef FWCore_Framework_ExceptionActions_h
#define FWCore_Framework_ExceptionActions_h

#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include <string>
#include <map>

namespace edm {
namespace exception_actions {
enum ActionCodes {
IgnoreCompletely=0,
Rethrow,
SkipEvent,
FailPath,
LastCode
};

const char* actionName(ActionCodes code);
}

class ExceptionToActionTable {
public:
typedef std::map<std::string, exception_actions::ActionCodes> ActionMap;

ExceptionToActionTable();
explicit ExceptionToActionTable(const ParameterSet&);
~ExceptionToActionTable();

void add(const std::string& category, exception_actions::ActionCodes code);
exception_actions::ActionCodes find(const std::string& category) const;

private:
void addDefaults();
ActionMap map_;
};
}
#endif
14 changes: 7 additions & 7 deletions FWCore/Framework/interface/Schedule.h
Expand Up @@ -59,7 +59,7 @@

#include "DataFormats/Common/interface/HLTGlobalStatus.h"
#include "DataFormats/Provenance/interface/ModuleDescription.h"
#include "FWCore/Framework/interface/Actions.h"
#include "FWCore/Framework/interface/ExceptionActions.h"
#include "FWCore/Framework/interface/EventPrincipal.h"
#include "FWCore/Framework/interface/ExceptionHelpers.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace edm {
service::TriggerNamesService& tns,
ProductRegistry& pregistry,
BranchIDListHelper& branchIDListHelper,
ActionTable const& actions,
ExceptionToActionTable const& actions,
boost::shared_ptr<ActivityRegistry> areg,
boost::shared_ptr<ProcessConfiguration> processConfiguration,
const ParameterSet* subProcPSet,
Expand Down Expand Up @@ -268,7 +268,7 @@ namespace edm {
}

/// returns the action table
ActionTable const& actionTable() const {
ExceptionToActionTable const& actionTable() const {
return workerManager_.actionTable();
}

Expand Down Expand Up @@ -395,10 +395,10 @@ namespace edm {
state_ = Latched;
}
catch(cms::Exception& e) {
actions::ActionCodes action = actionTable().find(e.category());
assert (action != actions::IgnoreCompletely);
assert (action != actions::FailPath);
if (action == actions::SkipEvent) {
exception_actions::ActionCodes action = actionTable().find(e.category());
assert (action != exception_actions::IgnoreCompletely);
assert (action != exception_actions::FailPath);
if (action == exception_actions::SkipEvent) {
edm::printCmsExceptionWarning("SkipEvent", e);
} else {
throw;
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/interface/ScheduleItems.h
Expand Up @@ -10,7 +10,7 @@
#include <vector>

namespace edm {
class ActionTable;
class ExceptionToActionTable;
class ActivityRegistry;
class BranchIDListHelper;
class CommonParams;
Expand Down Expand Up @@ -56,7 +56,7 @@ namespace edm {
boost::shared_ptr<ActivityRegistry> actReg_;
std::unique_ptr<SignallingProductRegistry> preg_;
boost::shared_ptr<BranchIDListHelper> branchIDListHelper_;
std::unique_ptr<ActionTable const> act_table_;
std::unique_ptr<ExceptionToActionTable const> act_table_;
boost::shared_ptr<ProcessConfiguration> processConfiguration_;
};
}
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/SubProcess.h
Expand Up @@ -216,7 +216,7 @@ namespace edm {
boost::shared_ptr<ProductRegistry const> parentPreg_;
boost::shared_ptr<ProductRegistry const> preg_;
boost::shared_ptr<BranchIDListHelper> branchIDListHelper_;
std::unique_ptr<ActionTable const> act_table_;
std::unique_ptr<ExceptionToActionTable const> act_table_;
boost::shared_ptr<ProcessConfiguration const> processConfiguration_;
ProcessContext processContext_;
PrincipalCache principalCache_;
Expand Down
14 changes: 7 additions & 7 deletions FWCore/Framework/interface/WorkerManager.h
Expand Up @@ -28,7 +28,7 @@ namespace edm {
public:
typedef std::vector<Worker*> AllWorkers;

WorkerManager(boost::shared_ptr<ActivityRegistry> actReg, ActionTable const& actions);
WorkerManager(boost::shared_ptr<ActivityRegistry> actReg, ExceptionToActionTable const& actions);

void addToUnscheduledWorkers(ParameterSet& pset,
ProductRegistry& preg,
Expand Down Expand Up @@ -59,7 +59,7 @@ namespace edm {

void addToAllWorkers(Worker* w, bool useStopwatch);

ActionTable const& actionTable() const {return *actionTable_;}
ExceptionToActionTable const& actionTable() const {return *actionTable_;}

Worker* getWorker(ParameterSet& pset,
ProductRegistry& preg,
Expand All @@ -73,7 +73,7 @@ namespace edm {
void setupOnDemandSystem(EventPrincipal& principal, EventSetup const& es);

WorkerRegistry workerReg_;
ActionTable const* actionTable_;
ExceptionToActionTable const* actionTable_;

AllWorkers allWorkers_;

Expand Down Expand Up @@ -101,10 +101,10 @@ namespace edm {
}
}
catch(cms::Exception& e) {
actions::ActionCodes action = (T::isEvent_ ? actionTable_->find(e.category()) : actions::Rethrow);
assert (action != actions::IgnoreCompletely);
assert (action != actions::FailPath);
if (action == actions::SkipEvent) {
exception_actions::ActionCodes action = (T::isEvent_ ? actionTable_->find(e.category()) : exception_actions::Rethrow);
assert (action != exception_actions::IgnoreCompletely);
assert (action != exception_actions::FailPath);
if (action == exception_actions::SkipEvent) {
printCmsExceptionWarning("SkipEvent", e);
} else {
throw;
Expand Down
6 changes: 3 additions & 3 deletions FWCore/Framework/src/EDLooperBase.cc
Expand Up @@ -17,7 +17,7 @@
#include "FWCore/Framework/interface/EventSetupProvider.h"
#include "FWCore/Utilities/interface/Algorithms.h"
#include "FWCore/MessageLogger/interface/ExceptionMessages.h"
#include "FWCore/Framework/interface/Actions.h"
#include "FWCore/Framework/interface/ExceptionActions.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/Framework/interface/ScheduleInfo.h"
#include "FWCore/ServiceRegistry/interface/GlobalContext.h"
Expand Down Expand Up @@ -57,8 +57,8 @@ namespace edm {
}
catch(cms::Exception& e) {
e.addContext("Calling the 'duringLoop' method of a looper");
actions::ActionCodes action = (act_table_->find(e.category()));
if (action != actions::Rethrow) {
exception_actions::ActionCodes action = (act_table_->find(e.category()));
if (action != exception_actions::Rethrow) {
edm::printCmsExceptionWarning("SkipEvent", e);
}
else {
Expand Down
@@ -1,5 +1,5 @@

#include "FWCore/Framework/interface/Actions.h"
#include "FWCore/Framework/interface/ExceptionActions.h"
#include "FWCore/Utilities/interface/DebugMacros.h"
#include "FWCore/Utilities/interface/Algorithms.h"
#include "boost/lambda/lambda.hpp"
Expand All @@ -8,7 +8,7 @@
#include <iostream>

namespace edm {
namespace actions {
namespace exception_actions {
namespace {
struct ActionNames {
ActionNames():table_(LastCode + 1) {
Expand All @@ -29,13 +29,13 @@ namespace edm {
}
}

ActionTable::ActionTable() : map_() {
ExceptionToActionTable::ExceptionToActionTable() : map_() {
addDefaults();
}

namespace {
inline void install(actions::ActionCodes code,
ActionTable::ActionMap& out,
inline void install(exception_actions::ActionCodes code,
ExceptionToActionTable::ActionMap& out,
ParameterSet const& pset) {
using boost::lambda::_1;
using boost::lambda::var;
Expand All @@ -60,16 +60,16 @@ namespace edm {
}
}

ActionTable::ActionTable(ParameterSet const& pset) : map_() {
ExceptionToActionTable::ExceptionToActionTable(ParameterSet const& pset) : map_() {
addDefaults();

install(actions::SkipEvent, map_, pset);
install(actions::Rethrow, map_, pset);
install(actions::IgnoreCompletely, map_, pset);
install(actions::FailPath, map_, pset);
install(exception_actions::SkipEvent, map_, pset);
install(exception_actions::Rethrow, map_, pset);
install(exception_actions::IgnoreCompletely, map_, pset);
install(exception_actions::FailPath, map_, pset);
}

void ActionTable::addDefaults() {
void ExceptionToActionTable::addDefaults() {
using namespace boost::lambda;
// populate defaults that are not 'Rethrow'
// (There are none as of CMSSW_3_4_X.)
Expand All @@ -83,16 +83,16 @@ namespace edm {
}
}

ActionTable::~ActionTable() {
ExceptionToActionTable::~ExceptionToActionTable() {
}

void ActionTable::add(std::string const& category, actions::ActionCodes code) {
void ExceptionToActionTable::add(std::string const& category, exception_actions::ActionCodes code) {
map_[category] = code;
}

actions::ActionCodes ActionTable::find(std::string const& category) const {
exception_actions::ActionCodes ExceptionToActionTable::find(std::string const& category) const {
ActionMap::const_iterator i(map_.find(category));
return i != map_.end() ? i->second : actions::Rethrow;
return i != map_.end() ? i->second : exception_actions::Rethrow;
}

}
10 changes: 5 additions & 5 deletions FWCore/Framework/src/Path.cc
@@ -1,6 +1,6 @@

#include "FWCore/Framework/src/Path.h"
#include "FWCore/Framework/interface/Actions.h"
#include "FWCore/Framework/interface/ExceptionActions.h"
#include "FWCore/Framework/src/EarlyDeleteHelper.h"
#include "FWCore/Utilities/interface/Algorithms.h"
#include "FWCore/MessageLogger/interface/ExceptionMessages.h"
Expand All @@ -13,7 +13,7 @@ namespace edm {
Path::Path(int bitpos, std::string const& path_name,
WorkersInPath const& workers,
TrigResPtr trptr,
ActionTable const& actions,
ExceptionToActionTable const& actions,
boost::shared_ptr<ActivityRegistry> areg,
bool isEndPath,
StreamContext const* streamContext):
Expand Down Expand Up @@ -50,9 +50,9 @@ namespace edm {
// different exception behavior

// If not processing an event, always rethrow.
actions::ActionCodes action = (isEvent ? act_table_->find(e.category()) : actions::Rethrow);
exception_actions::ActionCodes action = (isEvent ? act_table_->find(e.category()) : exception_actions::Rethrow);
switch(action) {
case actions::FailPath: {
case exception_actions::FailPath: {
should_continue = false;
edm::printCmsExceptionWarning("FailPath", e);
break;
Expand All @@ -61,7 +61,7 @@ namespace edm {
if (isEvent) ++timesExcept_;
state_ = hlt::Exception;
recordStatus(nwrwue, isEvent);
if (action == actions::Rethrow) {
if (action == exception_actions::Rethrow) {
std::string pNF = Exception::codeToString(errors::ProductNotFound);
if (e.category() == pNF) {
std::ostringstream ost;
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/src/Path.h
Expand Up @@ -49,7 +49,7 @@ namespace edm {
Path(int bitpos, std::string const& path_name,
WorkersInPath const& workers,
TrigResPtr trptr,
ActionTable const& actions,
ExceptionToActionTable const& actions,
boost::shared_ptr<ActivityRegistry> reg,
bool isEndPath,
StreamContext const* streamContext);
Expand Down Expand Up @@ -104,7 +104,7 @@ namespace edm {
std::string name_;
TrigResPtr trptr_;
boost::shared_ptr<ActivityRegistry> actReg_;
ActionTable const* act_table_;
ExceptionToActionTable const* act_table_;

WorkersInPath workers_;
std::vector<EarlyDeleteHelper*> earlyDeleteHelpers_;
Expand Down

0 comments on commit c881bea

Please sign in to comment.