fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FileIO / Collada / OSGColladaHandlerFactory.h
blobf684fb8ad570083e91344804ed6ef0cf50c2383f
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2009 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGCOLLADAHANDLERFACTORY_H_
40 #define _OSGCOLLADAHANDLERFACTORY_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGConfig.h"
47 #if defined(OSG_WITH_COLLADA) || defined(OSG_DO_DOC)
49 #include "OSGFileIODef.h"
50 #include "OSGSingletonHolder.h"
52 #include <map>
53 #include <string>
55 #include <boost/function.hpp>
57 OSG_BEGIN_NAMESPACE
59 class ColladaExtraHandler;
60 OSG_GEN_MEMOBJPTR(ColladaExtraHandler);
62 class ColladaDomProfileHandler;
63 OSG_GEN_MEMOBJPTR(ColladaDomProfileHandler);
65 /*! \ingroup GrpFileIOCollada
66 \nohierarchy
69 class OSG_FILEIO_DLLMAPPING ColladaHandlerFactoryBase
71 /*========================== PUBLIC =================================*/
73 public:
75 /*---------------------------------------------------------------------*/
76 /*! \name Types */
77 /*! \{ */
79 typedef boost::function<
80 ColladaExtraHandlerTransitPtr (void)> ExtraHandlerCreator;
82 typedef boost::function<
83 ColladaDomProfileHandlerTransitPtr(void)> DomProfileHandlerCreator;
86 typedef std::map<UInt32,
87 DomProfileHandlerCreator> DomProfileHandlerMap;
88 typedef DomProfileHandlerMap::iterator DomProfileHandlerMapIt;
89 typedef DomProfileHandlerMap::const_iterator DomProfileHandlerMapConstIt;
91 typedef std::vector<ExtraHandlerCreator > ExtraHandlerCreatorStore;
93 typedef std::vector<ColladaExtraHandlerRefPtr> ExtraHandlerStore;
95 typedef ColladaDomProfileHandlerTransitPtr ColladaDomProfileHandlerTPtr;
97 /*! \} */
98 /*---------------------------------------------------------------------*/
99 /*! \name Registration */
100 /*! \{ */
102 void registerExtraHandler(ExtraHandlerCreator fCreator);
103 void createExtraHandlers (ExtraHandlerStore &vStore );
105 /*! \} */
106 /*---------------------------------------------------------------------*/
107 /*! \name Default Profile */
108 /*! \{ */
110 void registerDomProfileHandler(UInt32 uiProfileId,
111 DomProfileHandlerCreator fCreator );
113 /*! \} */
114 /*---------------------------------------------------------------------*/
115 /*! \name Default Profile */
116 /*! \{ */
118 ColladaDomProfileHandlerTPtr createDomProfileHandler(UInt32 uiProfileId);
120 /*! \} */
121 /*---------------------------------------------------------------------*/
122 /*! \name Create */
123 /*! \{ */
125 /*! \} */
126 /*========================= PROTECTED ===============================*/
128 protected:
130 DomProfileHandlerMap _mDomProfileCreators;
131 ExtraHandlerCreatorStore _vExtraHandlerCreators;
133 /*---------------------------------------------------------------------*/
134 /*! \name Helper */
135 /*! \{ */
137 /*! \} */
138 /*========================== PRIVATE ================================*/
140 private:
142 /*---------------------------------------------------------------------*/
143 /*! \name Constructors/Destructor */
144 /*! \{ */
146 ColladaHandlerFactoryBase(void);
147 ~ColladaHandlerFactoryBase(void);
149 /*! \} */
150 /*---------------------------------------------------------------------*/
152 template <class SingletonT>
153 friend class SingletonHolder;
156 #if defined(WIN32)
157 OSG_FILEIO_EXPIMP_TMPL
158 template class OSG_FILEIO_DLLMAPPING SingletonHolder<ColladaHandlerFactoryBase>;
159 #endif
161 /*! \ingroup GrpFileIOCollada
164 typedef SingletonHolder<ColladaHandlerFactoryBase> ColladaHandlerFactory;
166 OSG_END_NAMESPACE
168 #endif // OSG_WITH_COLLADA
170 #endif // _OSGCOLLADAHANDLERFACTORY_H_