1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2009 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGCOLLADAHANDLERFACTORY_H_
40 #define _OSGCOLLADAHANDLERFACTORY_H_
45 #include "OSGConfig.h"
47 #if defined(OSG_WITH_COLLADA) || defined(OSG_DO_DOC)
49 #include "OSGFileIODef.h"
50 #include "OSGSingletonHolder.h"
55 #include <boost/function.hpp>
59 class ColladaExtraHandler
;
60 OSG_GEN_MEMOBJPTR(ColladaExtraHandler
);
62 class ColladaDomProfileHandler
;
63 OSG_GEN_MEMOBJPTR(ColladaDomProfileHandler
);
65 /*! \ingroup GrpFileIOCollada
69 class OSG_FILEIO_DLLMAPPING ColladaHandlerFactoryBase
71 /*========================== PUBLIC =================================*/
75 /*---------------------------------------------------------------------*/
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
;
98 /*---------------------------------------------------------------------*/
99 /*! \name Registration */
102 void registerExtraHandler(ExtraHandlerCreator fCreator
);
103 void createExtraHandlers (ExtraHandlerStore
&vStore
);
106 /*---------------------------------------------------------------------*/
107 /*! \name Default Profile */
110 void registerDomProfileHandler(UInt32 uiProfileId
,
111 DomProfileHandlerCreator fCreator
);
114 /*---------------------------------------------------------------------*/
115 /*! \name Default Profile */
118 ColladaDomProfileHandlerTPtr
createDomProfileHandler(UInt32 uiProfileId
);
121 /*---------------------------------------------------------------------*/
126 /*========================= PROTECTED ===============================*/
130 DomProfileHandlerMap _mDomProfileCreators
;
131 ExtraHandlerCreatorStore _vExtraHandlerCreators
;
133 /*---------------------------------------------------------------------*/
138 /*========================== PRIVATE ================================*/
142 /*---------------------------------------------------------------------*/
143 /*! \name Constructors/Destructor */
146 ColladaHandlerFactoryBase(void);
147 ~ColladaHandlerFactoryBase(void);
150 /*---------------------------------------------------------------------*/
152 template <class SingletonT
>
153 friend class SingletonHolder
;
157 OSG_FILEIO_EXPIMP_TMPL
158 template class OSG_FILEIO_DLLMAPPING SingletonHolder
<ColladaHandlerFactoryBase
>;
161 /*! \ingroup GrpFileIOCollada
164 typedef SingletonHolder
<ColladaHandlerFactoryBase
> ColladaHandlerFactory
;
168 #endif // OSG_WITH_COLLADA
170 #endif // _OSGCOLLADAHANDLERFACTORY_H_