/// This file is part of the X3DToolKit library /// Copyright (C) 2002-2004 Yannick Le Goc (legoc@imag.fr) /// http://artis.imag.fr/Members/Yannick.Legoc/X3D/ /// This library is free software; you can redistribute it and/or /// modify it under the terms of the GNU Lesser General Public /// License as published by the Free Software Foundation; either /// version 2.1 of the License, or (at your option) any later version. /// This library is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU /// Lesser General Public License for more details. /// You should have received a copy of the GNU Lesser General Public /// License along with this library; if not, write to the Free Software /// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #ifndef X3DTK_CREATOR_H #define X3DTK_CREATOR_H #include "X3D_X3DNode.h" #include "CreationFunction.h" #include "X3DActor.h" namespace X3DTK { namespace X3D { class X3DComponentCreator; /*! \brief Class declared in defining a creator which * aggregates the different component creators. The creator is an abstract factory * and a facade. * * \ingroup X3DLoader */ class Creator : public X3DActor { public: /// Constructor. Creator(); /// Destructor. virtual ~Creator(); /// Sets the X3DComponentCreator. void setComponentCreator(X3DComponentCreator *component); /// Creates the SFNode from its name. X3D::X3DNode *createFromName(const SFString &name) const; /// Empties the list of component. void reset(); /// Gets the name of the component of the type name. SFString getComponentNameOf(const SFString &name) const; friend Creator *joinCreator(Creator *N0, Creator *N1); private: ///Gets the creation function related with name. CreationFunction *getCreationFunctionOf(const SFString &name) const; //Dictionary of all the creation functions used. CreationDict _creationDict; std::list _componentList; }; } } #endif