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 : /** @internal Destruct this object factory. */
41 2 : virtual ~ObjectFactory() {}
42 : /**
43 : * @return a new object instance of the given type.
44 : * @version 1.0
45 : * @sa ObjectType, Config::getObject(), Renderer::getObject()
46 : */
47 0 : virtual co::Object* createObject(const uint32_t /*type*/)
48 : {
49 0 : LBUNIMPLEMENTED;
50 0 : return 0;
51 : }
52 :
53 : /** Delete the given object of the given type. @version 1.0 */
54 0 : virtual void destroyObject(co::Object* object, const uint32_t /*type*/)
55 : {
56 0 : delete object;
57 0 : }
58 : };
59 : }
60 : #endif // CO_OBJECTFACTORY_H
|