Geant4 9.6.0
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 40 of file G4CreatorFactoryT.hh.

Constructor & Destructor Documentation

◆ G4CreatorFactoryT()

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

Definition at line 66 of file G4CreatorFactoryT.hh.

66{}

◆ ~G4CreatorFactoryT()

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

Definition at line 69 of file G4CreatorFactoryT.hh.

69{}

Member Function Documentation

◆ Create()

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

Definition at line 93 of file G4CreatorFactoryT.hh.

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

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 73 of file G4CreatorFactoryT.hh.

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

Referenced by G4AttFilterUtils::GetAttValueFilterFactory().


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