19#ifndef BDSACCELERATORCOMPONENTREGISTRY_H
20#define BDSACCELERATORCOMPONENTREGISTRY_H
28#include <unordered_map>
55 typedef std::map<G4String, BDSAcceleratorComponent*>
RegistryMap;
79 bool isModified =
false);
145 std::set<BDSAcceleratorComponent*> tunnelComponents;
A registry of constructed BDSAcceleratorComponent instances that can be searched.
std::map< G4String, BDSAcceleratorComponent * > RegistryMap
void RegisterCurvilinearComponent(BDSAcceleratorComponent *component)
static BDSAcceleratorComponentRegistry * Instance()
Singleton accessor.
std::map< G4String, BDSAcceleratorComponent * > AllComponentsIncludingUnique() const
void RegisterTunnelComponent(BDSAcceleratorComponent *component)
void RegisterComponent(BDSAcceleratorComponent *component, bool isModified=false)
const_iterator end() const
std::set< BDSAcceleratorComponent * > allocatedComponents
Set of created components not in registry, for memory management.
std::set< BDSAcceleratorComponent * > curvilinearComponents
Set of curvilinear components - purely for memory management.
friend std::ostream & operator<<(std::ostream &out, BDSAcceleratorComponentRegistry const &r)
Output stream.
static BDSAcceleratorComponentRegistry * instance
The singleton instance.
G4bool IsRegisteredAllocated(const BDSAcceleratorComponent *componentName) const
Check if a unique component is registered in the allocatedComponents.
void PrintNumberOfEachType() const
Print out the number of each type of component registered.
BDSAcceleratorComponent * GetComponent(const G4String &name)
const_iterator begin() const
std::unordered_map< std::string, int > typeCounter
size_t size() const
Size of registry.
G4bool IsRegistered(BDSAcceleratorComponent *component)
Check whether an accelerator component is already registered.
RegistryMap::const_iterator const_iterator
BDSAcceleratorComponentRegistry()
Default constructor is private as singleton.
RegistryMap::iterator iterator
~BDSAcceleratorComponentRegistry()
BDSAcceleratorComponentRegistry & operator=(const BDSAcceleratorComponentRegistry &)
assignment and copy constructor not implemented nor used
RegistryMap registry
Registry is a map - note 'register' is a protected keyword.
RegistryMap registryForAllocated
A map for absolutely everything including components that are unique.
Abstract class that represents a component of an accelerator.