#include <Alignment/CommonAlignment/interface/AlignSetup.h>
Public Member Functions | |
AlignSetup () | |
Constructor. | |
void | dump (void) const |
Print the name of all stored data. | |
Type & | find (const std::string &name="") |
Find and return an object from map using its name. | |
Type & | get (const std::string &name="") |
Get an object from map using its name. | |
Private Types | |
typedef std::map< std::string, Type > | Container |
Private Attributes | |
Container | theStore |
AlignSetup has a template parameter to specify the type of objects it holds. Objects are stored in a map<string, Type>. Users put/get an object by passing its name through the static methods put()/get(). It returns 0 if the name is not found on get(). It throws an exception if an object of the same name exists on put().
Definition at line 26 of file AlignSetup.h.
typedef std::map<std::string, Type> AlignSetup< Type >::Container [private] |
Definition at line 28 of file AlignSetup.h.
AlignSetup< Type >::AlignSetup | ( | ) | [inline] |
void AlignSetup< Type >::dump | ( | void | ) | const [inline] |
Print the name of all stored data.
Definition at line 76 of file AlignSetup.h.
References lat::endl(), it, and AlignSetup< Type >::theStore.
00077 { 00078 edm::LogInfo("AlignSetup") << "Printing out AlignSetup: "; 00079 for ( typename Container::const_iterator it = theStore.begin(); 00080 it != theStore.end(); ++it ) { 00081 edm::LogVerbatim("AlignSetup") << it->first << std::endl; 00082 } 00083 }
Type & AlignSetup< Type >::find | ( | const std::string & | name = "" |
) | [inline] |
Find and return an object from map using its name.
Throw an exception if the name does not exist.
Definition at line 58 of file AlignSetup.h.
References Exception, it, and AlignSetup< Type >::theStore.
Referenced by AlignableBuilder::build().
00059 { 00060 typename Container::iterator o = theStore.find(name); 00061 00062 if (theStore.end() == o) { 00063 std::ostringstream knownKeys; 00064 for (typename Container::const_iterator it = theStore.begin(); it != theStore.end(); ++it) { 00065 knownKeys << (it != theStore.begin() ? ", " : "") << it->first; 00066 } 00067 throw cms::Exception("AlignSetupError") 00068 << "Cannot find an object of name " << name << " in AlignSetup, know only " 00069 << knownKeys.str() << "."; 00070 } 00071 00072 return o->second; 00073 }
Type & AlignSetup< Type >::get | ( | const std::string & | name = "" |
) | [inline] |
Get an object from map using its name.
A new object is default-constructed if the name does not exist.
Definition at line 52 of file AlignSetup.h.
References AlignSetup< Type >::theStore.
Referenced by AlignableBuilder::build().
Container AlignSetup< Type >::theStore [private] |
Definition at line 47 of file AlignSetup.h.
Referenced by AlignSetup< Type >::dump(), AlignSetup< Type >::find(), and AlignSetup< Type >::get().