Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CreatorFactoryT< T, Identifier, Creator > Class Template Reference

#include <G4CreatorFactoryT.hh>

Public Member Functions

 G4CreatorFactoryT ()
 
virtual ~G4CreatorFactoryT ()
 
G4bool Register (const Identifier &id, Creator creator)
 
T * Create (const Identifier &id) const
 

Detailed Description

template<typename T, typename Identifier, typename Creator>
class G4CreatorFactoryT< T, Identifier, Creator >

Definition at line 39 of file G4CreatorFactoryT.hh.

Constructor & Destructor Documentation

◆ G4CreatorFactoryT()

template<typename T , typename Identifier , typename Creator >
G4CreatorFactoryT< T, Identifier, Creator >::G4CreatorFactoryT ( )

Definition at line 65 of file G4CreatorFactoryT.hh.

65{}

◆ ~G4CreatorFactoryT()

template<typename T , typename Identifier , typename Creator >
G4CreatorFactoryT< T, Identifier, Creator >::~G4CreatorFactoryT ( )
virtual

Definition at line 68 of file G4CreatorFactoryT.hh.

68{}

Member Function Documentation

◆ Create()

template<typename T , typename Identifier , typename Creator >
T * G4CreatorFactoryT< T, Identifier, Creator >::Create ( const Identifier & id) const

Definition at line 92 of file G4CreatorFactoryT.hh.

93{
94 typename Map::const_iterator iter = fMap.find(id);
95
96 if (iter == fMap.end()) {
98 ed << "Identifier "<<id<<" does not exist."<<G4endl;
99 G4Exception("G4CreatorFactoryT::Create(const Identifier& id)",
100 "greps0103", JustWarning, ed,
101 "Non-existent identifier");
102 return 0;
103 }
104
105 return iter->second();
106}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4endl
Definition G4ios.hh:67

Referenced by G4AttFilterUtils::GetNewFilter().

◆ Register()

template<typename T , typename Identifier , typename Creator >
G4bool G4CreatorFactoryT< T, Identifier, Creator >::Register ( const Identifier & id,
Creator creator )

Definition at line 72 of file G4CreatorFactoryT.hh.

74{
75 if (fMap.find(id) != fMap.end()) {
77 ed << "Creator with identifier "<<id<<" already exists."<<G4endl;
79 ("G4CreatorFactoryT::Register(const Identifier& id, Creator creator)",
80 "greps0102", JustWarning, ed,
81 "Creator exists");
82 return false;
83 }
84
85 // Insert identifier<->creator pair into map
86 std::pair<Identifier, Creator> myPair(id, creator);
87 return fMap.insert(myPair).second;
88}

Referenced by G4AttFilterUtils::GetAttValueFilterFactory().


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