diff options
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_foreach.h | 8 | ||||
-rw-r--r-- | intern/cycles/util/util_function.h | 25 | ||||
-rw-r--r-- | intern/cycles/util/util_map.h | 27 | ||||
-rw-r--r-- | intern/cycles/util/util_progress.h | 8 | ||||
-rw-r--r-- | intern/cycles/util/util_set.h | 12 | ||||
-rw-r--r-- | intern/cycles/util/util_task.h | 2 | ||||
-rw-r--r-- | intern/cycles/util/util_thread.h | 21 |
7 files changed, 84 insertions, 19 deletions
diff --git a/intern/cycles/util/util_foreach.h b/intern/cycles/util/util_foreach.h index 065bd33ebd2..4f7337107b3 100644 --- a/intern/cycles/util/util_foreach.h +++ b/intern/cycles/util/util_foreach.h @@ -19,8 +19,12 @@ /* Use Boost to get nice foreach() loops for STL data structures. */ -#include <boost/foreach.hpp> -#define foreach BOOST_FOREACH +#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800) +# define foreach(x, y) for(x : y) +#else +# include <boost/foreach.hpp> +# define foreach BOOST_FOREACH +#endif #endif /* __UTIL_FOREACH_H__ */ diff --git a/intern/cycles/util/util_function.h b/intern/cycles/util/util_function.h index 7a312efaad7..83c07ae06a8 100644 --- a/intern/cycles/util/util_function.h +++ b/intern/cycles/util/util_function.h @@ -17,14 +17,31 @@ #ifndef __UTIL_FUNCTION_H__ #define __UTIL_FUNCTION_H__ -#include <boost/bind.hpp> -#include <boost/function.hpp> +#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800) +# include <functional> +#else +# include <boost/bind.hpp> +# include <boost/function.hpp> +#endif CCL_NAMESPACE_BEGIN +#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800) +# define function_bind std::bind +using std::function; +using std::placeholders::_1; +using std::placeholders::_2; +using std::placeholders::_3; +using std::placeholders::_4; +using std::placeholders::_5; +using std::placeholders::_6; +using std::placeholders::_7; +using std::placeholders::_8; +using std::placeholders::_9; +#else using boost::function; -#define function_bind boost::bind - +# define function_bind boost::bind +#endif CCL_NAMESPACE_END #endif /* __UTIL_FUNCTION_H__ */ diff --git a/intern/cycles/util/util_map.h b/intern/cycles/util/util_map.h index 54d6a8d6424..46c2885f8b0 100644 --- a/intern/cycles/util/util_map.h +++ b/intern/cycles/util/util_map.h @@ -18,13 +18,38 @@ #define __UTIL_MAP_H__ #include <map> -#include <boost/tr1/unordered_map.hpp> + +#if defined(CYCLES_TR1_UNORDERED_MAP) +# include <tr1/unordered_map> +#endif + +#if defined(CYCLES_STD_UNORDERED_MAP) || defined(CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE) +# include <unordered_map> +#endif + +#if !defined(CYCLES_NO_UNORDERED_MAP) && !defined(CYCLES_TR1_UNORDERED_MAP) && \ + !defined(CYCLES_STD_UNORDERED_MAP) && !defined(CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE) // NOLINT +# error One of: CYCLES_NO_UNORDERED_MAP, CYCLES_TR1_UNORDERED_MAP,\ + CYCLES_STD_UNORDERED_MAP, CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE must be defined! // NOLINT +#endif + CCL_NAMESPACE_BEGIN using std::map; using std::pair; + +#if defined(CYCLES_NO_UNORDERED_MAP) +typedef std::map unordered_map; +#endif + +#if defined(CYCLES_TR1_UNORDERED_MAP) || defined(CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE) using std::tr1::unordered_map; +#endif + +#if defined(CYCLES_STD_UNORDERED_MAP) +using std::unordered_map; +#endif CCL_NAMESPACE_END diff --git a/intern/cycles/util/util_progress.h b/intern/cycles/util/util_progress.h index 0ff48630a81..963987487ed 100644 --- a/intern/cycles/util/util_progress.h +++ b/intern/cycles/util/util_progress.h @@ -110,7 +110,7 @@ public: return cancel_message; } - void set_cancel_callback(boost::function<void(void)> function) + void set_cancel_callback(function<void(void)> function) { cancel_cb = function; } @@ -275,7 +275,7 @@ public: } } - void set_update_callback(boost::function<void(void)> function) + void set_update_callback(function<void(void)> function) { update_cb = function; } @@ -283,8 +283,8 @@ public: protected: thread_mutex progress_mutex; thread_mutex update_mutex; - boost::function<void(void)> update_cb; - boost::function<void(void)> cancel_cb; + function<void(void)> update_cb; + function<void(void)> cancel_cb; int tile; /* counter for rendered tiles */ int sample; /* counter of rendered samples, global for all tiles */ diff --git a/intern/cycles/util/util_set.h b/intern/cycles/util/util_set.h index 73a2bf19899..b3cb8dd8af5 100644 --- a/intern/cycles/util/util_set.h +++ b/intern/cycles/util/util_set.h @@ -18,13 +18,19 @@ #define __UTIL_SET_H__ #include <set> -#include <boost/tr1/unordered_set.hpp> - +#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800) +# include <unordered_set> +#else +# include <boost/tr1/unordered_set.hpp> +#endif CCL_NAMESPACE_BEGIN using std::set; +#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800) +using std::unordered_set; +#else using std::tr1::unordered_set; - +#endif CCL_NAMESPACE_END #endif /* __UTIL_SET_H__ */ diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h index 8fac12e9987..debcff3b776 100644 --- a/intern/cycles/util/util_task.h +++ b/intern/cycles/util/util_task.h @@ -27,7 +27,7 @@ class Task; class TaskPool; class TaskScheduler; -typedef boost::function<void(void)> TaskRunFunction; +typedef function<void(void)> TaskRunFunction; /* Task * diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h index fbbb9b42e31..9c19235d41d 100644 --- a/intern/cycles/util/util_thread.h +++ b/intern/cycles/util/util_thread.h @@ -17,7 +17,14 @@ #ifndef __UTIL_THREAD_H__ #define __UTIL_THREAD_H__ -#include <boost/thread.hpp> +#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800) +# include <thread> +# include <mutex> +# include <condition_variable> +# include <functional> +#else +# include <boost/thread.hpp> +#endif #include <pthread.h> #include <queue> @@ -25,18 +32,24 @@ CCL_NAMESPACE_BEGIN +#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800) +typedef std::mutex thread_mutex; +typedef std::unique_lock<std::mutex> thread_scoped_lock; +typedef std::condition_variable thread_condition_variable; +#else /* use boost for mutexes */ - typedef boost::mutex thread_mutex; typedef boost::mutex::scoped_lock thread_scoped_lock; typedef boost::condition_variable thread_condition_variable; +#endif /* own pthread based implementation, to avoid boost version conflicts with * dynamically loaded blender plugins */ class thread { public: - thread(boost::function<void(void)> run_cb_) + thread(function<void(void)> run_cb_) + { joined = false; run_cb = run_cb_; @@ -63,7 +76,7 @@ public: } protected: - boost::function<void(void)> run_cb; + function<void(void)> run_cb; pthread_t pthread_id; bool joined; }; |