Canvas.hxx   Canvas.hxx 
skipping to change at line 74 skipping to change at line 74
CullCallback(const CanvasWeakPtr& canvas); CullCallback(const CanvasWeakPtr& canvas);
private: private:
CanvasWeakPtr _canvas; CanvasWeakPtr _canvas;
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv); virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
}; };
typedef osg::ref_ptr<CullCallback> CullCallbackPtr; typedef osg::ref_ptr<CullCallback> CullCallbackPtr;
Canvas(SGPropertyNode* node); Canvas(SGPropertyNode* node);
virtual ~Canvas();
virtual void onDestroy(); virtual void onDestroy();
void setSystemAdapter(const SystemAdapterPtr& system_adapter);
SystemAdapterPtr getSystemAdapter() const;
void setCanvasMgr(CanvasMgr* canvas_mgr); void setCanvasMgr(CanvasMgr* canvas_mgr);
CanvasMgr* getCanvasMgr() const; CanvasMgr* getCanvasMgr() const;
bool isInit() const; bool isInit() const;
/** /**
* Add a canvas which should be marked as dirty upon any change to th is * Add a canvas which should be marked as dirty upon any change to th is
* canvas. * canvas.
* *
* This mechanism is used to eg. redraw a canvas if it's displaying * This mechanism is used to eg. redraw a canvas if it's displaying
skipping to change at line 135 skipping to change at line 133
/** /**
* Enable rendering for the next frame * Enable rendering for the next frame
* *
* @param force Force redraw even if nothing has changed (if dirty flag * @param force Force redraw even if nothing has changed (if dirty flag
* is not set) * is not set)
*/ */
void enableRendering(bool force = false); void enableRendering(bool force = false);
void update(double delta_time_sec); void update(double delta_time_sec);
naRef addEventListener(const nasal::CallContext& ctx); bool addEventListener(const std::string& type, const EventListener& c b);
void setSizeX(int sx); void setSizeX(int sx);
void setSizeY(int sy); void setSizeY(int sy);
int getSizeX() const; int getSizeX() const;
int getSizeY() const; int getSizeY() const;
void setViewWidth(int w); void setViewWidth(int w);
void setViewHeight(int h); void setViewHeight(int h);
skipping to change at line 165 skipping to change at line 163
SGPropertyNode * child ); SGPropertyNode * child );
virtual void valueChanged (SGPropertyNode * node); virtual void valueChanged (SGPropertyNode * node);
osg::Texture2D* getTexture() const; osg::Texture2D* getTexture() const;
CullCallbackPtr getCullCallback() const; CullCallbackPtr getCullCallback() const;
void reloadPlacements( const std::string& type = std::string() ); void reloadPlacements( const std::string& type = std::string() );
static void addPlacementFactory( const std::string& type, static void addPlacementFactory( const std::string& type,
PlacementFactory factory ); PlacementFactory factory );
static void removePlacementFactory(const std::string& type);
/**
* Set global SystemAdapter for all Canvas/ODGauge instances.
*
* The SystemAdapter is responsible for application specific operatio
ns
* like loading images/fonts and adding/removing cameras to the scene
* graph.
*/
static void setSystemAdapter(const SystemAdapterPtr& system_adapter);
static SystemAdapterPtr getSystemAdapter();
protected: protected:
SystemAdapterPtr _system_adapter;
CanvasMgr *_canvas_mgr; CanvasMgr *_canvas_mgr;
boost::scoped_ptr<EventManager> _event_manager; boost::scoped_ptr<EventManager> _event_manager;
int _size_x, int _size_x,
_size_y, _size_y,
_view_width, _view_width,
_view_height; _view_height;
PropertyObject<int> _status; PropertyObject<int> _status;
skipping to change at line 205 skipping to change at line 213
// this canvas // this canvas
typedef std::map<std::string, PlacementFactory> PlacementFactoryMap; typedef std::map<std::string, PlacementFactory> PlacementFactoryMap;
static PlacementFactoryMap _placement_factories; static PlacementFactoryMap _placement_factories;
virtual void setSelf(const PropertyBasedElementPtr& self); virtual void setSelf(const PropertyBasedElementPtr& self);
void setStatusFlags(unsigned int flags, bool set = true); void setStatusFlags(unsigned int flags, bool set = true);
private: private:
static SystemAdapterPtr _system_adapter;
Canvas(const Canvas&); // = delete; Canvas(const Canvas&); // = delete;
Canvas& operator=(const Canvas&); // = delete; Canvas& operator=(const Canvas&); // = delete;
}; };
} // namespace canvas } // namespace canvas
} // namespace simgear } // namespace simgear
#endif /* CANVAS_HXX_ */ #endif /* CANVAS_HXX_ */
 End of changes. 6 change blocks. 
5 lines changed or deleted 16 lines changed or added


 CanvasElement.hxx   CanvasElement.hxx 
skipping to change at line 26 skipping to change at line 26
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA
#ifndef CANVAS_ELEMENT_HXX_ #ifndef CANVAS_ELEMENT_HXX_
#define CANVAS_ELEMENT_HXX_ #define CANVAS_ELEMENT_HXX_
#include <simgear/canvas/canvas_fwd.hxx> #include <simgear/canvas/canvas_fwd.hxx>
#include <simgear/canvas/CanvasEvent.hxx> #include <simgear/canvas/CanvasEvent.hxx>
#include <simgear/props/PropertyBasedElement.hxx> #include <simgear/props/PropertyBasedElement.hxx>
#include <simgear/misc/stdint.hxx> // for uint32_t #include <simgear/misc/stdint.hxx> // for uint32_t
#include <simgear/nasal/cppbind/Ghost.hxx>
#include <osg/BoundingBox> #include <osg/BoundingBox>
#include <osg/MatrixTransform> #include <osg/MatrixTransform>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/function.hpp> #include <boost/function.hpp>
#include <boost/type_traits/is_base_of.hpp>
namespace osg namespace osg
{ {
class Drawable; class Drawable;
} }
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
skipping to change at line 79 skipping to change at line 79
}; };
struct StyleInfo struct StyleInfo
{ {
StyleSetter setter; ///!< Function(s) for setting this style StyleSetter setter; ///!< Function(s) for setting this style
std::string type; ///!< Interpolation type std::string type; ///!< Interpolation type
bool inheritable; ///!< Whether children can inherit this style f rom bool inheritable; ///!< Whether children can inherit this style f rom
/// their parents /// their parents
}; };
/** /**
* Coordinate reference frame (eg. "clip" property)
*/
enum ReferenceFrame
{
GLOBAL, ///!< Global coordinates
PARENT, ///!< Coordinates relative to parent coordinate frame
LOCAL ///!< Coordinates relative to local coordinates (parent
/// coordinates with local transformations applied)
};
/**
* *
*/ */
virtual ~Element() = 0; virtual ~Element() = 0;
virtual void setSelf(const PropertyBasedElementPtr& self); virtual void setSelf(const PropertyBasedElementPtr& self);
virtual void onDestroy(); virtual void onDestroy();
ElementWeakPtr getWeakPtr() const; ElementWeakPtr getWeakPtr() const;
ElementPtr getParent();
/** /**
* Called every frame to update internal state * Called every frame to update internal state
* *
* @param dt Frame time in seconds * @param dt Frame time in seconds
*/ */
virtual void update(double dt); virtual void update(double dt);
naRef addEventListener(const nasal::CallContext& ctx); bool addEventListener(const std::string& type, const EventListener& c b);
virtual void clearEventListener(); virtual void clearEventListener();
virtual bool accept(EventVisitor& visitor); virtual bool accept(EventVisitor& visitor);
virtual bool ascend(EventVisitor& visitor); virtual bool ascend(EventVisitor& visitor);
virtual bool traverse(EventVisitor& visitor); virtual bool traverse(EventVisitor& visitor);
virtual bool handleEvent(canvas::EventPtr event); virtual bool handleEvent(canvas::EventPtr event);
virtual bool hitBound( const osg::Vec2f& pos, virtual bool hitBound( const osg::Vec2f& pos,
const osg::Vec2f& local_pos ) const; const osg::Vec2f& local_pos ) const;
skipping to change at line 134 skipping to change at line 146
/** /**
* Set clipping shape * Set clipping shape
* *
* @note Only "rect(<top>, <right>, <bottom>, <left>)" is supported * @note Only "rect(<top>, <right>, <bottom>, <left>)" is supported
* @see http://www.w3.org/TR/CSS21/visufx.html#propdef-clip * @see http://www.w3.org/TR/CSS21/visufx.html#propdef-clip
*/ */
void setClip(const std::string& clip); void setClip(const std::string& clip);
/** /**
* Clipping coordinates reference frame
*/
void setClipFrame(ReferenceFrame rf);
/**
* Write the given bounding box to the property tree * Write the given bounding box to the property tree
*/ */
void setBoundingBox(const osg::BoundingBox& bb); void setBoundingBox(const osg::BoundingBox& bb);
/** /**
* Get bounding box with children/drawables transformed by passed mat rix * Get bounding box with children/drawables transformed by passed mat rix
*/ */
virtual osg::BoundingBox getTransformedBounds(const osg::Matrix& m) c onst; virtual osg::BoundingBox getTransformedBounds(const osg::Matrix& m) c onst;
/** /**
* Get the transformation matrix (product of all transforms)
*/
osg::Matrix getMatrix() const;
/**
* Create an canvas Element * Create an canvas Element
* *
* @tparam Derived Type of element (needs to derive from Element) * @tparam Derived Type of element (needs to derive from Element)
*/ */
template<typename Derived> template<typename Derived>
static static
typename boost::enable_if< typename boost::enable_if<
boost::is_base_of<Element, Derived>, boost::is_base_of<Element, Derived>,
ElementPtr ElementPtr
>::type create( const CanvasWeakPtr& canvas, >::type create( const CanvasWeakPtr& canvas,
skipping to change at line 167 skipping to change at line 189
{ {
ElementPtr el( new Derived(canvas, node, style, parent) ); ElementPtr el( new Derived(canvas, node, style, parent) );
el->setSelf(el); el->setSelf(el);
return el; return el;
} }
protected: protected:
enum Attributes enum Attributes
{ {
BLEND_FUNC = 0x0001, TRANSFORM = 1,
LAST_ATTRIBUTE = BLEND_FUNC << 1 BLEND_FUNC = TRANSFORM << 1,
SCISSOR_COORDS = BLEND_FUNC << 1,
LAST_ATTRIBUTE = SCISSOR_COORDS << 1
}; };
enum TransformType enum TransformType
{ {
TT_NONE, TT_NONE,
TT_MATRIX, TT_MATRIX,
TT_TRANSLATE, TT_TRANSLATE,
TT_ROTATE, TT_ROTATE,
TT_SCALE TT_SCALE
}; };
class RelativeScissor;
CanvasWeakPtr _canvas; CanvasWeakPtr _canvas;
Element *_parent; Element *_parent;
uint32_t _attributes_dirty; mutable uint32_t _attributes_dirty;
bool _transform_dirty;
osg::observer_ptr<osg::MatrixTransform> _transform; osg::observer_ptr<osg::MatrixTransform> _transform;
std::vector<TransformType> _transform_types; std::vector<TransformType> _transform_types;
Style _style; Style _style;
std::vector<SGPropertyNode_ptr> _bounding_box; std::vector<SGPropertyNode_ptr> _bounding_box;
RelativeScissor *_scissor;
typedef std::vector<EventListenerPtr> Listener; typedef std::vector<EventListener> Listener;
typedef std::map<Event::Type, Listener> ListenerMap; typedef std::map<Event::Type, Listener> ListenerMap;
ListenerMap _listener; ListenerMap _listener;
typedef std::map<std::string, StyleInfo> StyleSetters; typedef std::map<std::string, StyleInfo> StyleSetters;
static StyleSetters _style_setters; static StyleSetters _style_setters;
static void staticInit(); static void staticInit();
Element( const CanvasWeakPtr& canvas, Element( const CanvasWeakPtr& canvas,
skipping to change at line 557 skipping to change at line 583
Derived* d = dynamic_cast<Derived*>(&el); Derived* d = dynamic_cast<Derived*>(&el);
if( !d ) if( !d )
return false; return false;
func(*d, prop); func(*d, prop);
return true; return true;
} }
}; };
}; };
} // namespace canvas } // namespace canvas
template<>
struct enum_traits<canvas::Element::ReferenceFrame>
{
static const char* name()
{
return "canvas::Element::ReferenceFrame";
}
static canvas::Element::ReferenceFrame defVal()
{
return canvas::Element::GLOBAL;
}
static bool validate(int frame)
{
return frame >= canvas::Element::GLOBAL
&& frame <= canvas::Element::LOCAL;
}
};
} // namespace simgear } // namespace simgear
#endif /* CANVAS_ELEMENT_HXX_ */ #endif /* CANVAS_ELEMENT_HXX_ */
 End of changes. 14 change blocks. 
7 lines changed or deleted 54 lines changed or added


 CanvasMgr.hxx   CanvasMgr.hxx 
skipping to change at line 37 skipping to change at line 37
namespace canvas namespace canvas
{ {
class CanvasMgr: class CanvasMgr:
public PropertyBasedMgr public PropertyBasedMgr
{ {
public: public:
/** /**
* @param node Root node of branch used to control canvass es * @param node Root node of branch used to control canvass es
* @param system_adapter Adapter for connecting between canvas and
* application framework
*
*/ */
CanvasMgr( SGPropertyNode_ptr node, CanvasMgr(SGPropertyNode_ptr node);
SystemAdapterPtr system_adapter );
/** /**
* Create a new canvas * Create a new canvas
* *
* @param name Name of the new canvas * @param name Name of the new canvas
*/ */
CanvasPtr createCanvas(const std::string& name = ""); CanvasPtr createCanvas(const std::string& name = "");
/** /**
* Get ::Canvas by index * Get ::Canvas by index
skipping to change at line 68 skipping to change at line 64
/** /**
* Get ::Canvas by name * Get ::Canvas by name
* *
* @param name Value of child node "name" in * @param name Value of child node "name" in
* /canvas/by-index/texture[i]/name * /canvas/by-index/texture[i]/name
*/ */
CanvasPtr getCanvas(const std::string& name) const; CanvasPtr getCanvas(const std::string& name) const;
protected: protected:
SystemAdapterPtr _system_adapter;
virtual void elementCreated(PropertyBasedElementPtr element); virtual void elementCreated(PropertyBasedElementPtr element);
}; };
} // namespace canvas } // namespace canvas
} // namespace simgear } // namespace simgear
#endif /* SG_CANVAS_MGR_H_ */ #endif /* SG_CANVAS_MGR_H_ */
 End of changes. 3 change blocks. 
7 lines changed or deleted 1 lines changed or added


 CanvasSystemAdapter.hxx   CanvasSystemAdapter.hxx 
skipping to change at line 23 skipping to change at line 23
// Library General Public License for more details. // Library General Public License for more details.
// //
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA
#ifndef SG_CANVAS_SYSTEM_ADAPTER_HXX_ #ifndef SG_CANVAS_SYSTEM_ADAPTER_HXX_
#define SG_CANVAS_SYSTEM_ADAPTER_HXX_ #define SG_CANVAS_SYSTEM_ADAPTER_HXX_
#include "canvas_fwd.hxx" #include "canvas_fwd.hxx"
#include <simgear/nasal/nasal.h>
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
class SystemAdapter class SystemAdapter
{ {
public: public:
virtual ~SystemAdapter() {} virtual ~SystemAdapter() {}
virtual FontPtr getFont(const std::string& name) const = 0; virtual FontPtr getFont(const std::string& name) const = 0;
virtual void addCamera(osg::Camera* camera) const = 0; virtual void addCamera(osg::Camera* camera) const = 0;
virtual void removeCamera(osg::Camera* camera) const = 0; virtual void removeCamera(osg::Camera* camera) const = 0;
virtual osg::Image* getImage(const std::string& path) const = 0; virtual osg::Image* getImage(const std::string& path) const = 0;
virtual naContext getNasalContext() const = 0;
/**
* Save passed reference to Nasal object from being deleted by the
* garbage collector.
*/
virtual int gcSave(naRef r) = 0;
/**
* Release an object previously passed to ::gcSave to allow it being
* cleaned up by the garbage collector.
*/
virtual void gcRelease(int key) = 0;
/**
* Call a Nasal function with the given environment and arguments.
*/
virtual naRef callMethod( naRef code,
naRef self,
int argc,
naRef* args,
naRef locals ) = 0;
}; };
} // namespace canvas } // namespace canvas
} // namespace simgear } // namespace simgear
#endif /* SG_CANVAS_SYSTEM_ADAPTER_HXX_ */ #endif /* SG_CANVAS_SYSTEM_ADAPTER_HXX_ */
 End of changes. 2 change blocks. 
24 lines changed or deleted 0 lines changed or added


 DAVMultiStatus.hxx   DAVMultiStatus.hxx 
skipping to change at line 131 skipping to change at line 131
{ {
public: public:
DAVMultiStatus(); DAVMultiStatus();
~DAVMultiStatus(); ~DAVMultiStatus();
// incremental XML parsing // incremental XML parsing
void parseXML(const char* data, int size); void parseXML(const char* data, int size);
void finishParse(); void finishParse();
bool isValid() const;
DAVResource* resource(); DAVResource* resource();
class DAVMultiStatusPrivate; class DAVMultiStatusPrivate;
private: private:
std::auto_ptr<DAVMultiStatusPrivate> _d; std::auto_ptr<DAVMultiStatusPrivate> _d;
}; };
} // of namespace simgear } // of namespace simgear
#endif // of SG_IO_DAVMULTISTATUS_HXX #endif // of SG_IO_DAVMULTISTATUS_HXX
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 DeletionManager.hxx   DeletionManager.hxx 
skipping to change at line 41 skipping to change at line 41
namespace simgear namespace simgear
{ {
class DeletionManager : public osgGA::GUIEventHandler class DeletionManager : public osgGA::GUIEventHandler
{ {
public: public:
virtual bool handle(const osgGA::GUIEventAdapter& ea, virtual bool handle(const osgGA::GUIEventAdapter& ea,
osgGA::GUIActionAdapter& aa, osgGA::GUIActionAdapter& aa,
osg::Object* object, osg::NodeVisitor* nv); osg::Object* object, osg::NodeVisitor* nv);
void addStaleObject(osg::Referenced* obj); void addStaleObject(osg::Referenced* obj);
static void install(osg::Node* node); static void install(osg::Node* node);
static void uninstall(osg::Node* node);
static DeletionManager* instance(); static DeletionManager* instance();
protected: protected:
OpenThreads::Mutex _mutex; OpenThreads::Mutex _mutex;
std::vector<osg::ref_ptr<osg::Referenced> > _staleObjects; std::vector<osg::ref_ptr<osg::Referenced> > _staleObjects;
}; };
} }
#endif #endif
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 Effect.hxx   Effect.hxx 
skipping to change at line 178 skipping to change at line 178
bool realizeTechniques, bool realizeTechniques,
const SGReaderWriterOptions* options); const SGReaderWriterOptions* options);
Effect* makeEffect(SGPropertyNode* prop, Effect* makeEffect(SGPropertyNode* prop,
bool realizeTechniques, bool realizeTechniques,
const SGReaderWriterOptions* options); const SGReaderWriterOptions* options);
bool makeParametersFromStateSet(SGPropertyNode* paramRoot, bool makeParametersFromStateSet(SGPropertyNode* paramRoot,
const osg::StateSet* ss); const osg::StateSet* ss);
void clearEffectCache();
namespace effect namespace effect
{ {
/** /**
* The function that implements effect property tree inheritance. * The function that implements effect property tree inheritance.
*/ */
void mergePropertyTrees(SGPropertyNode* resultNode, void mergePropertyTrees(SGPropertyNode* resultNode,
const SGPropertyNode* left, const SGPropertyNode* left,
const SGPropertyNode* right); const SGPropertyNode* right);
} }
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 EffectBuilder.hxx   EffectBuilder.hxx 
skipping to change at line 318 skipping to change at line 318
const SGReaderWriterOptions *options, size_t vecSize, const SGReaderWriterOptions *options, size_t vecSize,
NameItr defaultNames) NameItr defaultNames)
{ {
using namespace std; using namespace std;
vector<string> result; vector<string> result;
if (!prop) if (!prop)
return result; return result;
PropertyList useProps = prop->getChildren("use"); PropertyList useProps = prop->getChildren("use");
if (useProps.size() == 1) { if (useProps.size() == 1) {
string parentName = useProps[0]->getStringValue(); string parentName = useProps[0]->getStringValue();
if (parentName.size() == 0 || parentName[0] != '/') if (parentName.empty() || parentName[0] != '/')
parentName = options->getPropertyNode()->getPath() + "/" + pare ntName; parentName = options->getPropertyNode()->getPath() + "/" + pare ntName;
if (parentName[parentName.size() - 1] != '/') if (parentName[parentName.size() - 1] != '/')
parentName.append("/"); parentName.append("/");
NameItr itr = defaultNames; NameItr itr = defaultNames;
for (size_t i = 0; i < vecSize; ++i, ++itr) for (size_t i = 0; i < vecSize; ++i, ++itr)
result.push_back(parentName + *itr); result.push_back(parentName + *itr);
} else if (useProps.size() == vecSize) { } else if (useProps.size() == vecSize) {
string parentName = useProps[0]->getStringValue(); string parentName = useProps[0]->getStringValue();
parentName += "/"; parentName += "/";
for (PropertyList::const_iterator itr = useProps.begin(), for (PropertyList::const_iterator itr = useProps.begin(),
end = useProps.end(); end = useProps.end();
itr != end; itr != end;
++itr) { ++itr) {
string childName = (*itr)->getStringValue(); string childName = (*itr)->getStringValue();
if (childName.size() == 0 || childName[0] != '/') if (childName.empty() || childName[0] != '/')
result.push_back(parentName + childName); result.push_back(parentName + childName);
else else
result.push_back(childName); result.push_back(childName);
} }
} }
return result; return result;
} }
class PassAttributeBuilder : public SGReferenced class PassAttributeBuilder : public SGReferenced
{ {
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 Ghost.hxx   Ghost.hxx 
skipping to change at line 24 skipping to change at line 24
// Library General Public License for more details. // Library General Public License for more details.
// //
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA
#ifndef SG_NASAL_GHOST_HXX_ #ifndef SG_NASAL_GHOST_HXX_
#define SG_NASAL_GHOST_HXX_ #define SG_NASAL_GHOST_HXX_
#include "NasalCallContext.hxx" #include "NasalCallContext.hxx"
#include "NasalObjectHolder.hxx"
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/call_traits.hpp> #include <boost/call_traits.hpp>
#include <boost/function.hpp> #include <boost/function.hpp>
#include <boost/lambda/lambda.hpp> #include <boost/lambda/lambda.hpp>
#include <boost/mpl/has_xxx.hpp> #include <boost/mpl/has_xxx.hpp>
#include <boost/preprocessor/iteration/iterate.hpp> #include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
skipping to change at line 70 skipping to change at line 71
* parents array. * parents array.
*/ */
void addNasalBase(const naRef& parent) void addNasalBase(const naRef& parent)
{ {
assert( naIsHash(parent) ); assert( naIsHash(parent) );
_parents.push_back(parent); _parents.push_back(parent);
} }
bool isBaseOf(naGhostType* ghost_type) const bool isBaseOf(naGhostType* ghost_type) const
{ {
if( ghost_type == &_ghost_type ) if( ghost_type == _ghost_type_ptr )
return true; return true;
for( DerivedList::const_iterator derived = _derived_classes.begin (); for( DerivedList::const_iterator derived = _derived_classes.begin ();
derived != _derived_classes.end( ); derived != _derived_classes.end( );
++derived ) ++derived )
{ {
if( (*derived)->isBaseOf(ghost_type) ) if( (*derived)->isBaseOf(ghost_type) )
return true; return true;
} }
return false; return false;
} }
protected: protected:
typedef std::vector<const GhostMetadata*> DerivedList; typedef std::vector<const GhostMetadata*> DerivedList;
const std::string _name; const std::string _name;
naGhostType _ghost_type; const naGhostType *_ghost_type_ptr;
DerivedList _derived_classes; DerivedList _derived_classes;
std::vector<naRef> _parents; std::vector<naRef> _parents;
explicit GhostMetadata(const std::string& name): GhostMetadata( const std::string& name,
_name(name) const naGhostType* ghost_type ):
_name(name),
_ghost_type_ptr(ghost_type)
{ {
} }
void addDerived(const GhostMetadata* derived) void addDerived(const GhostMetadata* derived)
{ {
assert(derived); assert(derived);
_derived_classes.push_back(derived); _derived_classes.push_back(derived);
SG_LOG SG_LOG
( (
SG_NASAL, SG_NASAL,
SG_INFO, SG_INFO,
"Ghost::addDerived: " <<_ghost_type.name << " -> " << derived-> _name "Ghost::addDerived: " << _name << " -> " << derived->_name
); );
} }
naRef getParents(naContext c) naRef getParents(naContext c)
{ {
return nasal::to_nasal(c, _parents); return nasal::to_nasal(c, _parents);
} }
}; };
/** /**
* Hold callable method and convert to Nasal function if required. * Hold callable method and convert to Nasal function if required.
*/ */
class MethodHolder class MethodHolder
{ {
public: public:
virtual ~MethodHolder() {} virtual ~MethodHolder() {}
virtual naRef get_naRef(naContext c) = 0;
naRef get_naRef(naContext c)
{
if( !_obj )
_obj = ObjectHolder::makeShared(createNasalObject(c));
return _obj->get_naRef();
}
protected:
ObjectHolderRef _obj;
virtual naRef createNasalObject(naContext c) = 0;
}; };
BOOST_MPL_HAS_XXX_TRAIT_DEF(element_type) BOOST_MPL_HAS_XXX_TRAIT_DEF(element_type)
template<class T> template<class T>
struct reduced_type struct reduced_type
{ {
typedef typename boost::remove_cv< typedef typename boost::remove_cv<
typename boost::remove_reference<T>::type typename boost::remove_reference<T>::type
>::type type; >::type type;
skipping to change at line 203 skipping to change at line 217
typedef naRef (*free_func_t)(raw_type&, const CallContext&); typedef naRef (*free_func_t)(raw_type&, const CallContext&);
typedef boost::function<naRef(naContext, raw_type&)> getter_ t; typedef boost::function<naRef(naContext, raw_type&)> getter_ t;
typedef boost::function<void(naContext, raw_type&, naRef)> setter_ t; typedef boost::function<void(naContext, raw_type&, naRef)> setter_ t;
typedef boost::function<naRef(raw_type&, const CallContext&)> method_ t; typedef boost::function<naRef(raw_type&, const CallContext&)> method_ t;
typedef boost::shared_ptr<internal::MethodHolder> MethodHolderPtr; typedef boost::shared_ptr<internal::MethodHolder> MethodHolderPtr;
class MethodHolder: class MethodHolder:
public internal::MethodHolder public internal::MethodHolder
{ {
public: public:
MethodHolder():
_naRef(naNil())
{}
explicit MethodHolder(const method_t& method): explicit MethodHolder(const method_t& method):
_method(method), _method(method)
_naRef(naNil())
{} {}
virtual naRef get_naRef(naContext c)
{
if( naIsNil(_naRef) )
{
_naRef = naNewFunc(c, naNewCCodeU(c, &MethodHolder::call, thi
s));
naSave(c, _naRef);
}
return _naRef;
}
protected: protected:
method_t _method; method_t _method;
naRef _naRef;
virtual naRef createNasalObject(naContext c)
{
return naNewFunc(c, naNewCCodeU(c, &MethodHolder::call, this));
}
static naRef call( naContext c, static naRef call( naContext c,
naRef me, naRef me,
int argc, int argc,
naRef* args, naRef* args,
void* user_data ) void* user_data )
{ {
MethodHolder* holder = static_cast<MethodHolder*>(user_data); MethodHolder* holder = static_cast<MethodHolder*>(user_data);
if( !holder ) if( !holder )
naRuntimeError(c, "invalid method holder!"); naRuntimeError(c, "invalid method holder!");
skipping to change at line 294 skipping to change at line 297
/** /**
* Register a new ghost type. * Register a new ghost type.
* *
* @note Only intialize each ghost type once! * @note Only intialize each ghost type once!
* *
* @param name Descriptive name of the ghost type. * @param name Descriptive name of the ghost type.
*/ */
static Ghost& init(const std::string& name) static Ghost& init(const std::string& name)
{ {
assert( !getSingletonPtr() );
getSingletonHolder().reset( new Ghost(name) ); getSingletonHolder().reset( new Ghost(name) );
return *getSingletonPtr(); return *getSingletonPtr();
} }
/** /**
* Check whether ghost type has already been initialized. * Check whether ghost type has already been initialized.
*/ */
static bool isInit() static bool isInit()
{ {
return getSingletonPtr(); return getSingletonPtr();
skipping to change at line 604 skipping to change at line 605
} }
return pointer(); return pointer();
} }
private: private:
template<class> template<class>
friend class Ghost; friend class Ghost;
static naGhostType _ghost_type;
typedef naGhostType* (*type_checker_t)(const raw_type*); typedef naGhostType* (*type_checker_t)(const raw_type*);
typedef std::vector<type_checker_t> DerivedList; typedef std::vector<type_checker_t> DerivedList;
DerivedList _derived_types; DerivedList _derived_types;
/** /**
* Create a shared pointer on the heap to handle the reference counti ng * Create a shared pointer on the heap to handle the reference counti ng
* for the passed shared pointer while it is used in Nasal space. * for the passed shared pointer while it is used in Nasal space.
*/ */
static pointer* createInstance(const pointer& ptr) static pointer* createInstance(const pointer& ptr)
{ {
skipping to change at line 676 skipping to change at line 679
++derived ) ++derived )
{ {
naGhostType* ghost_type = naGhostType* ghost_type =
(*derived)( static_cast<const typename Ghost::raw_type*>(base) ); (*derived)( static_cast<const typename Ghost::raw_type*>(base) );
if( ghost_type ) if( ghost_type )
return ghost_type; return ghost_type;
} }
// If base is not an instance of any derived class, this class has to // If base is not an instance of any derived class, this class has to
// be the dynamic type. // be the dynamic type.
return &getSingletonPtr()->_ghost_type; return &_ghost_type;
} }
template<class BaseGhost> template<class BaseGhost>
static static
typename boost::disable_if typename boost::disable_if
< boost::is_polymorphic<typename BaseGhost::raw_type>, < boost::is_polymorphic<typename BaseGhost::raw_type>,
naGhostType* naGhostType*
>::type >::type
getTypeFor(const typename BaseGhost::raw_type* base) getTypeFor(const typename BaseGhost::raw_type* base)
{ {
// For non polymorphic classes there is no possibility to get the a ctual // For non polymorphic classes there is no possibility to get the a ctual
// dynamic type, therefore we can only use its static type. // dynamic type, therefore we can only use its static type.
return &BaseGhost::getSingletonPtr()->_ghost_type; return &BaseGhost::_ghost_type;
} }
static Ghost* getSingletonPtr() static Ghost* getSingletonPtr()
{ {
return getSingletonHolder().get(); return getSingletonHolder().get();
} }
static raw_type& requireObject(naContext c, naRef me) static raw_type& requireObject(naContext c, naRef me)
{ {
raw_type* obj = getRawPtr( fromNasal(c, me) ); raw_type* obj = getRawPtr( fromNasal(c, me) );
naGhostType* ghost_type = naGhost_type(me); naGhostType* ghost_type = naGhost_type(me);
if( !obj ) if( !obj )
naRuntimeError naRuntimeError
( (
c, c,
"method called on object of wrong type: is '%s' expected '%s'", "method called on object of wrong type: is '%s' expected '%s'",
ghost_type ? ghost_type->name : "unknown", ghost_type ? ghost_type->name : "unknown",
getSingletonPtr()->_ghost_type.name _ghost_type.name
); );
return *obj; return *obj;
} }
template<class Ret> template<class Ret>
getter_t to_getter(Ret (raw_type::*getter)() const) getter_t to_getter(Ret (raw_type::*getter)() const)
{ {
typedef typename boost::call_traits<Ret>::param_type param_type; typedef typename boost::call_traits<Ret>::param_type param_type;
naRef(*to_nasal_)(naContext, param_type) = &to_nasal; naRef(*to_nasal_)(naContext, param_type) = &to_nasal;
skipping to change at line 810 skipping to change at line 813
// Either const CallContext& or CallContext, non-const reference // Either const CallContext& or CallContext, non-const reference
// does not make sense. // does not make sense.
BOOST_STATIC_ASSERT( (!boost::is_same<Arg, CallContext&>::value) ); BOOST_STATIC_ASSERT( (!boost::is_same<Arg, CallContext&>::value) );
return ctx; return ctx;
}; };
typedef std::auto_ptr<Ghost> GhostPtr; typedef std::auto_ptr<Ghost> GhostPtr;
MemberMap _members; MemberMap _members;
explicit Ghost(const std::string& name): explicit Ghost(const std::string& name):
GhostMetadata( name ) GhostMetadata(name, &_ghost_type)
{ {
_ghost_type.destroy = &destroyGhost; _ghost_type.destroy = &destroyGhost;
_ghost_type.name = _name.c_str(); _ghost_type.name = _name.c_str();
_ghost_type.get_member = &getMember; _ghost_type.get_member = &getMember;
_ghost_type.set_member = &setMember; _ghost_type.set_member = &setMember;
} }
static GhostPtr& getSingletonHolder() static GhostPtr& getSingletonHolder()
{ {
static GhostPtr instance; static GhostPtr instance;
skipping to change at line 898 skipping to change at line 901
naRuntimeError(c, "ghost: No such member: %s", key.c_str()); naRuntimeError(c, "ghost: No such member: %s", key.c_str());
else if( member->second.setter.empty() ) else if( member->second.setter.empty() )
naRuntimeError(c, "ghost: Write protected member: %s", key.c_str( )); naRuntimeError(c, "ghost: Write protected member: %s", key.c_str( ));
else if( member->second.func ) else if( member->second.func )
naRuntimeError(c, "ghost: Write to function: %s", key.c_str()); naRuntimeError(c, "ghost: Write to function: %s", key.c_str());
member->second.setter(c, *getRawPtr(g), val); member->second.setter(c, *getRawPtr(g), val);
} }
}; };
template<class T>
naGhostType Ghost<T>::_ghost_type;
} // namespace nasal } // namespace nasal
// Needs to be outside any namespace to make ADL work
/** /**
* Convert every shared pointer to a ghost. * Convert every shared pointer to a ghost.
*/ */
// Needs to be outside any namespace to mark ADL work
template<class T> template<class T>
typename boost::enable_if< typename boost::enable_if<
nasal::internal::has_element_type< nasal::internal::has_element_type<
typename nasal::internal::reduced_type<T>::type typename nasal::internal::reduced_type<T>::type
>, >,
naRef naRef
>::type >::type
to_nasal_helper(naContext c, T ptr) to_nasal_helper(naContext c, T ptr)
{ {
return nasal::Ghost<T>::create(c, ptr); return nasal::Ghost<T>::create(c, ptr);
} }
/** /**
* Convert nasal ghosts/hashes to shared pointer (of a ghost) * Convert nasal ghosts/hashes to shared pointer (of a ghost).
*/ */
template<class T> template<class T>
typename boost::enable_if< typename boost::enable_if<
nasal::internal::has_element_type< nasal::internal::has_element_type<
typename nasal::internal::reduced_type<T>::type typename nasal::internal::reduced_type<T>::type
>, >,
T T
>::type >::type
from_nasal_helper(naContext c, naRef ref, const T*) from_nasal_helper(naContext c, naRef ref, const T*)
{ {
return nasal::Ghost<T>::fromNasal(c, ref); return nasal::Ghost<T>::fromNasal(c, ref);
} }
/**
* Convert any pointer to a SGReference based object to a ghost.
*/
template<class T>
typename boost::enable_if<boost::is_base_of<SGReferenced, T>, naRef>::type
to_nasal_helper(naContext c, T* ptr)
{
return nasal::Ghost<SGSharedPtr<T> >::create(c, SGSharedPtr<T>(ptr));
}
/**
* Convert nasal ghosts/hashes to pointer (of a SGReference based ghost).
*/
template<class T>
typename boost::enable_if<
boost::is_base_of<SGReferenced, typename boost::remove_pointer<T>::type>,
T
>::type
from_nasal_helper(naContext c, naRef ref, const T*)
{
typedef SGSharedPtr<typename boost::remove_pointer<T>::type> TypeRef;
return nasal::Ghost<TypeRef>::fromNasal(c, ref).release();
}
#endif /* SG_NASAL_GHOST_HXX_ */ #endif /* SG_NASAL_GHOST_HXX_ */
 End of changes. 21 change blocks. 
32 lines changed or deleted 61 lines changed or added


 HTTPClient.hxx   HTTPClient.hxx 
/**
* \file HTTPClient.hxx - simple HTTP client engine for SimHear
*/
// Written by James Turner
//
// Copyright (C) 2013 James Turner <zakalawe@mac.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130
1, USA.
//
#ifndef SG_HTTP_CLIENT_HXX #ifndef SG_HTTP_CLIENT_HXX
#define SG_HTTP_CLIENT_HXX #define SG_HTTP_CLIENT_HXX
#include <map> #include <memory> // for std::auto_ptr
#include <stdint.h> // for uint_64t
#include <simgear/io/HTTPRequest.hxx> #include <simgear/io/HTTPFileRequest.hxx>
#include <simgear/io/sg_netChannel.hxx> #include <simgear/io/HTTPMemoryRequest.hxx>
namespace simgear namespace simgear
{ {
namespace HTTP namespace HTTP
{ {
// forward decls
class Connection; class Connection;
class Client class Client
{ {
public: public:
Client(); Client();
~Client();
void update(int waitTimeout = 0); void update(int waitTimeout = 0);
void makeRequest(const Request_ptr& r); void makeRequest(const Request_ptr& r);
/**
* Download a resource and save it to a file.
*
* @param url The resource to download
* @param filename Path to the target file
* @param data Data for POST request
*/
FileRequestRef save( const std::string& url,
const std::string& filename );
/**
* Request a resource and keep it in memory.
*
* @param url The resource to download
*/
MemoryRequestRef load(const std::string& url);
void setUserAgent(const std::string& ua); void setUserAgent(const std::string& ua);
void setProxy(const std::string& proxy, int port, const std::string& au th = ""); void setProxy(const std::string& proxy, int port, const std::string& au th = "");
const std::string& userAgent() const /**
{ return _userAgent; } * Specify the maximum permitted simultaneous connections
* (default value is 1)
*/
void setMaxConnections(unsigned int maxCons);
const std::string& proxyHost() const const std::string& userAgent() const;
{ return _proxy; }
const std::string& proxyAuth() const const std::string& proxyHost() const;
{ return _proxyAuth; }
const std::string& proxyAuth() const;
/** /**
* predicate, check if at least one connection is active, with at * predicate, check if at least one connection is active, with at
* least one request active or queued. * least one request active or queued.
*/ */
bool hasActiveRequests() const; bool hasActiveRequests() const;
/**
* crude tracking of bytes-per-second transferred over the socket.
* suitable for user feedback and rough profiling, nothing more.
*/
unsigned int transferRateBytesPerSec() const;
/**
* total bytes downloaded by this HTTP client, for bandwidth usage
* monitoring
*/
uint64_t totalBytesDownloaded() const;
private: private:
void requestFinished(Connection* con); void requestFinished(Connection* con);
void receivedBytes(unsigned int count);
friend class Connection; friend class Connection;
friend class Request; friend class Request;
std::string _userAgent; class ClientPrivate;
std::string _proxy; std::auto_ptr<ClientPrivate> d;
int _proxyPort;
std::string _proxyAuth;
NetChannelPoller _poller;
// connections by host
typedef std::map<std::string, Connection*> ConnectionDict;
ConnectionDict _connections;
}; };
} // of namespace HTTP } // of namespace HTTP
} // of namespace simgear } // of namespace simgear
#endif // of SG_HTTP_CLIENT_HXX #endif // of SG_HTTP_CLIENT_HXX
 End of changes. 12 change blocks. 
18 lines changed or deleted 72 lines changed or added


 HTTPRequest.hxx   HTTPRequest.hxx 
#ifndef SG_HTTP_REQUEST_HXX #ifndef SG_HTTP_REQUEST_HXX
#define SG_HTTP_REQUEST_HXX #define SG_HTTP_REQUEST_HXX
#include <map> #include <map>
#include <simgear/structure/map.hxx>
#include <simgear/structure/SGReferenced.hxx> #include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/math/sg_types.hxx> #include <simgear/math/sg_types.hxx>
#include <boost/function.hpp>
class SGPropertyNode;
namespace simgear namespace simgear
{ {
namespace HTTP namespace HTTP
{ {
class Request : public SGReferenced class Request:
public SGReferenced
{ {
public: public:
typedef boost::function<void(Request*)> Callback;
enum ReadyState
{
UNSENT = 0,
OPENED,
HEADERS_RECEIVED,
LOADING,
DONE,
FAILED
};
virtual ~Request(); virtual ~Request();
/**
*
*/
StringMap& requestHeaders() { return _request_headers; }
const StringMap& requestHeaders() const { return _request_headers; }
std::string& requestHeader(const std::string& key)
{ return _request_headers[key];
}
const std::string requestHeader(const std::string& key) const
{ return _request_headers.get(k
ey); }
/**
* Set the handler to be called when the request successfully completes
.
*
* @note If the request is already complete, the handler is called
* immediately.
*/
Request* done(const Callback& cb);
/**
* Set the handler to be called when the request completes or aborts wi
th an
* error.
*
* @note If the request has already failed, the handler is called
* immediately.
*/
Request* fail(const Callback& cb);
/**
* Set the handler to be called when the request either successfully
* completes or fails.
*
* @note If the request is already complete or has already failed, the
* handler is called immediately.
*/
Request* always(const Callback& cb);
/**
* Set the data for the body of the request. The request is automatical
ly
* send using the POST method.
*
* @param data Body data
* @param type Media Type (aka MIME) of the body data
*/
void setBodyData( const std::string& data,
const std::string& type = "text/plain" );
void setBodyData( const SGPropertyNode* data );
virtual void setUrl(const std::string& url); virtual void setUrl(const std::string& url);
virtual std::string method() const virtual std::string method() const
{ return _method; } { return _method; }
virtual std::string url() const virtual std::string url() const
{ return _url; } { return _url; }
virtual std::string scheme() const; virtual std::string scheme() const;
virtual std::string path() const; virtual std::string path() const;
virtual std::string host() const; virtual std::string host() const;
virtual std::string hostAndPort() const; virtual std::string hostAndPort() const;
virtual unsigned short port() const; virtual unsigned short port() const;
virtual std::string query() const; virtual std::string query() const;
virtual string_list requestHeaders() const; StringMap const& responseHeaders() const
virtual std::string header(const std::string& name) const; { return _responseHeaders; }
virtual int responseCode() const virtual int responseCode() const
{ return _responseStatus; } { return _responseStatus; }
virtual std::string responseReason() const virtual std::string responseReason() const
{ return _responseReason; } { return _responseReason; }
void setResponseLength(unsigned int l); void setResponseLength(unsigned int l);
virtual unsigned int responseLength() const; virtual unsigned int responseLength() const;
/** /**
* Query the size of the request body. -1 (the default value) means no * Check if request contains body data.
* request body
*/ */
virtual int requestBodyLength() const; virtual bool hasBodyData() const;
/** /**
* Retrieve the body data bytes. Will be passed the maximum body bytes * Retrieve the request body content type.
* to return in the buffer, and must return the actual number
* of bytes written.
*/ */
virtual int getBodyData(char* s, int count) const; virtual std::string bodyType() const;
/** /**
* retrieve the request body content type. Default is text/plain * Retrieve the size of the request body.
*/ */
virtual std::string requestBodyType() const; virtual size_t bodyLength() const;
/**
* Retrieve the body data bytes. Will be passed the maximum body bytes
* to return in the buffer, and must return the actual number
* of bytes written.
*/
virtual size_t getBodyData(char* s, size_t offset, size_t max_count) co
nst;
/** /**
* running total of body bytes received so far. Can be used * running total of body bytes received so far. Can be used
* to generate a completion percentage, if the response length is * to generate a completion percentage, if the response length is
* known. * known.
*/ */
unsigned int responseBytesReceived() const unsigned int responseBytesReceived() const
{ return _receivedBodyBytes; } { return _receivedBodyBytes; }
enum HTTPVersion { enum HTTPVersion {
HTTP_VERSION_UNKNOWN = 0, HTTP_VERSION_UNKNOWN = 0,
HTTP_0_x, // 0.9 or similar HTTP_0_x, // 0.9 or similar
HTTP_1_0, HTTP_1_0,
HTTP_1_1 HTTP_1_1
}; };
HTTPVersion responseVersion() const HTTPVersion responseVersion() const
{ return _responseVersion; } { return _responseVersion; }
static HTTPVersion decodeVersion(const std::string& v); ReadyState readyState() const { return _ready_state; }
/**
* Request aborting this request.
*/
void abort();
/**
* Request aborting this request and specify the reported reaseon for i
t.
*/
void abort(const std::string& reason);
bool closeAfterComplete() const; bool closeAfterComplete() const;
bool isComplete() const;
protected: protected:
Request(const std::string& url, const std::string method = "GET"); Request(const std::string& url, const std::string method = "GET");
virtual void requestStart(); virtual void requestStart();
virtual void responseStart(const std::string& r); virtual void responseStart(const std::string& r);
virtual void responseHeader(const std::string& key, const std::string& value); virtual void responseHeader(const std::string& key, const std::string& value);
virtual void responseHeadersComplete(); virtual void responseHeadersComplete();
virtual void responseComplete(); virtual void responseComplete();
virtual void failed();
virtual void gotBodyData(const char* s, int n); virtual void gotBodyData(const char* s, int n);
virtual void onDone();
virtual void onFail();
virtual void onAlways();
void setFailure(int code, const std::string& reason);
private: private:
friend class Client; friend class Client;
friend class Connection; friend class Connection;
friend class ContentDecoder;
Request(const Request&); // = delete;
Request& operator=(const Request&); // = delete;
void processBodyBytes(const char* s, int n); void processBodyBytes(const char* s, int n);
void setFailure(int code, const std::string& reason); void setReadyState(ReadyState state);
std::string _method; std::string _method;
std::string _url; std::string _url;
HTTPVersion _responseVersion; StringMap _request_headers;
int _responseStatus; std::string _request_data;
std::string _responseReason; std::string _request_media_type;
unsigned int _responseLength;
unsigned int _receivedBodyBytes; HTTPVersion _responseVersion;
bool _willClose; int _responseStatus;
std::string _responseReason;
StringMap _responseHeaders;
unsigned int _responseLength;
unsigned int _receivedBodyBytes;
Callback _cb_done,
_cb_fail,
_cb_always;
typedef std::map<std::string, std::string> HeaderDict; ReadyState _ready_state;
HeaderDict _responseHeaders; bool _willClose;
}; };
typedef SGSharedPtr<Request> Request_ptr; typedef SGSharedPtr<Request> Request_ptr;
} // of namespace HTTP } // of namespace HTTP
} // of namespace simgear } // of namespace simgear
#endif // of SG_HTTP_REQUEST_HXX #endif // of SG_HTTP_REQUEST_HXX
 End of changes. 22 change blocks. 
27 lines changed or deleted 131 lines changed or added


 NasalHash.hxx   NasalHash.hxx 
skipping to change at line 90 skipping to change at line 90
* @tparam T Type to convert to (using from_nasal) * @tparam T Type to convert to (using from_nasal)
* @param name Member name * @param name Member name
*/ */
template<class T> template<class T>
T get(const std::string& name) T get(const std::string& name)
{ {
return from_nasal<T>(_context, get(name)); return from_nasal<T>(_context, get(name));
} }
/** /**
* Get member converted to callable object
*
* @tparam Sig Function signature
* @param name Member name
*/
template<class Sig>
typename boost::enable_if< boost::is_function<Sig>,
boost::function<Sig>
>::type
get(const std::string& name)
{
return from_nasal_helper(_context, get(name), static_cast<Sig*>(0))
;
}
/**
* Create a new child hash (module) * Create a new child hash (module)
* *
* @param name Name of the new hash inside this hash * @param name Name of the new hash inside this hash
*/ */
Hash createHash(const std::string& name); Hash createHash(const std::string& name);
/** /**
* Set a new Nasal context. Eg. in FlightGear the context changes eve ry * Set a new Nasal context. Eg. in FlightGear the context changes eve ry
* frame, so if using the same Hash instance for multiple frames you have * frame, so if using the same Hash instance for multiple frames you have
* to update the context before using the Hash object. * to update the context before using the Hash object.
 End of changes. 1 change blocks. 
0 lines changed or deleted 16 lines changed or added


 ODGauge.hxx   ODGauge.hxx 
skipping to change at line 56 skipping to change at line 56
/** /**
* Owner Drawn Gauge (aka render-to-texture) helper class * Owner Drawn Gauge (aka render-to-texture) helper class
*/ */
class ODGauge class ODGauge
{ {
public: public:
ODGauge(); ODGauge();
virtual ~ODGauge(); virtual ~ODGauge();
void setSystemAdapter(const SystemAdapterPtr& system_adapter);
/** /**
* Set the size of the render target. * Set the size of the render target.
* *
* @param size_x X size * @param size_x X size
* @param size_y Y size. Defaults to size_x if not specified * @param size_y Y size. Defaults to size_x if not specified
*/ */
void setSize(int size_x, int size_y = -1); void setSize(int size_x, int size_y = -1);
/** /**
* Set the size of the viewport * Set the size of the viewport
skipping to change at line 139 skipping to change at line 137
osg::Texture2D* getTexture() const { return texture.get(); } osg::Texture2D* getTexture() const { return texture.get(); }
// Real initialization function. Bad name. // Real initialization function. Bad name.
void allocRT(osg::NodeCallback* camera_cull_callback = 0); void allocRT(osg::NodeCallback* camera_cull_callback = 0);
void reinit(); void reinit();
void clear(); void clear();
protected: protected:
SystemAdapterPtr _system_adapter;
int _size_x, int _size_x,
_size_y, _size_y,
_view_width, _view_width,
_view_height; _view_height;
enum Flags enum Flags
{ {
AVAILABLE = 1, AVAILABLE = 1,
USE_IMAGE_COORDS = AVAILABLE << 1, USE_IMAGE_COORDS = AVAILABLE << 1,
USE_STENCIL = USE_IMAGE_COORDS << 1, USE_STENCIL = USE_IMAGE_COORDS << 1,
 End of changes. 2 change blocks. 
4 lines changed or deleted 0 lines changed or added


 SGBinding.hxx   SGBinding.hxx 
skipping to change at line 60 skipping to change at line 60
* @param node The binding will be built from this node. * @param node The binding will be built from this node.
*/ */
SGBinding (const SGPropertyNode * node, SGPropertyNode* root); SGBinding (const SGPropertyNode * node, SGPropertyNode* root);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~SGBinding (); virtual ~SGBinding ();
/** /**
* clear internal state of the binding back to empty. This is useful
* if you don't want the 'remove on delete' behaviour of the
* destructor.
*/
void clear();
/**
* Get the command name. * Get the command name.
* *
* @return The string name of the command for this binding. * @return The string name of the command for this binding.
*/ */
const std::string &getCommandName () const { return _command_name; } const std::string &getCommandName () const { return _command_name; }
/** /**
* Get the command itself. * Get the command itself.
* *
* @return The command associated with this binding, or 0 if none * @return The command associated with this binding, or 0 if none
skipping to change at line 148 skipping to change at line 155
* fire every binding in a list with a setting value * fire every binding in a list with a setting value
*/ */
void fireBindingListWithOffset(const SGBindingList& aBindings, double offse t, double max); void fireBindingListWithOffset(const SGBindingList& aBindings, double offse t, double max);
/** /**
* read multiple bindings from property-list format * read multiple bindings from property-list format
*/ */
SGBindingList readBindingList(const simgear::PropertyList& aNodes, SGProper tyNode* aRoot); SGBindingList readBindingList(const simgear::PropertyList& aNodes, SGProper tyNode* aRoot);
/**
* call clear() on every binding in a list
*/
void clearBindingList(const SGBindingList& aBindings);
#endif #endif
 End of changes. 2 change blocks. 
0 lines changed or deleted 12 lines changed or added


 SGBuildingBin.hxx   SGBuildingBin.hxx 
skipping to change at line 102 skipping to change at line 102
return radius; return radius;
} }
}; };
// The set of buildings that are instantiated // The set of buildings that are instantiated
typedef std::vector<Building> BuildingList; typedef std::vector<Building> BuildingList;
BuildingList smallBuildings; BuildingList smallBuildings;
BuildingList mediumBuildings; BuildingList mediumBuildings;
BuildingList largeBuildings; BuildingList largeBuildings;
std::string material_name; std::string* material_name;
std::string texture; std::string* texture;
std::string lightMap; std::string* lightMap;
// Fraction of buildings of this type // Fraction of buildings of this type
float smallBuildingFraction; float smallBuildingFraction;
float mediumBuildingFraction; float mediumBuildingFraction;
// The maximum radius of each building type // The maximum radius of each building type
float smallBuildingMaxRadius; float smallBuildingMaxRadius;
float mediumBuildingMaxRadius; float mediumBuildingMaxRadius;
float largeBuildingMaxRadius; float largeBuildingMaxRadius;
skipping to change at line 186 skipping to change at line 186
smallBuildingLocations.clear(); smallBuildingLocations.clear();
mediumBuildingLocations.clear(); mediumBuildingLocations.clear();
largeBuildingLocations.clear(); largeBuildingLocations.clear();
} }
void insert(SGVec3f p, float r, BuildingType type); void insert(SGVec3f p, float r, BuildingType type);
int getNumBuildings(); int getNumBuildings();
bool checkMinDist (SGVec3f p, float radius); bool checkMinDist (SGVec3f p, float radius);
std::string getMaterialName() { return material_name; } std::string* getMaterialName() { return material_name; }
BuildingType getBuildingType(float roll); BuildingType getBuildingType(float roll);
float getBuildingMaxRadius(BuildingType); float getBuildingMaxRadius(BuildingType);
float getBuildingMaxDepth(BuildingType); float getBuildingMaxDepth(BuildingType);
// Helper classes for creating the quad tree // Helper classes for creating the quad tree
struct MakeBuildingLeaf struct MakeBuildingLeaf
{ {
MakeBuildingLeaf(float range, Effect* effect, bool fade) : MakeBuildingLeaf(float range, Effect* effect, bool fade) :
skipping to change at line 314 skipping to change at line 314
Matrix mat; Matrix mat;
}; };
ref_ptr<Group> createBuildingsGroup(Matrix transInv, const SGReaderWriter Options* options); ref_ptr<Group> createBuildingsGroup(Matrix transInv, const SGReaderWriter Options* options);
}; };
// List of buildings // List of buildings
typedef std::list<SGBuildingBin*> SGBuildingBinList; typedef std::list<SGBuildingBin*> SGBuildingBinList;
osg::Group* createRandomBuildings(SGBuildingBinList buildinglist, const osg ::Matrix& transform, osg::Group* createRandomBuildings(SGBuildingBinList& buildinglist, const os g::Matrix& transform,
const SGReaderWriterOptions* options); const SGReaderWriterOptions* options);
} }
#endif #endif
 End of changes. 3 change blocks. 
5 lines changed or deleted 5 lines changed or added


 SGQueue.hxx   SGQueue.hxx 
skipping to change at line 388 skipping to change at line 388
/** /**
* Query the size of the queue * Query the size of the queue
* *
* @return size_t size of queue. * @return size_t size of queue.
*/ */
virtual size_t size() { virtual size_t size() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
return this->queue.size(); return this->queue.size();
} }
void waitOnNotEmpty() {
SGGuard<SGMutex> g(mutex);
while (this->queue.empty())
not_empty.wait(mutex);
}
private: private:
/** /**
* Mutex to serialise access. * Mutex to serialise access.
*/ */
SGMutex mutex; SGMutex mutex;
/** /**
* Condition to signal when queue not empty. * Condition to signal when queue not empty.
*/ */
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 SGReaderWriterOptions.hxx   SGReaderWriterOptions.hxx 
skipping to change at line 25 skipping to change at line 25
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA.
// //
#ifndef SGREADERWRITEROPTIONS_HXX #ifndef SGREADERWRITEROPTIONS_HXX
#define SGREADERWRITEROPTIONS_HXX 1 #define SGREADERWRITEROPTIONS_HXX 1
#include <osgDB/Options> #include <osgDB/Options>
#include <simgear/scene/model/modellib.hxx> #include <simgear/scene/model/modellib.hxx>
#include <simgear/scene/material/matlib.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
class SGPropertyNode; class SGPropertyNode;
class SGMaterialLib;
namespace simgear namespace simgear
{ {
class SGReaderWriterOptions : public osgDB::Options { class SGReaderWriterOptions : public osgDB::Options {
public: public:
SGReaderWriterOptions() : SGReaderWriterOptions() :
_materialLib(0), _materialLib(0),
_load_panel(0), _load_panel(0),
_model_data(0), _model_data(0),
skipping to change at line 73 skipping to change at line 74
_instantiateEffects(options._instantiateEffects) _instantiateEffects(options._instantiateEffects)
{ } { }
META_Object(simgear, SGReaderWriterOptions); META_Object(simgear, SGReaderWriterOptions);
const SGSharedPtr<SGPropertyNode>& getPropertyNode() const const SGSharedPtr<SGPropertyNode>& getPropertyNode() const
{ return _propertyNode; } { return _propertyNode; }
void setPropertyNode(const SGSharedPtr<SGPropertyNode>& propertyNode) void setPropertyNode(const SGSharedPtr<SGPropertyNode>& propertyNode)
{ _propertyNode = propertyNode; } { _propertyNode = propertyNode; }
SGMaterialLib* getMaterialLib() const SGMaterialLibPtr getMaterialLib() const
{ return _materialLib; } { return _materialLib; }
void setMaterialLib(SGMaterialLib* materialLib) void setMaterialLib(SGMaterialLib* materialLib)
{ _materialLib = materialLib; } { _materialLib = materialLib; }
typedef osg::Node *(*panel_func)(SGPropertyNode *); typedef osg::Node *(*panel_func)(SGPropertyNode *);
panel_func getLoadPanel() const panel_func getLoadPanel() const
{ return _load_panel; } { return _load_panel; }
void setLoadPanel(panel_func pf) void setLoadPanel(panel_func pf)
{ _load_panel=pf; } { _load_panel=pf; }
skipping to change at line 103 skipping to change at line 104
{ _instantiateEffects = instantiateEffects; } { _instantiateEffects = instantiateEffects; }
static SGReaderWriterOptions* copyOrCreate(const osgDB::Options* option s); static SGReaderWriterOptions* copyOrCreate(const osgDB::Options* option s);
static SGReaderWriterOptions* fromPath(const std::string& path); static SGReaderWriterOptions* fromPath(const std::string& path);
protected: protected:
virtual ~SGReaderWriterOptions(); virtual ~SGReaderWriterOptions();
private: private:
SGSharedPtr<SGPropertyNode> _propertyNode; SGSharedPtr<SGPropertyNode> _propertyNode;
SGMaterialLib* _materialLib; SGSharedPtr<SGMaterialLib> _materialLib;
osg::Node *(*_load_panel)(SGPropertyNode *); osg::Node *(*_load_panel)(SGPropertyNode *);
osg::ref_ptr<SGModelData> _model_data; osg::ref_ptr<SGModelData> _model_data;
bool _instantiateEffects; bool _instantiateEffects;
}; };
} }
#endif #endif
 End of changes. 4 change blocks. 
3 lines changed or deleted 4 lines changed or added


 SVNDirectory.hxx   SVNDirectory.hxx 
skipping to change at line 54 skipping to change at line 54
public: public:
// init from local // init from local
SVNDirectory(SVNRepository *repo, const SGPath& path); SVNDirectory(SVNRepository *repo, const SGPath& path);
~SVNDirectory(); ~SVNDirectory();
void setBaseUrl(const std::string& url); void setBaseUrl(const std::string& url);
// init from a collection // init from a collection
SVNDirectory(SVNDirectory* pr, DAVCollection* col); SVNDirectory(SVNDirectory* pr, DAVCollection* col);
// void update();
// void gotResource(HTTP::Request* get, const std::string& etag);
void requestFailed(HTTP::Request* req);
void beginUpdateReport(); void beginUpdateReport();
void updateReportComplete(); void updateReportComplete();
bool isDoingSync() const; bool isDoingSync() const;
std::string url() const; std::string url() const;
std::string name() const; std::string name() const;
DAVResource* addChildFile(const std::string& fileName); DAVResource* addChildFile(const std::string& fileName);
 End of changes. 1 change blocks. 
4 lines changed or deleted 0 lines changed or added


 SVNRepository.hxx   SVNRepository.hxx 
skipping to change at line 63 skipping to change at line 63
bool isDoingSync() const; bool isDoingSync() const;
enum ResultCode { enum ResultCode {
SVN_NO_ERROR = 0, SVN_NO_ERROR = 0,
SVN_ERROR_NOT_FOUND, SVN_ERROR_NOT_FOUND,
SVN_ERROR_SOCKET, SVN_ERROR_SOCKET,
SVN_ERROR_XML, SVN_ERROR_XML,
SVN_ERROR_TXDELTA, SVN_ERROR_TXDELTA,
SVN_ERROR_IO, SVN_ERROR_IO,
SVN_ERROR_CHECKSUM SVN_ERROR_CHECKSUM,
SVN_ERROR_FILE_NOT_FOUND,
SVN_ERROR_HTTP
}; };
ResultCode failure() const; ResultCode failure() const;
private: private:
bool isBare() const; bool isBare() const;
std::auto_ptr<SVNRepoPrivate> _d; std::auto_ptr<SVNRepoPrivate> _d;
}; };
} // of namespace simgear } // of namespace simgear
 End of changes. 1 change blocks. 
1 lines changed or deleted 3 lines changed or added


 canvas_fwd.hxx   canvas_fwd.hxx 
skipping to change at line 54 skipping to change at line 54
SG_FWD_DECL(Canvas) SG_FWD_DECL(Canvas)
SG_FWD_DECL(Element) SG_FWD_DECL(Element)
SG_FWD_DECL(Group) SG_FWD_DECL(Group)
SG_FWD_DECL(Image) SG_FWD_DECL(Image)
SG_FWD_DECL(Map) SG_FWD_DECL(Map)
SG_FWD_DECL(Path) SG_FWD_DECL(Path)
SG_FWD_DECL(Text) SG_FWD_DECL(Text)
SG_FWD_DECL(Event) SG_FWD_DECL(Event)
SG_FWD_DECL(EventListener)
SG_FWD_DECL(MouseEvent) SG_FWD_DECL(MouseEvent)
SG_FWD_DECL(Placement) SG_FWD_DECL(Placement)
SG_FWD_DECL(SystemAdapter) SG_FWD_DECL(SystemAdapter)
#undef SG_FWD_DECL #undef SG_FWD_DECL
class EventManager; class EventManager;
class EventVisitor; class EventVisitor;
typedef std::map<std::string, const SGPropertyNode*> Style; typedef std::map<std::string, const SGPropertyNode*> Style;
skipping to change at line 76 skipping to change at line 75
const SGPropertyNode_ptr&, const SGPropertyNode_ptr&,
const Style&, const Style&,
Element* ); Element* );
typedef osg::ref_ptr<osgText::Font> FontPtr; typedef osg::ref_ptr<osgText::Font> FontPtr;
typedef std::vector<PlacementPtr> Placements; typedef std::vector<PlacementPtr> Placements;
typedef boost::function<Placements( SGPropertyNode*, typedef boost::function<Placements( SGPropertyNode*,
CanvasPtr )> PlacementFactory; CanvasPtr )> PlacementFactory;
typedef boost::function<void(const EventPtr&)> EventListener;
} // namespace canvas } // namespace canvas
} // namespace simgear } // namespace simgear
#endif /* SG_CANVAS_FWD_HXX_ */ #endif /* SG_CANVAS_FWD_HXX_ */
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 commands.hxx   commands.hxx 
skipping to change at line 18 skipping to change at line 18
*/ */
#ifndef __COMMANDS_HXX #ifndef __COMMANDS_HXX
#define __COMMANDS_HXX #define __COMMANDS_HXX
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <string> #include <string>
#include <map> #include <map>
#include <simgear/threads/SGThread.hxx>
#include <simgear/math/sg_types.hxx> #include <simgear/math/sg_types.hxx>
// forward decls // forward decls
class SGPropertyNode; class SGPropertyNode;
/** /**
* Manage commands. * Manage commands.
* *
* <p>This class allows the application to register and unregister * <p>This class allows the application to register and unregister
* commands, and provides shortcuts for executing them. Commands are * commands, and provides shortcuts for executing them. Commands are
skipping to change at line 88 skipping to change at line 87
* Helper template functions. * Helper template functions.
*/ */
template< class ObjPtr, typename MemFn > template< class ObjPtr, typename MemFn >
Command* make_functor( const ObjPtr& pObj, MemFn pMemFn ) Command* make_functor( const ObjPtr& pObj, MemFn pMemFn )
{ {
return new MethodCommand<ObjPtr,MemFn>(pObj, pMemFn ); return new MethodCommand<ObjPtr,MemFn>(pObj, pMemFn );
} }
public: public:
/**
* Default constructor (sets instance to created item)
*/
SGCommandMgr ();
/** /**
* Destructor. * Destructor. (sets instance to NULL)
*/ */
virtual ~SGCommandMgr (); virtual ~SGCommandMgr ();
/**
* Implement the classical singleton.
*/
static SGCommandMgr* instance(); static SGCommandMgr* instance();
/** /**
* Register a new command with the manager. * Register a new command with the manager.
* *
* @param name The command name. Any existing command with * @param name The command name. Any existing command with
* the same name will silently be overwritten. * the same name will silently be overwritten.
* @param command A pointer to a one-arg function returning * @param command A pointer to a one-arg function returning
* a bool result. The argument is always a const pointer to * a bool result. The argument is always a const pointer to
* an SGPropertyNode (which may contain multiple values). * an SGPropertyNode (which may contain multiple values).
skipping to change at line 148 skipping to change at line 148
* *
* @param name The name of the command. * @param name The name of the command.
* @param arg A const pointer to an SGPropertyNode. The node * @param arg A const pointer to an SGPropertyNode. The node
* may have a value and/or children, etc., so that it is possible * may have a value and/or children, etc., so that it is possible
* to pass an arbitrarily complex data structure to a command. * to pass an arbitrarily complex data structure to a command.
* @return true if the command is present and executes successfully, * @return true if the command is present and executes successfully,
* false otherwise. * false otherwise.
*/ */
virtual bool execute (const std::string &name, const SGPropertyNode * arg ) const; virtual bool execute (const std::string &name, const SGPropertyNode * arg ) const;
protected:
/** /**
* Default constructor. * Remove a command registration
*/ */
SGCommandMgr (); bool removeCommand(const std::string& name);
protected:
private: private:
typedef std::map<std::string,Command*> command_map; typedef std::map<std::string,Command*> command_map;
command_map _commands; command_map _commands;
static SGMutex _instanceMutex;
}; };
#endif // __COMMANDS_HXX #endif // __COMMANDS_HXX
// end of commands.hxx // end of commands.hxx
 End of changes. 8 change blocks. 
10 lines changed or deleted 8 lines changed or added


 easyxml.hxx   easyxml.hxx 
skipping to change at line 18 skipping to change at line 18
#ifndef __EASYXML_HXX #ifndef __EASYXML_HXX
#define __EASYXML_HXX #define __EASYXML_HXX
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
using std::istream; typedef struct XML_ParserStruct* XML_Parser;
using std::string;
using std::vector;
/** /**
* Interface for XML attributes. * Interface for XML attributes.
* *
* This interface is used to provide a list of attributes to the * This interface is used to provide a list of attributes to the
* application. The interface is a pure abstract class so that * application. The interface is a pure abstract class so that
* different implementations can be substituted for the sake of * different implementations can be substituted for the sake of
* efficiency. * efficiency.
* *
* @see XMLAttributesDefault * @see XMLAttributesDefault
skipping to change at line 205 skipping to change at line 203
* This method will not extend the list; the attribute must * This method will not extend the list; the attribute must
* already exist. * already exist.
* *
* @param name The name of the attribute that will have the new * @param name The name of the attribute that will have the new
* value. * value.
* @param value The new value. * @param value The new value.
*/ */
virtual void setValue (const char * name, const char * value); virtual void setValue (const char * name, const char * value);
private: private:
vector<string> _atts; std::vector<std::string> _atts;
}; };
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Attribute list wrapper for Expat. // Attribute list wrapper for Expat.
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
class ExpatAtts : public XMLAttributes class ExpatAtts : public XMLAttributes
{ {
public: public:
ExpatAtts (const char ** atts) : _atts(atts) {} ExpatAtts (const char ** atts) : _atts(atts) {}
skipping to change at line 240 skipping to change at line 238
* through the XML document and invokes the appropriate method in * through the XML document and invokes the appropriate method in
* this visitor for each piece of markup it finds. By default, * this visitor for each piece of markup it finds. By default,
* the methods do nothing; the application must subclass the visitor * the methods do nothing; the application must subclass the visitor
* and override the methods for the events it's interested in. * and override the methods for the events it's interested in.
* All applications are required to provide an implementation * All applications are required to provide an implementation
* for the {@link #error} callback. * for the {@link #error} callback.
*/ */
class XMLVisitor class XMLVisitor
{ {
public: public:
/// Constructor
XMLVisitor() : parser(0), line(-1), column(-1) {}
/** /**
* Virtual destructor. * Virtual destructor.
*/ */
virtual ~XMLVisitor () {} virtual ~XMLVisitor () {}
/** /**
* Callback for the start of an XML document. * Callback for the start of an XML document.
* *
* The XML parser will invoke this method once, at the beginning of * The XML parser will invoke this method once, at the beginning of
skipping to change at line 349 skipping to change at line 349
* The XML parser will use this callback to report any non-fatal warnings * The XML parser will use this callback to report any non-fatal warnings
* during parsing. It is the responsibility of the application to * during parsing. It is the responsibility of the application to
* deal with the warning in some appropriate way. * deal with the warning in some appropriate way.
* *
* @param message The warning message from the parser. * @param message The warning message from the parser.
* @param line The number of the line that generated the warning. * @param line The number of the line that generated the warning.
* @param column The character position in the line that generated * @param column The character position in the line that generated
* the warning. * the warning.
*/ */
virtual void warning (const char * message, int line, int column) {} virtual void warning (const char * message, int line, int column) {}
/** Set the path to the file that is parsed.
*
* This method will be called to store the path to the parsed file. Note
that
* the XML parser makes no use of this copy of the path. The intent is
* to be capable of refering to the path to the parsed file if needed.
*
* @param _path The path to the parsed file.
* @see #getPath
*/
void setPath(const std::string& _path) { path = _path; }
/** Get the path to the parsed file.
*
* This method will be called if the application needs to access the path
to
* the parsed file. This information is typically needed if an error is f
ound
* so the file where it occurred can be retrieved to help the user locate
the
* error.
*
* @return the path to the parsed file.
* @see #setPath
*/
const std::string& getPath(void) const { return path; }
/** Save the current position in the parsed file.
*
* This method will be called to save the position at which the file is
* currently parsed. Note that the XML parser makes no use of that
* information. The intent is to be capable of refering to the position i
n
* the parsed file if needed.
*
* @see #getColumn
* @see #getLine
*/
void savePosition(void);
/** Get the saved column number in the parsed file.
*
* This method will be called if the application needs to get the column
* number that has been saved during the last call to savePosition(). Thi
s
* information is typically needed if an error is found so the position a
t
* which it occurred can be retrieved to help the user locate the error.
*
* @return the save column number.
* @see #savePosition
*/
int getColumn(void) const { return column; }
/** Get the saved line number in the parsed file.
*
* This method will be called if the application needs to get the line
* number that has been saved during the last call to savePosition(). Thi
s
* information is typically needed if an error is found so the position a
t
* which it occurred can be retrieved to help the user locate the error.
*
* @return the save line number.
* @see #savePosition
*/
int getLine(void) const { return line; }
/** Set the XML parser.
*
* This method will be called so the #XMLVisitor instance can internally
use
* the XML parser for its housekeeping. The intent is that #XMLVisitor wi
ll
* only call the reporting functions of the XML parser and will not inter
fer
* with the XML parser current state. Doing otherwise will result in an
* unpredictable behavior of the XML parser.
*
* @param _parser the XML parser
*/
void setParser(XML_Parser _parser) { parser = _parser; }
private:
XML_Parser parser;
std::string path;
int line, column;
}; };
/** /**
* @relates XMLVisitor * @relates XMLVisitor
* Read an XML document. * Read an XML document.
* *
* This function reads an XML document from the input stream provided, * This function reads an XML document from the input stream provided,
* and invokes the callback methods in the visitor object to pass the * and invokes the callback methods in the visitor object to pass the
* parsing events back to the application. When this function * parsing events back to the application. When this function
* returns, the parser will have reported all of the data in the XML * returns, the parser will have reported all of the data in the XML
skipping to change at line 370 skipping to change at line 445
* and XML processing will be complete. * and XML processing will be complete.
* *
* @param input The byte input stream containing the XML document. * @param input The byte input stream containing the XML document.
* @param visitor An object that contains callbacks for XML parsing * @param visitor An object that contains callbacks for XML parsing
* events. * events.
* @param path A string describing the original path of the resource. * @param path A string describing the original path of the resource.
* @exception Throws sg_io_exception or sg_xml_exception if there * @exception Throws sg_io_exception or sg_xml_exception if there
* is a problem reading the file. * is a problem reading the file.
* @see XMLVisitor * @see XMLVisitor
*/ */
extern void readXML (istream &input, XMLVisitor &visitor, extern void readXML (std::istream &input, XMLVisitor &visitor,
const string &path=""); const std::string &path="");
/** /**
* @relates XMLVisitor * @relates XMLVisitor
* Read an XML document. * Read an XML document.
* *
* This function reads an XML document from the input stream provided, * This function reads an XML document from the input stream provided,
* and invokes the callback methods in the visitor object to pass the * and invokes the callback methods in the visitor object to pass the
* parsing events back to the application. When this function * parsing events back to the application. When this function
* returns, the parser will have reported all of the data in the XML * returns, the parser will have reported all of the data in the XML
* document to the application through the visitor callback methods, * document to the application through the visitor callback methods,
* and XML processing will be complete. * and XML processing will be complete.
* *
* @param path The file name of the XML resource. * @param path The file name of the XML resource.
* @param visitor An object that contains callbacks for XML parsing * @param visitor An object that contains callbacks for XML parsing
* events. * events.
* @exception Throws sg_io_exception or sg_xml_exception if there * @exception Throws sg_io_exception or sg_xml_exception if there
* is a problem reading the file. * is a problem reading the file.
* @see XMLVisitor * @see XMLVisitor
*/ */
extern void readXML (const string &path, XMLVisitor &visitor); extern void readXML (const std::string &path, XMLVisitor &visitor);
/** /**
* @relates XMLVisitor * @relates XMLVisitor
* Read an XML document. * Read an XML document.
* *
* This function reads an XML document from the buffer provided, * This function reads an XML document from the buffer provided,
* and invokes the callback methods in the visitor object to pass the * and invokes the callback methods in the visitor object to pass the
* parsing events back to the application. When this function * parsing events back to the application. When this function
* returns, the parser will have reported all of the data in the XML * returns, the parser will have reported all of the data in the XML
* document to the application through the visitor callback methods, * document to the application through the visitor callback methods,
 End of changes. 6 change blocks. 
7 lines changed or deleted 94 lines changed or added


 event_mgr.hxx   event_mgr.hxx 
skipping to change at line 28 skipping to change at line 28
SGCallback* callback; SGCallback* callback;
bool repeat; bool repeat;
bool running; bool running;
}; };
class SGTimerQueue { class SGTimerQueue {
public: public:
SGTimerQueue(int preSize=1); SGTimerQueue(int preSize=1);
~SGTimerQueue(); ~SGTimerQueue();
void clear();
void update(double deltaSecs); void update(double deltaSecs);
double now() { return _now; } double now() { return _now; }
void insert(SGTimer* timer, double time); void insert(SGTimer* timer, double time);
SGTimer* remove(SGTimer* timer); SGTimer* remove(SGTimer* timer);
SGTimer* remove(); SGTimer* remove();
SGTimer* nextTimer() { return _numEntries ? _table[0].timer : 0; } SGTimer* nextTimer() { return _numEntries ? _table[0].timer : 0; }
double nextTime() { return -_table[0].pri; } double nextTime() { return -_table[0].pri; }
skipping to change at line 71 skipping to change at line 72
double _now; double _now;
HeapEntry *_table; HeapEntry *_table;
int _numEntries; int _numEntries;
int _tableSize; int _tableSize;
}; };
class SGEventMgr : public SGSubsystem class SGEventMgr : public SGSubsystem
{ {
public: public:
SGEventMgr() { _rtProp = 0; } SGEventMgr();
~SGEventMgr() { _rtProp = 0; } ~SGEventMgr();
virtual void init() {} virtual void init() {}
virtual void update(double delta_time_sec); virtual void update(double delta_time_sec);
virtual void unbind();
virtual void shutdown();
void setRealtimeProperty(SGPropertyNode* node) { _rtProp = node; } void setRealtimeProperty(SGPropertyNode* node) { _rtProp = node; }
/** /**
* Add a single function callback event as a repeating task. * Add a single function callback event as a repeating task.
* ex: addTask("foo", &Function ... ) * ex: addTask("foo", &Function ... )
*/ */
template<typename FUNC> template<typename FUNC>
inline void addTask(const std::string& name, const FUNC& f, inline void addTask(const std::string& name, const FUNC& f,
double interval, double delay=0, bool sim=false) double interval, double delay=0, bool sim=false)
 End of changes. 3 change blocks. 
2 lines changed or deleted 5 lines changed or added


 from_nasal_helper.hxx   from_nasal_helper.hxx 
skipping to change at line 26 skipping to change at line 26
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA
#ifndef SG_FROM_NASAL_HELPER_HXX_ #ifndef SG_FROM_NASAL_HELPER_HXX_
#define SG_FROM_NASAL_HELPER_HXX_ #define SG_FROM_NASAL_HELPER_HXX_
#include "nasal_traits.hxx" #include "nasal_traits.hxx"
#include <simgear/nasal/nasal.h> #include <simgear/nasal/nasal.h>
#include <simgear/nasal/cppbind/NasalObjectHolder.hxx>
#include <simgear/nasal/cppbind/to_nasal.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
#include <boost/utility/enable_if.hpp> #include <boost/bind.hpp>
#include <boost/call_traits.hpp>
#include <boost/function.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/type_traits.hpp> #include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>
#include <string> #include <string>
#include <typeinfo> // std::bad_cast
#include <vector> #include <vector>
class SGPath; class SGPath;
namespace nasal namespace nasal
{ {
class Hash; class Hash;
class String; class String;
/** /**
* Thrown when converting a type from/to Nasal has failed * Thrown when converting a type from/to Nasal has failed
*/ */
class bad_nasal_cast: class bad_nasal_cast:
public std::bad_cast,
public sg_exception public sg_exception
{ {
public: public:
/** /**
* Construct with generic error message * Construct with generic error message
*/ */
bad_nasal_cast(); bad_nasal_cast();
/** /**
* Construct from an error message * Construct from an error message
skipping to change at line 102 skipping to change at line 108
String from_nasal_helper(naContext c, naRef ref, const String*); String from_nasal_helper(naContext c, naRef ref, const String*);
/** /**
* Convert a Nasal object to bool. * Convert a Nasal object to bool.
* *
* @return true, if ref is string or ref is number != 0 * @return true, if ref is string or ref is number != 0
* false, else * false, else
*/ */
bool from_nasal_helper(naContext c, naRef ref, const bool*); bool from_nasal_helper(naContext c, naRef ref, const bool*);
namespace detail
{
#define SG_BOOST_FUNCTION_FROM_NASAL_FWD
#define BOOST_PP_ITERATION_LIMITS (0, 9)
#define BOOST_PP_FILENAME_1 <simgear/nasal/cppbind/detail/from_nasal_functi
on_templates.hxx>
#include BOOST_PP_ITERATE()
#undef SG_BOOST_FUNCTION_FROM_NASAL_FWD
}
/**
* Convert a Nasal function to a boost::function with the given signature
.
*
* @tparam Sig Signature of returned function (arguments and return va
lue
* are automatically converted using from_nasal/to_nasal)
*/
template<class Sig>
boost::function<Sig>
from_nasal_helper(naContext c, naRef ref, boost::function<Sig>*)
{
if( !naIsCode(ref)
&& !naIsCCode(ref)
&& !naIsFunc(ref) )
throw bad_nasal_cast("not a function");
return detail::boostFunctionFromNasal(ref, static_cast<Sig*>(0));
}
template<class Sig>
typename boost::enable_if< boost::is_function<Sig>,
boost::function<Sig>
>::type
from_nasal_helper(naContext c, naRef ref, Sig*)
{
return from_nasal_helper(c, ref, static_cast<boost::function<Sig>*>(0))
;
}
/** /**
* Convert a Nasal number to a C++ numeric type * Convert a Nasal number to a C++ numeric type
*/ */
template<class T> template<class T>
typename boost::enable_if< boost::is_arithmetic<T>, typename boost::enable_if< boost::is_arithmetic<T>,
T T
>::type >::type
from_nasal_helper(naContext c, naRef ref, const T*) from_nasal_helper(naContext c, naRef ref, const T*)
{ {
naRef num = naNumValue(ref); naRef num = naNumValue(ref);
skipping to change at line 151 skipping to change at line 193
typename boost::enable_if<is_vec2<Vec2>, Vec2>::type typename boost::enable_if<is_vec2<Vec2>, Vec2>::type
from_nasal_helper(naContext c, naRef ref, const Vec2*) from_nasal_helper(naContext c, naRef ref, const Vec2*)
{ {
std::vector<double> vec = std::vector<double> vec =
from_nasal_helper(c, ref, static_cast<std::vector<double>*>(0)); from_nasal_helper(c, ref, static_cast<std::vector<double>*>(0));
if( vec.size() != 2 ) if( vec.size() != 2 )
throw bad_nasal_cast("Expected vector with two elements"); throw bad_nasal_cast("Expected vector with two elements");
return Vec2(vec[0], vec[1]); return Vec2(vec[0], vec[1]);
} }
// Helpers for wrapping calls to Nasal functions into boost::function
namespace detail
{
#define BOOST_PP_ITERATION_LIMITS (0, 9)
#define BOOST_PP_FILENAME_1 <simgear/nasal/cppbind/detail/from_nasal_functi
on_templates.hxx>
#include BOOST_PP_ITERATE()
}
} // namespace nasal } // namespace nasal
#endif /* SG_FROM_NASAL_HELPER_HXX_ */ #endif /* SG_FROM_NASAL_HELPER_HXX_ */
 End of changes. 8 change blocks. 
3 lines changed or deleted 58 lines changed or added


 logstream.hxx   logstream.hxx 
skipping to change at line 45 skipping to change at line 45
namespace simgear namespace simgear
{ {
class LogCallback class LogCallback
{ {
public: public:
virtual ~LogCallback() {} virtual ~LogCallback() {}
virtual void operator()(sgDebugClass c, sgDebugPriority p, virtual void operator()(sgDebugClass c, sgDebugPriority p,
const char* file, int line, const std::string& aMessage) = 0; const char* file, int line, const std::string& aMessage) = 0;
void setLogLevels(sgDebugClass c, sgDebugPriority p);
protected:
LogCallback(sgDebugClass c, sgDebugPriority p);
bool shouldLog(sgDebugClass c, sgDebugPriority p) const;
private:
sgDebugClass m_class;
sgDebugPriority m_priority;
}; };
/**
* Helper force a console on platforms where it might optional, when
* we need to show a console. This basically means Windows at the
* moment - on other plaforms it's a no-op
*/
void requestConsole();
} // of namespace simgear } // of namespace simgear
/** /**
* Class to manage the debug logging stream. * Class to manage the debug logging stream.
*/ */
class logstream class logstream
{ {
public: public:
static void initGlobalLogstream(); static void initGlobalLogstream();
/** /**
 End of changes. 2 change blocks. 
0 lines changed or deleted 16 lines changed or added


 lowleveltime.h   lowleveltime.h 
skipping to change at line 44 skipping to change at line 44
#define _LOWLEVELTIME_H_ #define _LOWLEVELTIME_H_
#include <time.h> #include <time.h>
/* adapted from zdump.c */ /* adapted from zdump.c */
void show (const char *zone, time_t t, int v); void show (const char *zone, time_t t, int v);
/* adapted from <time.h> */ /* adapted from <time.h> */
struct tm * fgLocaltime (const time_t *t, const char *tzName); struct tm * fgLocaltime (const time_t *t, const char *tzName);
/* version of time() which returns a value in GMT/UTC, without
any timezone adjustment. Necessary on Windows where calling time()
returns a value in the local time-zone. */
time_t sgGMTime();
/* Prototype for the internal function to get information based on TZ. */ /* Prototype for the internal function to get information based on TZ. */
extern struct tm *fgtz_convert (const time_t *t, int use_localtime, extern struct tm *fgtz_convert (const time_t *t, int use_localtime,
struct tm *tp, const char *tzName); struct tm *tp, const char *tzName);
/* This structure contains all the information about a /* This structure contains all the information about a
timezone given in the POSIX standard TZ envariable. */ timezone given in the POSIX standard TZ envariable. */
typedef struct typedef struct
{ {
const char *name; const char *name;
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 mat.hxx   mat.hxx 
skipping to change at line 45 skipping to change at line 45
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <osg/Texture2D> #include <osg/Texture2D>
namespace osg namespace osg
{ {
class StateSet; class StateSet;
} }
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/threads/SGThread.hxx> // for SGMutex
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
#include <simgear/bvh/BVHMaterial.hxx> #include <simgear/bvh/BVHMaterial.hxx>
namespace simgear namespace simgear
{ {
class Effect; class Effect;
void reload_shaders(); void reload_shaders();
class SGReaderWriterOptions; class SGReaderWriterOptions;
} }
skipping to change at line 465 skipping to change at line 466
// Object mask, a simple RGB texture used as a mask when placing // Object mask, a simple RGB texture used as a mask when placing
// random vegetation, objects and buildings // random vegetation, objects and buildings
std::vector<osg::Texture2D*> _masks; std::vector<osg::Texture2D*> _masks;
// Condition, indicating when this material is active // Condition, indicating when this material is active
SGSharedPtr<const SGCondition> condition; SGSharedPtr<const SGCondition> condition;
// Parameters from the materials file // Parameters from the materials file
const SGPropertyNode* parameters; const SGPropertyNode* parameters;
// per-material lock for entrypoints called from multiple threads
SGMutex _lock;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Internal constructors and methods. // Internal constructors and methods.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void read_properties(const simgear::SGReaderWriterOptions* options, void read_properties(const simgear::SGReaderWriterOptions* options,
const SGPropertyNode *props, const SGPropertyNode *props,
SGPropertyNode *prop_root); SGPropertyNode *prop_root);
void buildEffectProperties(const simgear::SGReaderWriterOptions* options) ; void buildEffectProperties(const simgear::SGReaderWriterOptions* options) ;
simgear::Effect* get_effect(int i); simgear::Effect* get_effect(int i);
}; };
 End of changes. 2 change blocks. 
0 lines changed or deleted 4 lines changed or added


 matlib.hxx   matlib.hxx 
skipping to change at line 28 skipping to change at line 28
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA.
// //
// $Id$ // $Id$
#ifndef _MATLIB_HXX #ifndef _MATLIB_HXX
#define _MATLIB_HXX #define _MATLIB_HXX
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#include <memory>
#include <string> // Standard C++ string library #include <string> // Standard C++ string library
#include <map> // STL associative "array" #include <map> // STL associative "array"
#include <vector> // STL "array" #include <vector> // STL "array"
class SGMaterial; class SGMaterial;
class SGPropertyNode; class SGPropertyNode;
namespace simgear { class Effect; } namespace simgear { class Effect; }
namespace osg { class Geode; } namespace osg { class Geode; }
// Material management class // Material management class
class SGMaterialLib { class SGMaterialLib : public SGReferenced
{
private: private:
class MatLibPrivate;
std::auto_ptr<MatLibPrivate> d;
// associative array of materials // associative array of materials
typedef std::vector< SGSharedPtr<SGMaterial> > material_list; typedef std::vector< SGSharedPtr<SGMaterial> > material_list;
typedef material_list::iterator material_list_iterator; typedef material_list::iterator material_list_iterator;
typedef std::map < std::string, material_list> material_map; typedef std::map < std::string, material_list> material_map;
typedef material_map::iterator material_map_iterator; typedef material_map::iterator material_map_iterator;
typedef material_map::const_iterator const_material_map_iterator; typedef material_map::const_iterator const_material_map_iterator;
material_map matlib; material_map matlib;
typedef std::map < std::string, SGSharedPtr<SGMaterial> > active_materi
al_cache;
active_material_cache active_cache;
public: public:
// Constructor // Constructor
SGMaterialLib ( void ); SGMaterialLib ( void );
// Load a library of material properties // Load a library of material properties
bool load( const std::string &fg_root, const std::string& mpath, bool load( const std::string &fg_root, const std::string& mpath,
SGPropertyNode *prop_root ); SGPropertyNode *prop_root );
// find a material record by material name // find a material record by material name
SGMaterial *find( const std::string& material ); SGMaterial *find( const std::string& material ) const;
/**
* Material lookup involves evaluation of SGConditions to determine whi
ch
* possible material (by season, region, etc) is valid. This involves
* vproperty tree queries, so repeated calls to find() can cause
* race conditions when called from the osgDB pager thread. (especially
* during startup)
*
* To fix this, and also avoid repeated re-evaluation of the material
* conditions, we provide a version which uses a cached, threadsafe tab
le
* of the currently valid materials. The main thread calls the refresh
* method below to evaluate the valid materials, and findCached can be
* safely called from other threads with no access to unprotected state
.
*/
SGMaterial *findCached( const std::string& material ) const;
void refreshActiveMaterials();
material_map_iterator begin() { return matlib.begin(); } material_map_iterator begin() { return matlib.begin(); }
const_material_map_iterator begin() const { return matlib.begin(); } const_material_map_iterator begin() const { return matlib.begin(); }
material_map_iterator end() { return matlib.end(); } material_map_iterator end() { return matlib.end(); }
const_material_map_iterator end() const { return matlib.end(); } const_material_map_iterator end() const { return matlib.end(); }
static const SGMaterial *findMaterial(const osg::Geode* geode); static const SGMaterial *findMaterial(const osg::Geode* geode);
// Destructor // Destructor
~SGMaterialLib ( void ); ~SGMaterialLib ( void );
}; };
typedef SGSharedPtr<SGMaterialLib> SGMaterialLibPtr;
#endif // _MATLIB_HXX #endif // _MATLIB_HXX
 End of changes. 8 change blocks. 
2 lines changed or deleted 33 lines changed or added


 modellib.hxx   modellib.hxx 
skipping to change at line 49 skipping to change at line 49
/** /**
* Class for loading and managing models with XML wrappers. * Class for loading and managing models with XML wrappers.
*/ */
class SGModelLib class SGModelLib
{ {
public: public:
typedef osg::Node *(*panel_func)(SGPropertyNode *); typedef osg::Node *(*panel_func)(SGPropertyNode *);
static void init(const std::string &root_dir, SGPropertyNode* root); static void init(const std::string &root_dir, SGPropertyNode* root);
static void resetPropertyRoot();
static void setPanelFunc(panel_func pf); static void setPanelFunc(panel_func pf);
// Load a 3D model (any format) // Load a 3D model (any format)
// data->modelLoaded() will be called after the model is loaded // data->modelLoaded() will be called after the model is loaded
static osg::Node* loadModel(const std::string &path, static osg::Node* loadModel(const std::string &path,
SGPropertyNode *prop_root = NULL, SGPropertyNode *prop_root = NULL,
SGModelData *data=0, bool load2DPanels=fals e); SGModelData *data=0, bool load2DPanels=fals e);
// Load a 3D model (any format) through the DatabasePager. // Load a 3D model (any format) through the DatabasePager.
// This function initially just returns a proxy node that refers to // This function initially just returns a proxy node that refers to
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 nasal.h   nasal.h 
skipping to change at line 45 skipping to change at line 45
naContext naSubContext(naContext super); naContext naSubContext(naContext super);
// The naContext supports a user data pointer that can be used to // The naContext supports a user data pointer that can be used to
// store data specific to an naCall invocation without exposing it to // store data specific to an naCall invocation without exposing it to
// Nasal as a ghost. FIXME: this API is semi-dangerous, there is no // Nasal as a ghost. FIXME: this API is semi-dangerous, there is no
// provision for sharing it, nor for validating the source or type of // provision for sharing it, nor for validating the source or type of
// the pointer returned. // the pointer returned.
void naSetUserData(naContext c, void* p); void naSetUserData(naContext c, void* p);
void* naGetUserData(naContext c) GCC_PURE; void* naGetUserData(naContext c) GCC_PURE;
// run GC now (may block)
void naGC();
// "Save" this object in the context, preventing it (and objects // "Save" this object in the context, preventing it (and objects
// referenced by it) from being garbage collected. // referenced by it) from being garbage collected.
// TODO do we need a context? It is not used anyhow...
void naSave(naContext ctx, naRef obj); void naSave(naContext ctx, naRef obj);
// "Save" this object and get a key which allows do mark the object as free
// later on (with naGCFree).
int naGCSave(naRef obj);
// Release an object previously passed to naGCSave to allow it being cleane
d up
// by the garbage collector.
void naGCRelease(int key);
// Drop all saved references
void naClearSaved();
// Similar, but the object is automatically released when the // Similar, but the object is automatically released when the
// context next runs native bytecode. Useful for saving off C-space // context next runs native bytecode. Useful for saving off C-space
// temporaries to protect them before passing back into a naCall. // temporaries to protect them before passing back into a naCall.
void naTempSave(naContext c, naRef r); void naTempSave(naContext c, naRef r);
// Parse a buffer in memory into a code object. The srcFile parameter // Parse a buffer in memory into a code object. The srcFile parameter
// is a Nasal string representing the "file" from which the code is // is a Nasal string representing the "file" from which the code is
// read. The "first line" is typically 1, but is settable for // read. The "first line" is typically 1, but is settable for
// situations where the Nasal code is embedded in another context with // situations where the Nasal code is embedded in another context with
// its own numbering convetions. If an error occurs, returns nil and // its own numbering convetions. If an error occurs, returns nil and
skipping to change at line 91 skipping to change at line 106
naRef obj, naRef locals); naRef obj, naRef locals);
// As naCall(), but continues execution at the operation after a // As naCall(), but continues execution at the operation after a
// previous die() call or runtime error. Useful to do "yield" // previous die() call or runtime error. Useful to do "yield"
// semantics, leaving the context in a condition where it can be // semantics, leaving the context in a condition where it can be
// restarted from C code. Cannot be used currently to restart a // restarted from C code. Cannot be used currently to restart a
// failed operation. Will attempt to acquire the mod lock, so call // failed operation. Will attempt to acquire the mod lock, so call
// naModUnlock() first if the lock is already held. // naModUnlock() first if the lock is already held.
naRef naContinue(naContext ctx); naRef naContinue(naContext ctx);
// Does a naCall() in a given context. Wrapped here to make lock
// tracking easier. Extension functions are called with the lock, but
// we have to release it before making a new naCall(). So rather than
// drop the lock in every extension function that might call back into
// Nasal, we keep a stack depth counter here and only unlock/lock
// around the naCall if it isn't the first one.
naRef naCallMethodCtx( naContext ctx,
naRef code,
naRef self,
int argc,
naRef* args,
naRef locals );
// Same as naCallMethodCtx but creates (and afterwards destroyes) a new con
text
naRef naCallMethod(naRef code, naRef self, int argc, naRef* args, naRef loc
als);
typedef void (*naErrorHandler)(naContext);
// Register a handler to be called if an error is raised during the executi
on of
// naCallMethodCtx or naCallMethod.
naErrorHandler naSetErrorHandler(naErrorHandler cb);
// Throw an error from the current call stack. This function makes a // Throw an error from the current call stack. This function makes a
// longjmp call to a handler in naCall() and DOES NOT RETURN. It is // longjmp call to a handler in naCall() and DOES NOT RETURN. It is
// intended for use in library code that cannot otherwise report an // intended for use in library code that cannot otherwise report an
// error via the return value, and MUST be used carefully. If in // error via the return value, and MUST be used carefully. If in
// doubt, return naNil() as your error condition. Works like // doubt, return naNil() as your error condition. Works like
// printf(). // printf().
void naRuntimeError(naContext c, const char* fmt, ...); void naRuntimeError(naContext c, const char* fmt, ...);
// "Re-throws" a runtime error caught from the subcontext. Acts as a // "Re-throws" a runtime error caught from the subcontext. Acts as a
// naRuntimeError() called on the parent context. Does not return. // naRuntimeError() called on the parent context. Does not return.
 End of changes. 4 change blocks. 
0 lines changed or deleted 41 lines changed or added


 placement.hxx   placement.hxx 
skipping to change at line 43 skipping to change at line 43
* A wrapper for a model with a definite placement. * A wrapper for a model with a definite placement.
*/ */
class SGModelPlacement class SGModelPlacement
{ {
public: public:
SGModelPlacement (); SGModelPlacement ();
virtual ~SGModelPlacement (); virtual ~SGModelPlacement ();
virtual void init( osg::Node* model ); virtual void init( osg::Node* model );
void clear();
void add( osg::Node* model );
virtual void update(); virtual void update();
virtual osg::Node* getSceneGraph () { return _selector.get(); } virtual osg::Node* getSceneGraph () { return _selector.get(); }
virtual bool getVisible () const; virtual bool getVisible () const;
virtual void setVisible (bool visible); virtual void setVisible (bool visible);
virtual double getLongitudeDeg () const { return _position.getLongitudeDe
g(); }
virtual double getLatitudeDeg () const { return _position.getLatitudeDeg(
); }
virtual double getElevationFt () const { return _position.getElevationFt(
); }
virtual void setLongitudeDeg (double lon_deg);
virtual void setLatitudeDeg (double lat_deg);
virtual void setElevationFt (double elev_ft);
virtual void setPosition (double lon_deg, double lat_deg, double elev_ft)
;
void setPosition(const SGGeod& position); void setPosition(const SGGeod& position);
const SGGeod& getPosition() const { return _position; } const SGGeod& getPosition() const { return _position; }
virtual double getRollDeg () const { return _roll_deg; } virtual double getRollDeg () const { return _roll_deg; }
virtual double getPitchDeg () const { return _pitch_deg; } virtual double getPitchDeg () const { return _pitch_deg; }
virtual double getHeadingDeg () const { return _heading_deg; } virtual double getHeadingDeg () const { return _heading_deg; }
virtual void setRollDeg (double roll_deg); virtual void setRollDeg (double roll_deg);
virtual void setPitchDeg (double pitch_deg); virtual void setPitchDeg (double pitch_deg);
virtual void setHeadingDeg (double heading_deg); virtual void setHeadingDeg (double heading_deg);
 End of changes. 2 change blocks. 
12 lines changed or deleted 2 lines changed or added


 precipitation.hxx   precipitation.hxx 
skipping to change at line 44 skipping to change at line 44
class SGPrecipitation : public osg::Referenced class SGPrecipitation : public osg::Referenced
{ {
private: private:
bool _freeze; bool _freeze;
bool _enabled; bool _enabled;
float _snow_intensity; float _snow_intensity;
float _rain_intensity; float _rain_intensity;
float _clip_distance; float _clip_distance;
int _wind_dir;
osg::Vec3 _wind_vec; osg::Vec3 _wind_vec;
osg::ref_ptr<osgParticle::PrecipitationEffect> _precipitationEffect; osg::ref_ptr<osgParticle::PrecipitationEffect> _precipitationEffect;
public: public:
SGPrecipitation(); SGPrecipitation();
virtual ~SGPrecipitation() {} virtual ~SGPrecipitation() {}
osg::Group* build(void); osg::Group* build(void);
bool update(void); bool update(void);
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 lines changed or added


 props.hxx   props.hxx 
skipping to change at line 23 skipping to change at line 23
#define __PROPS_HXX #define __PROPS_HXX
#ifndef PROPS_STANDALONE #ifndef PROPS_STANDALONE
#define PROPS_STANDALONE 0 #define PROPS_STANDALONE 0
#endif #endif
#include <vector> #include <vector>
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <typeinfo>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/type_traits/is_enum.hpp>
#if PROPS_STANDALONE #if PROPS_STANDALONE
#else #else
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#endif #endif
#include <simgear/math/SGMathFwd.hxx> #include <simgear/math/SGMathFwd.hxx>
#include <simgear/math/sg_types.hxx> #include <simgear/math/sg_types.hxx>
#include <simgear/structure/SGReferenced.hxx> #include <simgear/structure/SGReferenced.hxx>
skipping to change at line 717 skipping to change at line 719
MAX_STRING_LEN = 1024 MAX_STRING_LEN = 1024
}; };
/** /**
* Access mode attributes. * Access mode attributes.
* *
* <p>The ARCHIVE attribute is strictly advisory, and controls * <p>The ARCHIVE attribute is strictly advisory, and controls
* whether the property should normally be saved and restored.</p> * whether the property should normally be saved and restored.</p>
*/ */
enum Attribute { enum Attribute {
NO_ATTR = 0,
READ = 1, READ = 1,
WRITE = 2, WRITE = 2,
ARCHIVE = 4, ARCHIVE = 4,
REMOVED = 8, REMOVED = 8,
TRACE_READ = 16, TRACE_READ = 16,
TRACE_WRITE = 32, TRACE_WRITE = 32,
USERARCHIVE = 64, USERARCHIVE = 64,
PRESERVE = 128 PRESERVE = 128
// beware: if you add another attribute here, // beware: if you add another attribute here,
// also update value of "LAST_USED_ATTRIBUTE". // also update value of "LAST_USED_ATTRIBUTE".
skipping to change at line 881 skipping to change at line 884
* Get a vector of all children with the specified name. * Get a vector of all children with the specified name.
*/ */
simgear::PropertyList getChildren (const char * name) const; simgear::PropertyList getChildren (const char * name) const;
/** /**
* Get a vector of all children with the specified name. * Get a vector of all children with the specified name.
*/ */
simgear::PropertyList getChildren (const std::string& name) const simgear::PropertyList getChildren (const std::string& name) const
{ return getChildren(name.c_str()); } { return getChildren(name.c_str()); }
// TODO do we need the removeXXX methods to return the deleted nodes?
/** /**
* Remove child by position. * Remove child by position.
*/ */
SGPropertyNode_ptr removeChild (int pos, bool keep = true); SGPropertyNode_ptr removeChild (int pos, bool keep = true);
/** /**
* Remove a child node * Remove a child node
*/ */
SGPropertyNode_ptr removeChild (const char * name, int index = 0, SGPropertyNode_ptr removeChild (const char * name, int index = 0,
bool keep = true); bool keep = true);
skipping to change at line 911 skipping to change at line 915
*/ */
simgear::PropertyList removeChildren (const char * name, bool keep = true ); simgear::PropertyList removeChildren (const char * name, bool keep = true );
/** /**
* Remove all children with the specified name. * Remove all children with the specified name.
*/ */
simgear::PropertyList removeChildren (const std::string& name, simgear::PropertyList removeChildren (const std::string& name,
bool keep = true) bool keep = true)
{ return removeChildren(name.c_str(), keep); } { return removeChildren(name.c_str(), keep); }
/**
* Remove all children (does not change the value of the node)
*/
void removeAllChildren();
// //
// Alias support. // Alias support.
// //
/** /**
* Alias this node's leaf value to another's. * Alias this node's leaf value to another's.
*/ */
bool alias (SGPropertyNode * target); bool alias (SGPropertyNode * target);
/** /**
skipping to change at line 1185 skipping to change at line 1194
typename boost::disable_if_c<simgear::props::PropertyTraits <T>::Internal> typename boost::disable_if_c<simgear::props::PropertyTraits <T>::Internal>
::type* dummy = 0); ::type* dummy = 0);
template<int N> template<int N>
bool setValue(const char (&val)[N]) bool setValue(const char (&val)[N])
{ {
return setValue(&val[0]); return setValue(&val[0]);
} }
/** /**
* Set relative node to given value and afterwards make read only.
*
* @param relative_path Path to node
* @param value Value to set
*
* @return whether value could be set
*/
template<typename T>
bool setValueReadOnly(const std::string& relative_path, const T& value)
{
SGPropertyNode* node = getNode(relative_path, true);
bool ret = node->setValue(value);
node->setAttributes(READ);
return ret;
}
/**
* Interpolate current value to target value within given time. * Interpolate current value to target value within given time.
* *
* @param type Type of interpolation ("numeric", "color", etc.) * @param type Type of interpolation ("numeric", "color", etc.)
* @param target Node containing target value * @param target Node containing target value
* @param duration Duration of interpolation (in seconds) * @param duration Duration of interpolation (in seconds)
* @param easing Easing function (http://easings.net/) * @param easing Easing function (http://easings.net/)
*/ */
bool interpolate( const std::string& type, bool interpolate( const std::string& type,
const SGPropertyNode& target, const SGPropertyNode& target,
double duration = 0.6, double duration = 0.6,
skipping to change at line 1683 skipping to change at line 1709
// very internal path parsing function // very internal path parsing function
template<typename SplitItr> template<typename SplitItr>
friend SGPropertyNode* find_node_aux(SGPropertyNode * current, SplitItr& itr, friend SGPropertyNode* find_node_aux(SGPropertyNode * current, SplitItr& itr,
bool create, int last_index); bool create, int last_index);
// For boost // For boost
friend size_t hash_value(const SGPropertyNode& node); friend size_t hash_value(const SGPropertyNode& node);
}; };
// Convenience functions for use in templates // Convenience functions for use in templates
template<typename T> template<typename T>
T getValue(const SGPropertyNode*); typename boost::disable_if<boost::is_enum<T>, T>::type
getValue(const SGPropertyNode*);
template<> template<>
inline bool getValue<bool>(const SGPropertyNode* node) { return node->getBo olValue(); } inline bool getValue<bool>(const SGPropertyNode* node) { return node->getBo olValue(); }
template<> template<>
inline int getValue<int>(const SGPropertyNode* node) { return node->getIntV alue(); } inline int getValue<int>(const SGPropertyNode* node) { return node->getIntV alue(); }
template<> template<>
inline long getValue<long>(const SGPropertyNode* node) { return node->getLo ngValue(); } inline long getValue<long>(const SGPropertyNode* node) { return node->getLo ngValue(); }
skipping to change at line 1718 skipping to change at line 1745
{ {
return node->getStringValue (); return node->getStringValue ();
} }
template<> template<>
inline std::string getValue<std::string>(const SGPropertyNode* node) inline std::string getValue<std::string>(const SGPropertyNode* node)
{ {
return node->getStringValue(); return node->getStringValue();
} }
namespace simgear
{
/**
* Default trait for extracting enum values from SGPropertyNode. Create y
our
* own specialization for specific enum types to enable validation of val
ues.
*/
template<class T>
struct enum_traits
{
/**
* Typename of the enum
*/
static const char* name() { return typeid(T).name(); }
/**
* @return Default value (will be used if validation fails)
*/
static T defVal() { return T(); }
/**
* @return Whether the given integer value has an enum value defined
*/
static bool validate(int) { return true; }
};
} // namespace simgear
/** Extract enum from SGPropertyNode */
template<typename T>
inline typename boost::enable_if<boost::is_enum<T>, T>::type
getValue(const SGPropertyNode* node)
{
typedef simgear::enum_traits<T> Traits;
int val = node->getIntValue();
if( !Traits::validate(val) )
{
SG_LOG
(
SG_GENERAL,
SG_WARN,
"Invalid value for enum (" << Traits::name() << ", val = " << val <<
")"
);
return Traits::defVal();
}
return static_cast<T>(node->getIntValue());
}
inline bool setValue(SGPropertyNode* node, bool value) inline bool setValue(SGPropertyNode* node, bool value)
{ {
return node->setBoolValue(value); return node->setBoolValue(value);
} }
inline bool setValue(SGPropertyNode* node, int value) inline bool setValue(SGPropertyNode* node, int value)
{ {
return node->setIntValue(value); return node->setIntValue(value);
} }
 End of changes. 8 change blocks. 
1 lines changed or deleted 77 lines changed or added


 props_io.hxx   props_io.hxx 
skipping to change at line 62 skipping to change at line 62
const SGPropertyNode * start_node, const SGPropertyNode * start_node,
bool write_all = false, bool write_all = false,
SGPropertyNode::Attribute archive_flag = SGPropertyNod e::ARCHIVE); SGPropertyNode::Attribute archive_flag = SGPropertyNod e::ARCHIVE);
/** /**
* Copy properties from one node to another. * Copy properties from one node to another.
*/ */
bool copyProperties (const SGPropertyNode *in, SGPropertyNode *out, bool copyProperties (const SGPropertyNode *in, SGPropertyNode *out,
int attr_value=0, int attr_mask=0); int attr_value=0, int attr_mask=0);
bool copyPropertiesWithAttribute(const SGPropertyNode *in, SGPropertyNode *
out,
SGPropertyNode::Attribute attr);
#endif // __PROPS_IO_HXX #endif // __PROPS_IO_HXX
// end of props_io.hxx // end of props_io.hxx
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 screen-dump.hxx   screen-dump.hxx 
skipping to change at line 27 skipping to change at line 27
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA.
// //
// $Id$ // $Id$
#ifndef SG_SCREEN_DUMP_HXX #ifndef SG_SCREEN_DUMP_HXX
#define SG_SCREEN_DUMP_HXX #define SG_SCREEN_DUMP_HXX
#include <simgear/compiler.h>
#include <osg/GL>
/** /**
* Dump the screen buffer to a PNG file. * Dump the screen buffer to a PNG file.
* @param filename name of file * @param filename name of file
* @param win_width width of our opengl window * @param win_width width of our opengl window
* @param win_height height of our opengl window * @param win_height height of our opengl window
*/ */
bool sg_glDumpWindow( const char *filename, int win_width, int win_height ) ; bool sg_glDumpWindow( const char *filename, int win_width, int win_height ) ;
/**
* Given a GLubyte *buffer, write it out to a ppm file.
* @param filename name of file
* @param buffer pointer to opengl buffer
* @param win_width width of buffer
* @param win_height height of buffer
* @param mode one of GL_RGBA, GL_RGB, etc.
*/
bool sg_glWritePPMFile( const char *filename, GLubyte *buffer, int win_widt
h,
int win_height, int mode);
#endif // of SG_SCREEN_DUMP_HXX #endif // of SG_SCREEN_DUMP_HXX
 End of changes. 2 change blocks. 
16 lines changed or deleted 0 lines changed or added


 sg_netChannel.hxx   sg_netChannel.hxx 
skipping to change at line 126 skipping to change at line 126
}; };
class NetChannelPoller class NetChannelPoller
{ {
typedef std::vector<NetChannel*> ChannelList; typedef std::vector<NetChannel*> ChannelList;
ChannelList channels; ChannelList channels;
public: public:
void addChannel(NetChannel* channel); void addChannel(NetChannel* channel);
void removeChannel(NetChannel* channel); void removeChannel(NetChannel* channel);
bool hasChannels() const { return !channels.empty(); }
bool poll(unsigned int timeout = 0); bool poll(unsigned int timeout = 0);
void loop(unsigned int timeout = 0); void loop(unsigned int timeout = 0);
}; };
} // of namespace simgear } // of namespace simgear
#endif // SG_NET_CHANNEL_H #endif // SG_NET_CHANNEL_H
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 sg_netChat.hxx   sg_netChat.hxx 
skipping to change at line 73 skipping to change at line 73
#include <simgear/io/sg_netBuffer.hxx> #include <simgear/io/sg_netBuffer.hxx>
namespace simgear namespace simgear
{ {
class NetChat : public NetBufferChannel class NetChat : public NetBufferChannel
{ {
std::string terminator; std::string terminator;
int bytesToCollect; int bytesToCollect;
protected:
virtual void handleBufferRead (NetBuffer& buffer) ; virtual void handleBufferRead (NetBuffer& buffer) ;
public: public:
NetChat () : NetChat () :
bytesToCollect(-1) bytesToCollect(-1)
{} {}
void setTerminator(const std::string& t); void setTerminator(const std::string& t);
const char* getTerminator() const; const char* getTerminator() const;
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 sg_path.hxx   sg_path.hxx 
skipping to change at line 54 skipping to change at line 54
* in managing file system path names. * in managing file system path names.
* *
* Paths can be input in any platform format and will be converted * Paths can be input in any platform format and will be converted
* automatically to the proper format. * automatically to the proper format.
*/ */
class SGPath { class SGPath {
public: public:
struct Permissions
{
bool read : 1;
bool write : 1;
};
typedef Permissions (*PermissonChecker)(const SGPath&);
/** Default constructor */ /** Default constructor */
SGPath(); explicit SGPath(PermissonChecker validator = NULL);
/** Copy contructor */ /** Copy contructor */
SGPath(const SGPath& p); SGPath(const SGPath& p);
SGPath& operator=(const SGPath& p); SGPath& operator=(const SGPath& p);
/** /**
* Construct a path based on the starting path provided. * Construct a path based on the starting path provided.
* @param p initial path * @param p initial path
*/ */
SGPath( const std::string& p ); SGPath( const std::string& p, PermissonChecker validator = NULL );
/** /**
* Construct a path based on the starting path provided and a relative subpath * Construct a path based on the starting path provided and a relative subpath
* @param p initial path * @param p initial path
* @param r relative subpath * @param r relative subpath
*/ */
SGPath( const SGPath& p, const std::string& r ); SGPath( const SGPath& p,
const std::string& r,
PermissonChecker validator = NULL );
/** Destructor */ /** Destructor */
~SGPath(); ~SGPath();
/** /**
* Set path to a new value * Set path to a new value
* @param p new path * @param p new path
*/ */
void set( const std::string& p ); void set( const std::string& p );
SGPath& operator= ( const char* p ) { this->set(p); return *this; } SGPath& operator= ( const char* p ) { this->set(p); return *this; }
bool operator==(const SGPath& other) const; bool operator==(const SGPath& other) const;
bool operator!=(const SGPath& other) const; bool operator!=(const SGPath& other) const;
void setPermissonChecker(PermissonChecker validator);
PermissonChecker getPermissonChecker() const;
/** /**
* Set if file information (exists, type, mod-time) is cached or * Set if file information (exists, type, mod-time) is cached or
* retrieved each time it is queried. Caching is enabled by default * retrieved each time it is queried. Caching is enabled by default
*/ */
void set_cached(bool cached); void set_cached(bool cached);
/** /**
* Append another piece to the existing path. Inserts a path * Append another piece to the existing path. Inserts a path
* separator between the existing component and the new component. * separator between the existing component and the new component.
* @param p additional path component */ * @param p additional path component */
skipping to change at line 200 skipping to change at line 212
* @return true if file exists, otherwise returns false. * @return true if file exists, otherwise returns false.
*/ */
bool exists() const; bool exists() const;
/** /**
* Create the designated directory. * Create the designated directory.
* @return 0 on success, or <0 on failure. * @return 0 on success, or <0 on failure.
*/ */
int create_dir(mode_t mode); int create_dir(mode_t mode);
/**
* Check if reading file is allowed. Readabilty does not imply the exis
tance
* of the file.
*
* @note By default all files will be marked as readable. No check is m
ade
* if the operating system allows the given file to be read. Deri
ved
* classes may actually implement custom read/write rights.
*/
bool canRead() const;
bool canWrite() const;
bool isFile() const; bool isFile() const;
bool isDir() const; bool isDir() const;
/** /**
* Opposite sense to isAbsolute * Opposite sense to isAbsolute
*/ */
bool isRelative() const { return !isAbsolute(); } bool isRelative() const { return !isAbsolute(); }
/** /**
* Is this an absolute path? * Is this an absolute path?
skipping to change at line 248 skipping to change at line 271
* *
* @param name Name of the environment variable * @param name Name of the environment variable
* @param def Default path to return if the environment variable does not * @param def Default path to return if the environment variable does not
* exist or is empty. * exist or is empty.
*/ */
static SGPath fromEnv(const char* name, const SGPath& def = SGPath()); static SGPath fromEnv(const char* name, const SGPath& def = SGPath());
/** /**
* Get path to user's home directory * Get path to user's home directory
*/ */
static SGPath home(); static SGPath home(const SGPath& def = SGPath());
/** /**
* Get path to the user's desktop directory * Get path to the user's desktop directory
*/ */
static SGPath desktop(); static SGPath desktop(const SGPath& def = SGPath());
/**
* Get path to the user's documents directory
*/
static SGPath documents(const SGPath& def = SGPath());
private: private:
void fix(); void fix();
void validate() const; void validate() const;
void checkAccess() const;
std::string path; std::string path;
PermissonChecker _permission_checker;
mutable bool _cached : 1; mutable bool _cached : 1;
mutable bool _rwCached : 1;
bool _cacheEnabled : 1; ///< cacheing can be disbled if required bool _cacheEnabled : 1; ///< cacheing can be disbled if required
mutable bool _canRead : 1;
mutable bool _canWrite : 1;
mutable bool _exists : 1; mutable bool _exists : 1;
mutable bool _isDir : 1; mutable bool _isDir : 1;
mutable bool _isFile : 1; mutable bool _isFile : 1;
mutable time_t _modTime; mutable time_t _modTime;
}; };
/// Output to an ostream /// Output to an ostream
template<typename char_type, typename traits_type> template<typename char_type, typename traits_type>
inline inline
std::basic_ostream<char_type, traits_type>& std::basic_ostream<char_type, traits_type>&
 End of changes. 13 change blocks. 
5 lines changed or deleted 40 lines changed or added


 simgear_config.h   simgear_config.h 
skipping to change at line 16 skipping to change at line 16
#define HAVE_GETTIMEOFDAY #define HAVE_GETTIMEOFDAY
/* #undef HAVE_GETLOCALTIME */ /* #undef HAVE_GETLOCALTIME */
#define HAVE_FTIME #define HAVE_FTIME
#define HAVE_RINT #define HAVE_RINT
#define HAVE_TIMEGM #define HAVE_TIMEGM
#define HAVE_ISNAN #define HAVE_ISNAN
#define HAVE_STD_ISNAN #define HAVE_STD_ISNAN
/* #undef HAVE_WINDOWS_H */ /* #undef HAVE_WINDOWS_H */
#define HAVE_MKDTEMP #define HAVE_MKDTEMP
#define HAVE_SVN_CLIENT_H
#define HAVE_LIBSVN_CLIENT_1
#define GCC_ATOMIC_BUILTINS_FOUND #define GCC_ATOMIC_BUILTINS_FOUND
/* #undef SYSTEM_EXPAT */ /* #undef SYSTEM_EXPAT */
#define ENABLE_SOUND #define ENABLE_SOUND
/* #undef SG_SVN_CLIENT */
 End of changes. 2 change blocks. 
3 lines changed or deleted 0 lines changed or added


 sky.hxx   sky.hxx 
skipping to change at line 44 skipping to change at line 44
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/math/sg_random.h> #include <simgear/math/sg_random.h>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <vector> #include <vector>
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <osg/MatrixTransform> #include <osg/MatrixTransform>
#include <osg/Node> #include <osg/Node>
#include <osg/Switch>
#include <simgear/ephemeris/ephemeris.hxx> #include <simgear/ephemeris/ephemeris.hxx>
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
#include <simgear/scene/sky/cloud.hxx> #include <simgear/scene/sky/cloud.hxx>
#include <simgear/scene/sky/dome.hxx> #include <simgear/scene/sky/dome.hxx>
#include <simgear/scene/sky/moon.hxx> #include <simgear/scene/sky/moon.hxx>
#include <simgear/scene/sky/oursun.hxx> #include <simgear/scene/sky/oursun.hxx>
#include <simgear/scene/sky/stars.hxx> #include <simgear/scene/sky/stars.hxx>
skipping to change at line 225 skipping to change at line 224
// components of the sky // components of the sky
SGSharedPtr<SGSkyDome> dome; SGSharedPtr<SGSkyDome> dome;
SGSharedPtr<SGSun> oursun; SGSharedPtr<SGSun> oursun;
SGSharedPtr<SGMoon> moon; SGSharedPtr<SGMoon> moon;
SGSharedPtr<SGStars> planets; SGSharedPtr<SGStars> planets;
SGSharedPtr<SGStars> stars; SGSharedPtr<SGStars> stars;
layer_list_type cloud_layers; layer_list_type cloud_layers;
osg::ref_ptr<osg::Group> pre_root, cloud_root; osg::ref_ptr<osg::Group> pre_root, cloud_root;
osg::ref_ptr<osg::Switch> pre_selector;
osg::ref_ptr<osg::Group> pre_transform; osg::ref_ptr<osg::Group> pre_transform;
osg::ref_ptr<osg::MatrixTransform> _ephTransform; osg::ref_ptr<osg::MatrixTransform> _ephTransform;
SGPath tex_path; SGPath tex_path;
// visibility // visibility
float visibility; float visibility;
float effective_visibility; float effective_visibility;
float minimum_sky_visibility;
int in_cloud; int in_cloud;
int cur_layer_pos;
// near cloud visibility state variables // near cloud visibility state variables
bool in_puff; bool in_puff;
double puff_length; // in seconds double puff_length; // in seconds
double puff_progression; // in seconds double puff_progression; // in seconds
double ramp_up; // in seconds double ramp_up; // in seconds
double ramp_down; // in seconds double ramp_down; // in seconds
// 3D clouds enabled // 3D clouds enabled
bool clouds_3d_enabled; bool clouds_3d_enabled;
skipping to change at line 359 skipping to change at line 355
osg::Node* getPreRoot() { return pre_root.get(); } osg::Node* getPreRoot() { return pre_root.get(); }
osg::Node* getCloudRoot() { return cloud_root.get(); } osg::Node* getCloudRoot() { return cloud_root.get(); }
/** /**
* Specify the texture path (optional, defaults to current directory) * Specify the texture path (optional, defaults to current directory)
* @param path base path to texture locations * @param path base path to texture locations
*/ */
void texture_path( const string& path ); void texture_path( const string& path );
/** Enable drawing of the sky. */
inline void enable() {
pre_selector->setValue(0, 1);
}
/**
* Disable drawing of the sky in the scene graph. The leaf node is sti
ll
* there, how ever it won't be traversed on by ssgCullandRender()
*/
inline void disable() {
pre_selector->setValue(0, 0);
}
/** /**
* Get the current sun color * Get the current sun color
*/ */
inline SGVec4f get_sun_color() { return oursun->get_color(); } inline SGVec4f get_sun_color() { return oursun->get_color(); }
/** /**
* Get the current scene color * Get the current scene color
*/ */
inline SGVec4f get_scene_color() { return oursun->get_scene_color(); } inline SGVec4f get_scene_color() { return oursun->get_scene_color(); }
skipping to change at line 419 skipping to change at line 402
SGCloudLayer * get_cloud_layer (int i); SGCloudLayer * get_cloud_layer (int i);
/** /**
* Return the number of cloud layers currently available. * Return the number of cloud layers currently available.
* *
* @return The cloud layer count. * @return The cloud layer count.
*/ */
int get_cloud_layer_count () const; int get_cloud_layer_count () const;
/** @return current effective visibility */ /** @return current effective visibility */
inline float get_visibility() const { return effective_visibility; } float get_visibility() const { return effective_visibility; }
/** Set desired clear air visibility. /** Set desired clear air visibility.
* @param v visibility in meters * @param v visibility in meters
*/ */
inline void set_visibility( float v ) { void set_visibility( float v );
effective_visibility = visibility = (v <= 25.0) ? 25.0 : v;
}
/** Get 3D cloud density */ /** Get 3D cloud density */
double get_3dCloudDensity() const; double get_3dCloudDensity() const;
/** Set 3D cloud density /** Set 3D cloud density
* @param density 3D cloud density * @param density 3D cloud density
*/ */
void set_3dCloudDensity(double density); void set_3dCloudDensity(double density);
/** Get 3D cloud visibility range*/ /** Get 3D cloud visibility range*/
skipping to change at line 484 skipping to change at line 465
void set_3dCloudUseImpostors(bool imp); void set_3dCloudUseImpostors(bool imp);
/** Get 3D cloud wrapping */ /** Get 3D cloud wrapping */
bool get_3dCloudWrap() const; bool get_3dCloudWrap() const;
/** Set 3D cloud wrapping /** Set 3D cloud wrapping
* @param wrap whether to wrap 3D clouds * @param wrap whether to wrap 3D clouds
*/ */
void set_3dCloudWrap(bool wrap); void set_3dCloudWrap(bool wrap);
/** Get minimum sky visibility */
float get_minimum_sky_visibility() const;
/** Set minimum sky visibility */
void set_minimum_sky_visibility( float value );
}; };
#endif // _SG_SKY_HXX #endif // _SG_SKY_HXX
 End of changes. 8 change blocks. 
27 lines changed or deleted 2 lines changed or added


 strutils.hxx   strutils.hxx 
skipping to change at line 40 skipping to change at line 40
#include <string> #include <string>
#include <vector> #include <vector>
#include <cstdlib> #include <cstdlib>
typedef std::vector < std::string > string_list; typedef std::vector < std::string > string_list;
namespace simgear { namespace simgear {
namespace strutils { namespace strutils {
/**
* utf8ToLatin1() convert utf8 to latin, useful for accent character
(i.e éâàîè...)
*/
std::string utf8ToLatin1( std::string & s_utf8 );
// /** // /**
// * atof() wrapper for "string" type // * atof() wrapper for "string" type
// */ // */
// inline double // inline double
// atof( const string& str ) // atof( const string& str )
// { // {
// return ::atof( str.c_str() ); // return ::atof( str.c_str() );
// } // }
// /** // /**
skipping to change at line 139 skipping to change at line 144
*/ */
std::string simplify(const std::string& s); std::string simplify(const std::string& s);
/** /**
* convert a string representing a decimal number, to an int * convert a string representing a decimal number, to an int
*/ */
int to_int(const std::string& s, int base = 10); int to_int(const std::string& s, int base = 10);
/** /**
* Like strcmp(), but for dotted versions strings NN.NN.NN * Like strcmp(), but for dotted versions strings NN.NN.NN
* any number of terms are support. * any number of terms are supported.
* @return 0 if versions match, -ve number if v1 is lower, +ve if v1 * @return 0 if versions match, -ve number if v1 is lower, +ve if v1
* is greater * is greater
*/ */
int compare_versions(const std::string& v1, const std::string& v2); int compare_versions(const std::string& v1, const std::string& v2);
/** /**
* Convert a string to upper case. * Convert a string to upper case.
* @return upper case string * @return upper case string
*/ */
std::string uppercase(const std::string &s); std::string uppercase(const std::string &s);
/**
* Convert a string to lower case.
* @return lower case string
*/
std::string lowercase(const std::string &s);
/**
* Convert a string to lower case in place
*/
void lowercase(std::string &s);
/** /**
* convert a string in the local Windows 8-bit encoding to UTF-8 * convert a string in the local Windows 8-bit encoding to UTF-8
* (no-op on other platforms) * (no-op on other platforms)
*/ */
std::string convertWindowsLocal8BitToUtf8(const std::string& a); std::string convertWindowsLocal8BitToUtf8(const std::string& a);
#if defined(SG_WINDOWS)
typedef std::vector<wchar_t> WCharVec;
WCharVec convertUtf8ToWString(const std::string& a);
#endif
/** /**
* convert base-64 encoded data to raw bytes (possibly with embedded * convert base-64 encoded data to raw bytes (possibly with embedded
* NULs). Throws an exception if input data is not base64, or is * NULs). Throws an exception if input data is not base64, or is
* malformed * malformed
*/ */
std::string decodeBase64(const std::string& a); void decodeBase64(const std::string& a, std::vector<unsigned char>& o utput);
/** /**
* convert bytes to hexadecimal equivalent * convert bytes to hexadecimal equivalent
*/ */
std::string encodeHex(const std::string& bytes); std::string encodeHex(const std::string& bytes);
std::string encodeHex(const unsigned char* rawBytes, unsigned int lengt h); std::string encodeHex(const unsigned char* rawBytes, unsigned int lengt h);
/** /**
* Unescape string. * Unescape string.
* *
* @param str String possibly containing escaped characters. * @param str String possibly containing escaped characters.
* @return string with escaped characters replaced by single character * @return string with escaped characters replaced by single character
* values. * values.
*/ */
std::string unescape(const char* str); std::string unescape(const char* str);
inline std::string unescape(const std::string& str) inline std::string unescape(const std::string& str)
{ return unescape(str.c_str()); } { return unescape(str.c_str()); }
/**
* Check a printf-style format string for dangerous (buffer-overflowi
ng,
* memory re-writing) format tokens. If a problematic token is
* found, logs an error (SG_WARN) and returns an empty format string.
*/
std::string sanitizePrintfFormat(const std::string& input);
} // end namespace strutils } // end namespace strutils
} // end namespace simgear } // end namespace simgear
#endif // STRUTILS_H #endif // STRUTILS_H
 End of changes. 6 change blocks. 
2 lines changed or deleted 32 lines changed or added


 subsystem_mgr.hxx   subsystem_mgr.hxx 
skipping to change at line 273 skipping to change at line 273
protected: protected:
bool _suspended; bool _suspended;
eventTimeVec timingInfo; eventTimeVec timingInfo;
static SGSubsystemTimingCb reportTimingCb; static SGSubsystemTimingCb reportTimingCb;
static void* reportTimingUserData; static void* reportTimingUserData;
}; };
typedef SGSharedPtr<SGSubsystem> SGSubsystemRef;
/** /**
* A group of FlightGear subsystems. * A group of FlightGear subsystems.
*/ */
class SGSubsystemGroup : public SGSubsystem class SGSubsystemGroup : public SGSubsystem
{ {
public: public:
SGSubsystemGroup (); SGSubsystemGroup ();
virtual ~SGSubsystemGroup (); virtual ~SGSubsystemGroup ();
skipping to change at line 319 skipping to change at line 321
/** /**
* retrive list of member subsystem names * retrive list of member subsystem names
*/ */
string_list member_names() const; string_list member_names() const;
private: private:
class Member; class Member;
Member* get_member (const std::string &name, bool create = false); Member* get_member (const std::string &name, bool create = false);
std::vector<Member *> _members; typedef std::vector<Member *> MemberVec;
MemberVec _members;
double _fixedUpdateTime; double _fixedUpdateTime;
double _updateTimeRemainder; double _updateTimeRemainder;
/// index of the member we are currently init-ing /// index of the member we are currently init-ing
unsigned int _initPosition; unsigned int _initPosition;
}; };
/** /**
* Manage subsystems for FlightGear. * Manage subsystems for FlightGear.
* *
skipping to change at line 385 skipping to change at line 388
virtual void add (const char * name, virtual void add (const char * name,
SGSubsystem * subsystem, SGSubsystem * subsystem,
GroupType group = GENERAL, GroupType group = GENERAL,
double min_time_sec = 0); double min_time_sec = 0);
/** /**
* remove a subsystem, and return a pointer to it. * remove a subsystem, and return a pointer to it.
* returns NULL if the subsystem was not found. * returns NULL if the subsystem was not found.
*/ */
virtual SGSubsystem* remove(const char* name); virtual void remove(const char* name);
virtual SGSubsystemGroup * get_group (GroupType group); virtual SGSubsystemGroup * get_group (GroupType group);
virtual SGSubsystem * get_subsystem(const std::string &name) const; virtual SGSubsystem* get_subsystem(const std::string &name) const;
void reportTiming(); void reportTiming();
void setReportTimingCb(void* userData,SGSubsystemTimingCb cb) {reportTi mingCb = cb;reportTimingUserData = userData;} void setReportTimingCb(void* userData,SGSubsystemTimingCb cb) {reportTi mingCb = cb;reportTimingUserData = userData;}
private: private:
SGSubsystemGroup* _groups[MAX_GROUPS]; SGSubsystemGroup* _groups[MAX_GROUPS];
unsigned int _initPosition; unsigned int _initPosition;
// non-owning reference
typedef std::map<std::string, SGSubsystem*> SubsystemDict; typedef std::map<std::string, SGSubsystem*> SubsystemDict;
SubsystemDict _subsystem_map; SubsystemDict _subsystem_map;
}; };
#endif // __SUBSYSTEM_MGR_HXX #endif // __SUBSYSTEM_MGR_HXX
 End of changes. 5 change blocks. 
3 lines changed or deleted 7 lines changed or added


 terrasync.hxx   terrasync.hxx 
skipping to change at line 24 skipping to change at line 24
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA.
// //
// $Id$ // $Id$
#ifndef TERRASYNC_HXX_ #ifndef TERRASYNC_HXX_
#define TERRASYNC_HXX_ #define TERRASYNC_HXX_
#include <set>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx> #include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/props/tiedpropertylist.hxx> #include <simgear/props/tiedpropertylist.hxx>
class SGPath; class SGPath;
class SGBucket;
namespace simgear namespace simgear
{ {
const int NOWHERE = -9999; const int NOWHERE = -9999;
class BufferedLogCallback; class BufferedLogCallback;
typedef void (*SGTerraSyncCallback)(void* userData, long tileIndex);
class SGTerraSync : public SGSubsystem class SGTerraSync : public SGSubsystem
{ {
public: public:
SGTerraSync(SGPropertyNode_ptr root); SGTerraSync();
virtual ~SGTerraSync(); virtual ~SGTerraSync();
virtual void init(); virtual void init();
virtual void shutdown();
virtual void reinit(); virtual void reinit();
virtual void bind(); virtual void bind();
virtual void unbind(); virtual void unbind();
virtual void update(double); virtual void update(double);
/// notify terrasync that the sim was repositioned, as opposed to
/// us travelling in a direction. Avoid last_lat / last_lon blocking
/// certain tiles when we reposition.
void reposition();
bool isIdle(); bool isIdle();
bool schedulePosition(int lat, int lon); bool schedulePosition(int lat, int lon);
void setTileRefreshCb(SGTerraSyncCallback refreshCb, void* userData = N
ULL); bool scheduleTile(const SGBucket& bucket);
void setRoot(SGPropertyNode_ptr root);
/// retrive the associated log object, for displaying log /// retrive the associated log object, for displaying log
/// output somewhere (a UI, presumably) /// output somewhere (a UI, presumably)
BufferedLogCallback* log() const BufferedLogCallback* log() const
{ return _log; } { return _log; }
/**
* Test if a scenery directory is queued or actively syncing.
* File path is the tile name, eg 'e001n52' or 'w003n56'. Will return t
rue
* if either the Terrain or Objects variant is being synced.
*
*/
bool isTileDirPending(const std::string& sceneryDir) const;
void scheduleDataDir(const std::string& dataDir);
bool isDataDirPending(const std::string& dataDir) const;
protected: protected:
void syncAirportsModels(); void syncAirportsModels();
void syncArea(int lat, int lon); void syncArea(int lat, int lon);
void syncAreas(int lat, int lon, int lat_dir, int lon_dir); void syncAreas(int lat, int lon, int lat_dir, int lon_dir);
void refreshScenery(SGPath path,const std::string& relativeDir);
void syncAreaByPath(const std::string& aPath);
class SvnThread; class SvnThread;
private: private:
SvnThread* _svnThread; SvnThread* _svnThread;
int last_lat; int last_lat;
int last_lon; int last_lon;
SGPropertyNode_ptr _terraRoot; SGPropertyNode_ptr _terraRoot;
SGPropertyNode_ptr _refreshDisplay;
SGPropertyNode_ptr _stalledNode; SGPropertyNode_ptr _stalledNode;
SGTerraSyncCallback _refreshCb; SGPropertyNode_ptr _cacheHits;
void* _userCbData;
// we manually bind+init TerraSync during early startup
// to get better overlap of slow operations (Shared Models sync
// and nav-cache rebuild). As a result we need to track the bind/init
// state explicitly to avoid duplicate calls.
bool _bound, _inited;
simgear::TiedPropertyList _tiedProperties; simgear::TiedPropertyList _tiedProperties;
BufferedLogCallback* _log; BufferedLogCallback* _log;
typedef std::set<std::string> string_set;
string_set _activeTileDirs;
}; };
} }
#endif /* TERRASYNC_HXX_ */ #endif /* TERRASYNC_HXX_ */
 End of changes. 13 change blocks. 
9 lines changed or deleted 41 lines changed or added


 tiedpropertylist.hxx   tiedpropertylist.hxx 
skipping to change at line 40 skipping to change at line 40
* This helper class keeps track of tied properties and unties * This helper class keeps track of tied properties and unties
* each tied property when this class gets destructed. * each tied property when this class gets destructed.
*/ */
class TiedPropertyList : simgear::PropertyList { class TiedPropertyList : simgear::PropertyList {
public: public:
TiedPropertyList() {} TiedPropertyList() {}
TiedPropertyList( SGPropertyNode_ptr root ) : _root(root) {} TiedPropertyList( SGPropertyNode_ptr root ) : _root(root) {}
virtual ~TiedPropertyList() virtual ~TiedPropertyList()
{ {
_root = 0; _root = 0;
if (size()>0) if (! empty())
{ {
SG_LOG(SG_GENERAL, SG_ALERT, "Detected properties with dangling ties. Use 'Untie' before removing a TiedPropertyList."); SG_LOG(SG_GENERAL, SG_ALERT, "Detected properties with dangling ties. Use 'Untie' before removing a TiedPropertyList.");
// running debug mode: go, fix it! // running debug mode: go, fix it!
assert(size() == 0); assert(empty());
} }
} }
void setRoot( SGPropertyNode_ptr root ) { _root = root; } void setRoot( SGPropertyNode_ptr root ) { _root = root; }
SGPropertyNode_ptr getRoot() const { return _root; } SGPropertyNode_ptr getRoot() const { return _root; }
template<typename T> SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, c onst SGRawValue<T> &rawValue, bool useDefault = true ) { template<typename T> SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, c onst SGRawValue<T> &rawValue, bool useDefault = true ) {
bool success = node->tie( rawValue, useDefault ); bool success = node->tie( rawValue, useDefault );
if( success ) { if( success ) {
SG_LOG( SG_GENERAL, SG_DEBUG, "Tied " << node->getPath() ); SG_LOG( SG_GENERAL, SG_DEBUG, "Tied " << node->getPath() );
skipping to change at line 127 skipping to change at line 127
template <class T, class V> SGPropertyNode_ptr Tie( const char * relati ve_path, T * obj, int index, V (T::*getter)(int) const, void (T::*setter)(i nt, V) = 0, bool useDefault = true) { template <class T, class V> SGPropertyNode_ptr Tie( const char * relati ve_path, T * obj, int index, V (T::*getter)(int) const, void (T::*setter)(i nt, V) = 0, bool useDefault = true) {
return Tie( _root->getNode( relative_path, true ), SGRawValueMethod sIndexed<T,V>(*obj, index, getter, setter), useDefault); return Tie( _root->getNode( relative_path, true ), SGRawValueMethod sIndexed<T,V>(*obj, index, getter, setter), useDefault);
} }
template <class T, class V> SGPropertyNode_ptr Tie( const char * relati ve_path, int prop_index, T * obj, int index, V (T::*getter)(int) const, voi d (T::*setter)(int, V) = 0, bool useDefault = true) { template <class T, class V> SGPropertyNode_ptr Tie( const char * relati ve_path, int prop_index, T * obj, int index, V (T::*getter)(int) const, voi d (T::*setter)(int, V) = 0, bool useDefault = true) {
return Tie( _root->getNode( relative_path,prop_index,true ), SGRawV alueMethodsIndexed<T,V>(*obj, index, getter, setter), useDefault); return Tie( _root->getNode( relative_path,prop_index,true ), SGRawV alueMethodsIndexed<T,V>(*obj, index, getter, setter), useDefault);
} }
void Untie() { void Untie() {
while( size() > 0 ) { while( ! empty() ) {
SG_LOG( SG_GENERAL, SG_DEBUG, "untie of " << back()->getPath() ); SG_LOG( SG_GENERAL, SG_DEBUG, "untie of " << back()->getPath() );
back()->untie(); back()->untie();
pop_back(); pop_back();
} }
} }
void setAttribute (SGPropertyNode::Attribute attr, bool state) void setAttribute (SGPropertyNode::Attribute attr, bool state)
{ {
for (std::vector<SGPropertyNode_ptr>::iterator it=begin() ; it < en d(); it++ ) for (std::vector<SGPropertyNode_ptr>::iterator it=begin() ; it < en d(); it++ )
(*it)->setAttribute(attr, state); (*it)->setAttribute(attr, state);
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 to_nasal_helper.hxx   to_nasal_helper.hxx 
skipping to change at line 79 skipping to change at line 79
naRef to_nasal_helper(naContext c, const SGPath& path); naRef to_nasal_helper(naContext c, const SGPath& path);
/** /**
* Convert function pointer to Nasal function * Convert function pointer to Nasal function
*/ */
naRef to_nasal_helper(naContext c, naCFunction func); naRef to_nasal_helper(naContext c, naCFunction func);
naRef to_nasal_helper(naContext c, const free_function_t& func); naRef to_nasal_helper(naContext c, const free_function_t& func);
/** /**
* Convert an enum value to the according numeric value
*/
template<class T>
typename boost::enable_if< boost::is_enum<T>, naRef >::type
to_nasal_helper(naContext c, T val)
{
return naNum(val);
}
/**
* Convert a numeric type to Nasal number * Convert a numeric type to Nasal number
*/ */
template<class T> template<class T>
typename boost::enable_if< boost::is_arithmetic<T>, naRef >::type typename boost::enable_if< boost::is_arithmetic<T>, naRef >::type
to_nasal_helper(naContext c, T num) to_nasal_helper(naContext c, T num)
{ {
return naNum(num); return naNum(num);
} }
/** /**
 End of changes. 1 change blocks. 
0 lines changed or deleted 10 lines changed or added


 version.h   version.h 
#define SIMGEAR_VERSION 2.12.1 #define SIMGEAR_VERSION 3.0.0
 End of changes. 1 change blocks. 
lines changed or deleted lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/