Celeritas 0.7.0-33+develop.9c828abdd
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::GeneratorRegistry Class Reference

Manage classes that generate tracks. More...

#include <GeneratorRegistry.hh>

Public Types

Type aliases
using SPGenerator = std::shared_ptr< GeneratorInterface >
 
using SPConstGenerator = std::shared_ptr< GeneratorInterface const >
 
using GeneratorFunc = std::function< void(GeneratorInterface const &)>
 

Public Member Functions

GeneratorId next_id () const
 Get the next available ID.
 
void insert (SPGenerator generator)
 Register generators.
 
GeneratorId::size_type size () const
 Get the number of defined generators.
 
bool empty () const
 Whether any generators have been registered.
 
SPGenerator const & at (GeneratorId)
 Access mutable generator at the given ID.
 
SPConstGenerator at (GeneratorId) const
 Access generator at the given ID.
 
std::string const & id_to_label (GeneratorId id) const
 Get the label corresponding to the generator.
 
GeneratorId find (std::string const &label) const
 Find the generator corresponding to a label.
 
void foreach_generator (GeneratorFunc const &apply) const
 Apply a function to every generator in order of ID.
 

Detailed Description

Manage classes that generate tracks.

This class keeps track of GeneratorInterface classes.

Member Function Documentation

◆ foreach_generator()

void celeritas::GeneratorRegistry::foreach_generator ( GeneratorFunc const &  apply) const

Apply a function to every generator in order of ID.

This is used to update the generator states for a stream, for example:

gen_reg.foreach_generator([&aux](GeneratorInterface const& gen) {
gen.counters(aux).sync_counters();
});
Interface class for generating new tracks.
Definition GeneratorInterface.hh:39
virtual GeneratorStateBase & counters(AuxStateVec &) const =0
Get generator counters (mutable)

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