Line data Source code
1 :
2 : /* Copyright (c) 2011-2013, Stefan Eilemann <eile@eyescale.ch>
3 : * 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
4 : *
5 : * This file is part of Collage <https://github.com/Eyescale/Collage>
6 : *
7 : * This library is free software; you can redistribute it and/or modify it under
8 : * the terms of the GNU Lesser General Public License version 2.1 as published
9 : * by the Free Software Foundation.
10 : *
11 : * This library is distributed in the hope that it will be useful, but WITHOUT
12 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 : * details.
15 : *
16 : * You should have received a copy of the GNU Lesser General Public License
17 : * along with this library; if not, write to the Free Software Foundation, Inc.,
18 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 : */
20 :
21 : #ifndef CO_OBJECTFACTORY_H
22 : #define CO_OBJECTFACTORY_H
23 :
24 : #include <co/object.h> // deleted inline
25 :
26 : namespace co
27 : {
28 : enum ObjectType
29 : {
30 : OBJECTTYPE_NONE, //!< @internal
31 : OBJECTTYPE_CUSTOM = 16 //!< Application-defined objects
32 : };
33 :
34 : /** The interface to create objects, used by ObjectMap. */
35 : class ObjectFactory
36 : {
37 : public:
38 : /** @internal Construct a new object factory. */
39 2 : ObjectFactory(){}
40 :
41 : /** @internal Destruct this object factory. */
42 2 : virtual ~ObjectFactory(){}
43 :
44 : /**
45 : * @return a new object instance of the given type.
46 : * @version 1.0
47 : * @sa ObjectType, Config::getObject(), Renderer::getObject()
48 : */
49 0 : virtual co::Object* createObject( const uint32_t /*type*/ )
50 0 : { LBUNIMPLEMENTED; return 0; }
51 :
52 : /** Delete the given object of the given type. @version 1.0 */
53 0 : virtual void destroyObject( co::Object* object, const uint32_t /*type*/ )
54 0 : { delete object; }
55 : };
56 : }
57 : #endif // CO_OBJECTFACTORY_H
|