35Kernel::Logger logger(
"surfaceFactory");
63 for (
const auto &vc : other.SGrid)
64 this->
SGrid.emplace_back(vc.first, vc.second->clone());
71 for (
const auto &vc : other.SGrid)
72 this->
SGrid.emplace_back(vc.first, vc.second->clone());
82 SGrid.emplace_back(
"Plane", std::make_unique<Plane>());
83 SGrid.emplace_back(
"Cylinder", std::make_unique<Cylinder>());
84 SGrid.emplace_back(
"Cone", std::make_unique<Cone>());
86 SGrid.emplace_back(
"General", std::make_unique<General>());
87 SGrid.emplace_back(
"Sphere", std::make_unique<Sphere>());
99 explicit KeyEquals(std::string key) :
m_key(
std::move(key)) {}
100 bool operator()(
const std::pair<std::string, std::unique_ptr<Surface>> &element) {
return m_key == element.first; }
117 MapType::const_iterator vc;
118 vc = std::find_if(SGrid.begin(), SGrid.end(), KeyEquals(Key));
119 if (vc == SGrid.end()) {
122 return vc->second->clone();
135 std::map<char, std::string>::const_iterator mc;
137 mc = (Key.empty()) ? ID.end() : ID.find(
static_cast<char>(tolower(Key[0])));
138 if (mc == ID.end()) {
142 return createSurface(mc->second);
159 std::unique_ptr<Surface>
X = createSurfaceID(key);
160 if (
X->setSurface(
Line)) {
161 logger.error() <<
"X:: " <<
X->setSurface(
Line) <<
'\n';
Creates instances of Surfaces.
std::unique_ptr< Surface > createSurface(const std::string &) const
Creates an instance of tally given a valid key.
std::map< char, std::string > ID
Short letter identifiers.
SurfaceFactory & operator=(const SurfaceFactory &other)
MapType SGrid
The tally stack.
std::unique_ptr< Surface > processLine(const std::string &) const
Creates an instance of a surface given a valid line.
static SurfaceFactory * Instance()
Effective new command / this command.
static SurfaceFactory * FOBJ
Effective "this".
SurfaceFactory()
singleton constructor
std::unique_ptr< Surface > createSurfaceID(const std::string &) const
Creates an instance of tally given a valid key.
void registerSurface()
Register tallies to be used.
Exception for when an item is not found in a collection.
int convert(const std::string &A, T &out)
Convert a string into a number.
Helper class which provides the Collimation Length for SANS instruments.