MarlinMT  0.1.0
EventExtensions.h
Go to the documentation of this file.
1 #ifndef MARLINMT_EVENTEXTENSIONS_h
2 #define MARLINMT_EVENTEXTENSIONS_h 1
3 
4 // -- marlinmt headers
7 #include <marlinmt/Extensions.h>
8 
9 // -- std headers
10 #include <memory>
11 #include <thread>
12 #include <string>
13 
14 namespace marlinmt {
15 
16  class Processor ;
17 
23  public:
24  using Conditions = std::shared_ptr<LogicalExpressions> ;
25  using ConditionsMap = std::map<std::string, std::string> ;
26 
27  public:
28  ~ProcessorConditionsExtension() = default ;
29  ProcessorConditionsExtension() = delete ;
32 
33  public:
40 
47  void set( const Processor *const processor, bool value ) ;
48 
56  void set( const Processor *const processor, const std::string &name, bool value ) ;
57 
63  bool check( const std::string &name ) const ;
64 
65  private:
67  Conditions _runtimeConditions {std::make_shared<LogicalExpressions>()} ;
68  };
69 
70  //--------------------------------------------------------------------------
71  //--------------------------------------------------------------------------
72 
78  public:
79  using RandomSeedMap = std::unique_ptr<RandomSeedManager::RandomSeedMap> ;
81 
82  public:
83  ~RandomSeedExtension() = default ;
84  RandomSeedExtension() = delete ;
85  RandomSeedExtension(const RandomSeedExtension&) = delete ;
87 
88  public:
95 
101  RandomSeedType randomSeed( const Processor *const processor ) const ;
102 
103  private:
105  RandomSeedMap _randomSeeds {nullptr} ;
106  };
107 
108  //--------------------------------------------------------------------------
109  //--------------------------------------------------------------------------
110 
111  // extension mapping types
112  namespace extensions {
114  struct RandomSeed {} ;
115  struct IsFirstEvent {} ;
116  }
117 
118 }
119 
120 #endif
ProcessorConditionsExtension class Event extension providing access to processor runtime conditions (...
constexpr unsigned long long value(const Flag_t &flag)
Definition: Flags.h:106
RandomSeedExtension class Event extension providing access to random seeds.
std::shared_ptr< LogicalExpressions > Conditions
ProcessorConditionsExtension & operator=(const ProcessorConditionsExtension &)=delete
Conditions _runtimeConditions
The runtime conditions.
std::unique_ptr< RandomSeedManager::RandomSeedMap > RandomSeedMap
bool check(const std::string &name) const
Check whether the runtime condition is true.
RandomSeedManager::SeedType RandomSeedType
std::map< std::string, std::string > ConditionsMap
Processor class.
Definition: Processor.h:43