#include <G4CreatorFactoryT.hh>
Public Member Functions | |
G4CreatorFactoryT () | |
virtual | ~G4CreatorFactoryT () |
G4bool | Register (const Identifier &id, Creator creator) |
T * | Create (const Identifier &id) const |
Definition at line 40 of file G4CreatorFactoryT.hh.
G4CreatorFactoryT< T, Identifier, Creator >::G4CreatorFactoryT | ( | ) |
G4CreatorFactoryT< T, Identifier, Creator >::~G4CreatorFactoryT | ( | ) | [virtual] |
T * G4CreatorFactoryT< T, Identifier, Creator >::Create | ( | const Identifier & | id | ) | const |
Definition at line 93 of file G4CreatorFactoryT.hh.
References G4endl, G4Exception(), and JustWarning.
00094 { 00095 typename Map::const_iterator iter = fMap.find(id); 00096 00097 if (iter == fMap.end()) { 00098 G4ExceptionDescription ed; 00099 ed << "Identifier "<<id<<" does not exist."<<G4endl; 00100 G4Exception("G4CreatorFactoryT::Create(const Identifier& id)", 00101 "greps0103", JustWarning, ed, 00102 "Non-existent identifier"); 00103 return 0; 00104 } 00105 00106 return iter->second(); 00107 }
G4bool G4CreatorFactoryT< T, Identifier, Creator >::Register | ( | const Identifier & | id, | |
Creator | creator | |||
) |
Definition at line 73 of file G4CreatorFactoryT.hh.
References G4endl, G4Exception(), and JustWarning.
Referenced by G4AttFilterUtils::GetAttValueFilterFactory().
00075 { 00076 if (fMap.find(id) != fMap.end()) { 00077 G4ExceptionDescription ed; 00078 ed << "Creator with identifier "<<id<<" already exists."<<G4endl; 00079 G4Exception 00080 ("G4CreatorFactoryT::Register(const Identifier& id, Creator creator)", 00081 "greps0102", JustWarning, ed, 00082 "Creator exists"); 00083 return false; 00084 } 00085 00086 // Insert identifier<->creator pair into map 00087 std::pair<Identifier, Creator> myPair(id, creator); 00088 return fMap.insert(myPair).second; 00089 }