Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rndm::details::AutoIncrementPolicy< SEED > Class Template Reference

Implementation of the "autoIncrement" policy. More...

#include <BasePolicies.h>

Inheritance diagram for rndm::details::AutoIncrementPolicy< SEED >:
rndm::details::CheckedRangePolicy< SEED > rndm::details::CheckedRangePolicy< SEED > rndm::details::RandomSeedPolicyBase< SEED > rndm::details::RandomSeedPolicyBase< SEED > rndm::details::RandomSeedPolicyBase< SEED > rndm::details::RandomSeedPolicyBase< SEED >

Public Types

using base_t = CheckedRangePolicy< SEED >
 
using this_t = AutoIncrementPolicy< SEED >
 
using seed_t = typename base_t::seed_t
 
using base_t = CheckedRangePolicy< SEED >
 
using this_t = AutoIncrementPolicy< SEED >
 
using seed_t = typename base_t::seed_t
 
- Public Types inherited from rndm::details::CheckedRangePolicy< SEED >
using base_t = RandomSeedPolicyBase< SEED >
 
using this_t = CheckedRangePolicy< SEED >
 
using seed_t = typename base_t::seed_t
 
using base_t = RandomSeedPolicyBase< SEED >
 
using this_t = CheckedRangePolicy< SEED >
 
using seed_t = typename base_t::seed_t
 
- Public Types inherited from rndm::details::RandomSeedPolicyBase< SEED >
using seed_t = SEED
 type of the random seed More...
 
using EventData_t = NuRandomServiceHelper::EventSeedInputData
 type of data used for event seeds More...
 
using seed_t = SEED
 type of the random seed More...
 
using EventData_t = NuRandomServiceHelper::EventSeedInputData
 type of data used for event seeds More...
 

Public Member Functions

 AutoIncrementPolicy (fhicl::ParameterSet const &pset)
 
virtual void configure (fhicl::ParameterSet const &pset) override
 Configure this policy. More...
 
virtual void print (std::ostream &out) const override
 Prints the configuration of this policy. More...
 
 AutoIncrementPolicy (fhicl::ParameterSet const &pset)
 
virtual void configure (fhicl::ParameterSet const &pset) override
 Configure this policy. More...
 
virtual void print (std::ostream &out) const override
 Prints the configuration of this policy. More...
 
- Public Member Functions inherited from rndm::details::CheckedRangePolicy< SEED >
 CheckedRangePolicy (std::string policy_name, fhicl::ParameterSet const &pset)
 Constructor; requires the policy name. More...
 
virtual seed_t getSeed (SeedMasterHelper::EngineId const &id)
 Returns the next random number. More...
 
 CheckedRangePolicy (std::string policy_name, fhicl::ParameterSet const &pset)
 Constructor; requires the policy name. More...
 
virtual seed_t getSeed (SeedMasterHelper::EngineId const &id) override
 Returns the next random number. More...
 
- Public Member Functions inherited from rndm::details::RandomSeedPolicyBase< SEED >
 RandomSeedPolicyBase (std::string policy_name)
 Constructor; requires the policy name. More...
 
virtual ~RandomSeedPolicyBase ()
 
virtual seed_t getEventSeed (SeedMasterHelper::EngineId const &id, EventData_t const &eventInfo)
 Returns a random number specific to an event. More...
 
std::string getName () const
 Returns the given name of the policy. More...
 
virtual bool yieldsUniqueSeeds () const override
 Returns whether the returned seed should be unique. More...
 
 RandomSeedPolicyBase (std::string policy_name)
 Constructor; requires the policy name. More...
 
virtual ~RandomSeedPolicyBase ()
 
virtual seed_t getEventSeed (SeedMasterHelper::EngineId const &id, EventData_t const &eventInfo)
 Returns a random number specific to an event. More...
 
std::string getName () const
 Returns the given name of the policy. More...
 
virtual bool yieldsUniqueSeeds () const
 Returns whether the returned seed should be unique. More...
 

Protected Member Functions

virtual seed_t createSeed (SeedMasterHelper::EngineId const &) override
 Returns the next random number. More...
 
void static_configure (fhicl::ParameterSet const &)
 
virtual seed_t createSeed (SeedMasterHelper::EngineId const &) override
 Returns the next random number. More...
 
void static_configure (fhicl::ParameterSet const &)
 
- Protected Member Functions inherited from rndm::details::CheckedRangePolicy< SEED >
 CheckedRangePolicy (std::string policy_name)
 Lets the derived class to start configuration. More...
 
virtual void ensureRange (SeedMasterHelper::EngineId const &id, seed_t seed) const
 Performs the range checks and complains if needed. More...
 
void CheckRangeConfiguration () const
 Check that the configuration is complete. More...
 
void static_configure (fhicl::ParameterSet const &pset)
 Local configuration; does not require the range config to be complete. More...
 
 CheckedRangePolicy (std::string policy_name)
 Lets the derived class to start configuration. More...
 
virtual void ensureRange (SeedMasterHelper::EngineId const &id, seed_t seed) const
 Performs the range checks and complains if needed. More...
 
void CheckRangeConfiguration () const
 Check that the configuration is complete. More...
 
void static_configure (fhicl::ParameterSet const &pset)
 Local configuration; does not require the range config to be complete. More...
 
- Protected Member Functions inherited from rndm::details::RandomSeedPolicyBase< SEED >
virtual seed_t createEventSeed (SeedMasterHelper::EngineId const &, EventData_t const &)
 Extracts a seed for specified event information; returns InvalidSeed. More...
 
virtual seed_t createEventSeed (SeedMasterHelper::EngineId const &, EventData_t const &)
 Extracts a seed for specified event information; returns InvalidSeed. More...
 

Protected Attributes

seed_t first_seed
 
seed_t next_seed
 next seed delivered More...
 
- Protected Attributes inherited from rndm::details::CheckedRangePolicy< SEED >
RangeCheckHelper< seed_trange_check
 
- Protected Attributes inherited from rndm::details::RandomSeedPolicyBase< SEED >
std::string name
 name of the policy More...
 

Additional Inherited Members

- Static Public Attributes inherited from rndm::details::RandomSeedPolicyBase< SEED >
static constexpr seed_t InvalidSeed = 0
 An invalid seed. More...
 

Detailed Description

template<typename SEED>
class rndm::details::AutoIncrementPolicy< SEED >

Implementation of the "autoIncrement" policy.


See also
CheckedRangePolicy

This is heavily based on CheckedRangePolicy.

Definition at line 343 of file BasePolicies.h.

Member Typedef Documentation

template<typename SEED >
using rndm::details::AutoIncrementPolicy< SEED >::base_t = CheckedRangePolicy<SEED>

Definition at line 42 of file StandardPolicies.h.

template<typename SEED >
using rndm::details::AutoIncrementPolicy< SEED >::base_t = CheckedRangePolicy<SEED>

Definition at line 345 of file BasePolicies.h.

template<typename SEED >
using rndm::details::AutoIncrementPolicy< SEED >::seed_t = typename base_t::seed_t

Definition at line 44 of file StandardPolicies.h.

template<typename SEED >
using rndm::details::AutoIncrementPolicy< SEED >::seed_t = typename base_t::seed_t

Definition at line 347 of file BasePolicies.h.

template<typename SEED >
using rndm::details::AutoIncrementPolicy< SEED >::this_t = AutoIncrementPolicy<SEED>

Definition at line 43 of file StandardPolicies.h.

template<typename SEED >
using rndm::details::AutoIncrementPolicy< SEED >::this_t = AutoIncrementPolicy<SEED>

Definition at line 346 of file BasePolicies.h.

Constructor & Destructor Documentation

template<typename SEED >
rndm::details::AutoIncrementPolicy< SEED >::AutoIncrementPolicy ( fhicl::ParameterSet const &  pset)
inline

Configures from a parameter set

See also
configure()

Definition at line 351 of file BasePolicies.h.

351  :
352  base_t("autoIncrement")
353  { this_t::configure(pset); }
virtual void configure(fhicl::ParameterSet const &pset) override
Configure this policy.
Definition: BasePolicies.h:367
CheckedRangePolicy< SEED > base_t
Definition: BasePolicies.h:345
template<typename SEED >
rndm::details::AutoIncrementPolicy< SEED >::AutoIncrementPolicy ( fhicl::ParameterSet const &  pset)
inline

Configures from a parameter set

See also
configure()

Definition at line 48 of file StandardPolicies.h.

48  :
49  base_t("autoIncrement")
50  { this_t::configure(pset); }
virtual void configure(fhicl::ParameterSet const &pset) override
Configure this policy.
Definition: BasePolicies.h:367
CheckedRangePolicy< SEED > base_t
Definition: BasePolicies.h:345

Member Function Documentation

template<typename SEED >
virtual void rndm::details::AutoIncrementPolicy< SEED >::configure ( fhicl::ParameterSet const &  pset)
inlineoverridevirtual

Configure this policy.

Parameters
psetthe parameter set for the configuration

Parameters:

  • baseSeed (unsigned integer): the first seed to be delivered
  • checkRange (boolean, default: true): whether to verify that each seed is within the expected range
  • maxUniqueEngines (unsigned integer, mandatory if /checkRange/ is true) the maximum number on seeds we expect to create

Reimplemented from rndm::details::CheckedRangePolicy< SEED >.

Definition at line 64 of file StandardPolicies.h.

65  {
67  ("maxUniqueEngines", "", "checkRange");
68  base_t::configure(pset);
69  static_configure(pset);
70  } // configure()
virtual void configure(fhicl::ParameterSet const &pset) override
Configure this policy.
Definition: BasePolicies.h:277
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
void static_configure(fhicl::ParameterSet const &)
Definition: BasePolicies.h:392
void SetConfigLabels(std::string maxSeedsLabel="maxUniqueEngines", std::string baseSeedLabel="baseSeed", std::string checkRangeLabel="checkRange")
Definition: BasePolicies.h:177
template<typename SEED >
virtual void rndm::details::AutoIncrementPolicy< SEED >::configure ( fhicl::ParameterSet const &  pset)
inlineoverridevirtual

Configure this policy.

Parameters
psetthe parameter set for the configuration

Parameters:

  • baseSeed (unsigned integer): the first seed to be delivered
  • checkRange (boolean, default: true): whether to verify that each seed is within the expected range
  • maxUniqueEngines (unsigned integer, mandatory if /checkRange/ is true) the maximum number on seeds we expect to create

Reimplemented from rndm::details::CheckedRangePolicy< SEED >.

Definition at line 367 of file BasePolicies.h.

368  {
370  ("maxUniqueEngines", "", "checkRange");
371  base_t::configure(pset);
372  static_configure(pset);
373  } // configure()
virtual void configure(fhicl::ParameterSet const &pset) override
Configure this policy.
Definition: BasePolicies.h:277
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
void static_configure(fhicl::ParameterSet const &)
Definition: BasePolicies.h:392
void SetConfigLabels(std::string maxSeedsLabel="maxUniqueEngines", std::string baseSeedLabel="baseSeed", std::string checkRangeLabel="checkRange")
Definition: BasePolicies.h:177
template<typename SEED >
virtual seed_t rndm::details::AutoIncrementPolicy< SEED >::createSeed ( SeedMasterHelper::EngineId const &  )
inlineoverrideprotectedvirtual

Returns the next random number.

Implements rndm::details::RandomSeedPolicyBase< SEED >.

Definition at line 80 of file StandardPolicies.h.

81  { return next_seed++; }
seed_t next_seed
next seed delivered
Definition: BasePolicies.h:380
template<typename SEED >
virtual seed_t rndm::details::AutoIncrementPolicy< SEED >::createSeed ( SeedMasterHelper::EngineId const &  )
inlineoverrideprotectedvirtual

Returns the next random number.

Implements rndm::details::RandomSeedPolicyBase< SEED >.

Definition at line 383 of file BasePolicies.h.

384  { return next_seed++; }
seed_t next_seed
next seed delivered
Definition: BasePolicies.h:380
template<typename SEED >
virtual void rndm::details::AutoIncrementPolicy< SEED >::print ( std::ostream &  out) const
overridevirtual

Prints the configuration of this policy.

Reimplemented from rndm::details::CheckedRangePolicy< SEED >.

template<typename SEED >
void rndm::details::AutoIncrementPolicy< SEED >::print ( std::ostream &  out) const
overridevirtual

Prints the configuration of this policy.

Reimplemented from rndm::details::CheckedRangePolicy< SEED >.

Definition at line 402 of file BasePolicies.h.

402  {
403  base_t::print(out);
404  out << "\n first seed: " << first_seed;
405  } // AutoIncrementPolicy<SEED>::print()
virtual void print(std::ostream &out) const override
Prints information on the configuration of this policy.
Definition: BasePolicies.h:289
template<typename SEED >
void rndm::details::AutoIncrementPolicy< SEED >::static_configure ( fhicl::ParameterSet const &  )
protected
template<typename SEED >
void rndm::details::AutoIncrementPolicy< SEED >::static_configure ( fhicl::ParameterSet const &  pset)
protected

Definition at line 392 of file BasePolicies.h.

393  {
394  first_seed = pset.get<seed_t>("baseSeed");
398  } // AutoIncrementPolicy<SEED>::configure()
unsigned long seed_t
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
seed_t next_seed
next seed delivered
Definition: BasePolicies.h:380
void SetBaseSeed(seed_t base_seed)
Sets the base seed directly.
Definition: BasePolicies.h:128
void CheckRangeConfiguration() const
Check that the configuration is complete.
Definition: BasePolicies.h:323

Member Data Documentation

template<typename SEED >
seed_t rndm::details::AutoIncrementPolicy< SEED >::first_seed
protected

Definition at line 379 of file BasePolicies.h.

template<typename SEED >
seed_t rndm::details::AutoIncrementPolicy< SEED >::next_seed
protected

next seed delivered

Definition at line 380 of file BasePolicies.h.


The documentation for this class was generated from the following files: