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

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

Definition at line 66 of file G4CreatorFactoryT.hh.

00066 {}

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

Definition at line 69 of file G4CreatorFactoryT.hh.

00069 {}


Member Function Documentation

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.

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 }

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.

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 }


The documentation for this class was generated from the following file:
Generated on Mon May 27 17:51:43 2013 for Geant4 by  doxygen 1.4.7