Jenkins has some problems with bind and lambdas. Let's try it with ordinary function pointers...

This commit is contained in:
Thomas Geymayer
2012-11-06 19:34:23 +01:00
parent 34719da000
commit 81bee2bbc6
2 changed files with 13 additions and 22 deletions

View File

@@ -46,9 +46,9 @@ namespace canvas
typedef boost::weak_ptr<Element> ElementWeakPtr; typedef boost::weak_ptr<Element> ElementWeakPtr;
typedef std::map<std::string, const SGPropertyNode*> Style; typedef std::map<std::string, const SGPropertyNode*> Style;
typedef boost::function<ElementPtr( const CanvasWeakPtr&, typedef ElementPtr (*ElementFactory)( const CanvasWeakPtr&,
const SGPropertyNode_ptr&, const SGPropertyNode_ptr&,
const Style& )> ElementFactory; const Style& );
typedef osg::ref_ptr<osgText::Font> FontPtr; typedef osg::ref_ptr<osgText::Font> FontPtr;

View File

@@ -22,30 +22,21 @@
#include "CanvasPath.hxx" #include "CanvasPath.hxx"
#include "CanvasText.hxx" #include "CanvasText.hxx"
#include <boost/bind.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/make_shared.hpp>
#include <boost/lambda/core.hpp>
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
/** /**
* Create an ElementFactory for elements of type T * Create an canvas Element of type T
*/ */
template<typename T> template<typename T>
ElementFactory createElementFactory() ElementPtr createElement( const CanvasWeakPtr& canvas,
const SGPropertyNode_ptr& node,
const Style& style )
{ {
return boost::bind return ElementPtr( new T(canvas, node, style) );
(
&boost::make_shared<T, const CanvasWeakPtr&,
const SGPropertyNode_ptr&,
const Style&>,
boost::lambda::_1,
boost::lambda::_2,
boost::lambda::_3
);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -54,11 +45,11 @@ namespace canvas
const Style& parent_style ): const Style& parent_style ):
Element(canvas, node, parent_style) Element(canvas, node, parent_style)
{ {
_child_factories["group"] = createElementFactory<Group>(); _child_factories["group"] = &createElement<Group>;
_child_factories["image"] = createElementFactory<Image>(); _child_factories["image"] = &createElement<Image>;
_child_factories["map" ] = createElementFactory<Map >(); _child_factories["map" ] = &createElement<Map >;
_child_factories["path" ] = createElementFactory<Path >(); _child_factories["path" ] = &createElement<Path >;
_child_factories["text" ] = createElementFactory<Text >(); _child_factories["text" ] = &createElement<Text >;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------