MarlinMT  0.1.0
EventExtensions.cc
Go to the documentation of this file.
2 
3 // -- marlinmt headers
4 #include <marlinmt/Processor.h>
5 
6 namespace marlinmt {
7 
9  _randomSeeds(std::move(seeds)) {
10  /* nop */
11  }
12 
13  //--------------------------------------------------------------------------
14 
17  RandomSeedManager::HashResult hashval = hashf( processor ) ;
18  auto iter = _randomSeeds->find( hashval ) ;
19  if( _randomSeeds->end() == iter ) {
20  throw Exception( "RandomSeedExtension::randomSeed: processor '" +
21  processor->name() +
22  "' not registered in random seed manager" ) ;
23  }
24  return iter->second ;
25  }
26 
27  //--------------------------------------------------------------------------
28  //--------------------------------------------------------------------------
29 
31  for( auto cond : conds ) {
32  _runtimeConditions->addCondition( cond.first, cond.second ) ;
33  }
34  }
35 
36  //--------------------------------------------------------------------------
37 
38  void ProcessorConditionsExtension::set( const Processor *const processor, bool value ) {
39  _runtimeConditions->setValue( processor->name(), value ) ;
40  }
41 
42  //--------------------------------------------------------------------------
43 
44  void ProcessorConditionsExtension::set( const Processor *const processor, const std::string &name, bool value ) {
45  _runtimeConditions->setValue( processor->name() + "." + name, value ) ;
46  }
47 
48  //--------------------------------------------------------------------------
49 
50  bool ProcessorConditionsExtension::check( const std::string &name ) const {
51  return _runtimeConditions->conditionIsTrue( name ) ;
52  }
53 
54 }
const std::string & name() const
Get the component name.
Definition: Component.cc:23
Definition: EntryData.h:93
constexpr unsigned long long value(const Flag_t &flag)
Definition: Flags.h:106
std::hash< const void * > HashFunction
RandomSeedType randomSeed(const Processor *const processor) const
Get the random seed for a given processor.
std::unique_ptr< RandomSeedManager::RandomSeedMap > RandomSeedMap
bool check(const std::string &name) const
Check whether the runtime condition is true.
RandomSeedManager::SeedType RandomSeedType
void set(const Processor *const processor, bool value)
Set the runtime condition of the processor.
std::map< std::string, std::string > ConditionsMap
Processor class.
Definition: Processor.h:43
Exception class.
Definition: Exceptions.h:60
RandomSeedMap _randomSeeds
The random seed map for the current event.