Nori  23
object.cpp
1 /*
2  This file is part of Nori, a simple educational ray tracer
3 
4  Copyright (c) 2015 by Wenzel Jakob, Romain Prévost
5 
6  Nori is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Nori is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #include <nori/object.h>
20 
21 NORI_NAMESPACE_BEGIN
22 
23 std::map<std::string, NoriObjectFactory::Constructor> *NoriObjectFactory::m_constructors = nullptr;
24 
25 void NoriObjectFactory::registerClass(const std::string &name, const Constructor &constr) {
26  if (!m_constructors)
27  m_constructors = new std::map<std::string, NoriObjectFactory::Constructor>();
28  (*m_constructors)[name] = constr;
29 }
30 
31 NORI_NAMESPACE_END
static void registerClass(const std::string &name, const Constructor &constr)
Register an object constructor with the object factory.
Definition: object.cpp:25