|
From: <br...@us...> - 2008-10-14 03:00:43
|
Revision: 3737
http://openvrml.svn.sourceforge.net/openvrml/?rev=3737&view=rev
Author: braden
Date: 2008-10-14 03:00:33 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
Use the implementation of ScopeGuard buried in Boost.MultiIndex instead of providing our own. (Yes, it's in a "detail" namespace; but since Boost doesn't guarantee any API stability from one release to the next, that has little practical meaning.)
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/libopenvrml/openvrml/browser.cpp
trunk/src/libopenvrml/openvrml/script.cpp
trunk/src/libopenvrml/private.h
trunk/src/script/javascript.cpp
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-10-14 01:34:12 UTC (rev 3736)
+++ trunk/ChangeLog 2008-10-14 03:00:33 UTC (rev 3737)
@@ -1,3 +1,24 @@
+2008-10-13 Braden McDaniel <br...@en...>
+
+ Use the implementation of ScopeGuard buried in Boost.MultiIndex
+ instead of providing our own. (Yes, it's in a "detail" namespace;
+ but since Boost doesn't guarantee any API stability from one
+ release to the next, that has little practical meaning.)
+
+ * src/libopenvrml/private.h: Removed ScopeGuard implementation.
+ * src/libopenvrml/openvrml/browser.cpp
+ (openvrml::browser::externproto_node_metatype::load_proto::operator()()
+ const): Use boost::multi_index::detail::scope_guard.
+ * src/libopenvrml/openvrml/script.cpp
+ (openvrml::script_node::script_node(script_node_metatype &, const
+ boost::shared_ptr<openvrml::scope> &, const node_interface_set &,
+ const initial_value_map &)): Use
+ boost::multi_index::detail::scope_guard.
+ * src/script/javascript.cpp
+ (script::activate(double, const std::string &, size_t, const
+ openvrml::field_value * const[])): Use
+ boost::multi_index::detail::scope_guard.
+
2008-10-09 Braden McDaniel <br...@en...>
Updates for 0.17.9 release.
Modified: trunk/src/libopenvrml/openvrml/browser.cpp
===================================================================
--- trunk/src/libopenvrml/openvrml/browser.cpp 2008-10-14 01:34:12 UTC (rev 3736)
+++ trunk/src/libopenvrml/openvrml/browser.cpp 2008-10-14 03:00:33 UTC (rev 3737)
@@ -2471,8 +2471,6 @@
using std::vector;
using boost::dynamic_pointer_cast;
using boost::shared_ptr;
- using openvrml_::scope_guard;
- using openvrml_::make_obj_guard;
using local::uri;
scope_guard guard =
Modified: trunk/src/libopenvrml/openvrml/script.cpp
===================================================================
--- trunk/src/libopenvrml/openvrml/script.cpp 2008-10-14 01:34:12 UTC (rev 3736)
+++ trunk/src/libopenvrml/openvrml/script.cpp 2008-10-14 03:00:33 UTC (rev 3737)
@@ -1934,8 +1934,7 @@
// nodes.
//
this->add_ref();
- openvrml_::scope_guard guard =
- openvrml_::make_obj_guard(*this, &script_node::remove_ref);
+ scope_guard guard = make_obj_guard(*this, &script_node::remove_ref);
boost::ignore_unused_variable_warning(guard);
for (node_interface_set::const_iterator interface_ = interfaces.begin();
Modified: trunk/src/libopenvrml/private.h
===================================================================
--- trunk/src/libopenvrml/private.h 2008-10-14 01:34:12 UTC (rev 3736)
+++ trunk/src/libopenvrml/private.h 2008-10-14 03:00:33 UTC (rev 3737)
@@ -149,207 +149,6 @@
const fgreater_equal_t fgreater_equal = fgreater_equal_t();
- class OPENVRML_LOCAL scope_guard_impl_base {
- protected:
- mutable bool dismissed;
-
- public:
- void dismiss() const throw ();
-
- protected:
- scope_guard_impl_base() throw ();
- scope_guard_impl_base(const scope_guard_impl_base &) throw ();
-
- private:
- // Disable assignment.
- scope_guard_impl_base & operator=(const scope_guard_impl_base &);
- };
-
- typedef const scope_guard_impl_base & scope_guard;
-
- inline scope_guard_impl_base::scope_guard_impl_base() throw ():
- dismissed(false)
- {}
-
- inline scope_guard_impl_base::scope_guard_impl_base(
- const scope_guard_impl_base & scope_guard) throw ():
- dismissed(scope_guard.dismissed)
- {
- scope_guard.dismiss();
- }
-
- inline void scope_guard_impl_base::dismiss() const throw ()
- {
- this->dismissed = true;
- }
-
- template <typename Function, typename Param>
- class OPENVRML_LOCAL scope_guard_impl1 : public scope_guard_impl_base {
- Function function;
- const Param param;
-
- public:
- scope_guard_impl1(const Function & function, const Param & param);
- ~scope_guard_impl1();
- };
-
- template <typename Function, typename Param>
- scope_guard_impl1<Function, Param>::
- scope_guard_impl1(const Function & function, const Param & param):
- function(function),
- param(param)
- {}
-
- template <typename Function, typename Param>
- scope_guard_impl1<Function, Param>::~scope_guard_impl1()
- {
- if (!this->dismissed) { this->function(this->param); }
- }
-
- template <typename Function, typename Param>
- OPENVRML_LOCAL scope_guard_impl1<Function, Param>
- make_guard(const Function & function, const Param & param)
- {
- return scope_guard_impl1<Function, Param>(function, param);
- }
-
- template <typename Function,
- typename Param1,
- typename Param2,
- typename Param3>
- class OPENVRML_LOCAL scope_guard_impl3 : public scope_guard_impl_base {
- Function function;
- const Param1 param1;
- const Param2 param2;
- const Param3 param3;
-
- public:
- scope_guard_impl3(const Function & function,
- const Param1 & param1,
- const Param2 & param2,
- const Param3 & param3);
- ~scope_guard_impl3();
- };
-
- template <typename Function,
- typename Param1,
- typename Param2,
- typename Param3>
- scope_guard_impl3<Function, Param1, Param2, Param3>::
- scope_guard_impl3(const Function & function,
- const Param1 & param1,
- const Param2 & param2,
- const Param3 & param3):
- function(function),
- param1(param1),
- param2(param2),
- param3(param3)
- {}
-
- template <typename Function,
- typename Param1,
- typename Param2,
- typename Param3>
- scope_guard_impl3<Function, Param1, Param2, Param3>::
- ~scope_guard_impl3()
- {
- if (!this->dismissed) {
- this->function(this->param1, this->param2, this->param3);
- }
- }
-
- template <typename Function,
- typename Param1,
- typename Param2,
- typename Param3>
- OPENVRML_LOCAL scope_guard_impl3<Function, Param1, Param2, Param3>
- make_guard(const Function & function,
- const Param1 & param1,
- const Param2 & param2,
- const Param3 & param3)
- {
- return scope_guard_impl3<Function, Param1, Param2, Param3>(
- function, param1, param2, param3);
- }
-
- template <typename Object, typename MemberFunction>
- class OPENVRML_LOCAL obj_scope_guard_impl0 :
- public scope_guard_impl_base {
- Object & obj;
- MemberFunction mem_fun;
-
- public:
- obj_scope_guard_impl0(Object & obj, MemberFunction mem_fun);
- ~obj_scope_guard_impl0();
- };
-
- template <typename Object, typename MemberFunction>
- inline
- obj_scope_guard_impl0<Object, MemberFunction>::
- obj_scope_guard_impl0(Object & obj, MemberFunction mem_fun):
- obj(obj),
- mem_fun(mem_fun)
- {}
-
- template <typename Object, typename MemberFunction>
- inline
- obj_scope_guard_impl0<Object, MemberFunction>::~obj_scope_guard_impl0()
- {
- if (!this->dismissed) { (this->obj.*this->mem_fun)(); }
- }
-
- template <typename Object, typename MemberFunction>
- OPENVRML_LOCAL obj_scope_guard_impl0<Object, MemberFunction>
- make_obj_guard(Object & obj, MemberFunction mem_fun)
- {
- return obj_scope_guard_impl0<Object, MemberFunction>(obj, mem_fun);
- }
-
- template <typename Object, typename MemberFunction, typename Param>
- class OPENVRML_LOCAL obj_scope_guard_impl1 :
- public scope_guard_impl_base {
- Object & obj;
- MemberFunction mem_fun;
- const Param param;
-
- public:
- obj_scope_guard_impl1(Object & obj,
- MemberFunction mem_fun,
- const Param & param) throw ();
- ~obj_scope_guard_impl1() throw ();
- };
-
- template <typename Object, typename MemberFunction, typename Param>
- inline
- obj_scope_guard_impl1<Object, MemberFunction, Param>::
- obj_scope_guard_impl1(Object & obj,
- MemberFunction mem_fun,
- const Param & param)
- throw ():
- obj(obj),
- mem_fun(mem_fun),
- param(param)
- {}
-
- template <typename Object, typename MemberFunction, typename Param>
- inline
- obj_scope_guard_impl1<Object, MemberFunction, Param>::
- ~obj_scope_guard_impl1() throw ()
- {
- if (!this->dismissed) { (this->obj.*this->mem_fun)(this->param); }
- }
-
- template <typename Object, typename MemberFunction, typename Param>
- OPENVRML_LOCAL obj_scope_guard_impl1<Object, MemberFunction, Param>
- make_obj_guard(Object & obj,
- MemberFunction mem_fun,
- const Param & param)
- {
- return obj_scope_guard_impl1<Object, MemberFunction, Param>(
- obj, mem_fun, param);
- }
-
-
typedef boost::mpl::vector<openvrml::sfbool,
openvrml::sfcolor,
openvrml::sfcolorrgba,
Modified: trunk/src/script/javascript.cpp
===================================================================
--- trunk/src/script/javascript.cpp 2008-10-14 01:34:12 UTC (rev 3736)
+++ trunk/src/script/javascript.cpp 2008-10-14 03:00:33 UTC (rev 3737)
@@ -24,6 +24,7 @@
# include <private.h>
# include <jsapi.h>
# include <boost/array.hpp>
+# include <boost/multi_index/detail/scope_guard.hpp>
# include <algorithm>
# include <iostream>
# include <memory>
@@ -34,6 +35,8 @@
# include <config.h>
# endif
+using namespace boost::multi_index::detail; // for scope_guard
+
namespace {
class SFNode;
@@ -1191,8 +1194,8 @@
# ifdef JS_THREADSAFE
JS_SetContextThread(this->cx);
- openvrml_::scope_guard context_thread_guard =
- openvrml_::make_guard(&JS_ClearContextThread, this->cx);
+ scope_guard context_thread_guard =
+ make_guard(&JS_ClearContextThread, this->cx);
boost::ignore_unused_variable_warning(context_thread_guard);
# endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|