Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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.

66 {}
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

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 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

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 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:


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