metadata
Wenzel Jakob 2012-12-09 00:28:12 -05:00
commit ab9324c10b
4 changed files with 53 additions and 88 deletions

View File

@ -42,7 +42,7 @@
#include <mitsuba/core/constants.h> #include <mitsuba/core/constants.h>
#include <mitsuba/core/fwd.h> #include <mitsuba/core/fwd.h>
#include <mitsuba/render/fwd.h> #include <mitsuba/render/fwd.h>
#include <mitsuba/core/stl.h> #include <mitsuba/core/math.h>
#include <mitsuba/core/object.h> #include <mitsuba/core/object.h>
#include <mitsuba/core/ref.h> #include <mitsuba/core/ref.h>
#include <mitsuba/core/tls.h> #include <mitsuba/core/tls.h>

View File

@ -189,6 +189,55 @@ extern MTS_EXPORT_CORE void __mts_set_appdefaults();
#define MTS_AUTORELEASE_BEGIN() #define MTS_AUTORELEASE_BEGIN()
#define MTS_AUTORELEASE_END() #define MTS_AUTORELEASE_END()
#endif #endif
MTS_NAMESPACE_END MTS_NAMESPACE_END
/// \cond
// Try to make MSVC++ behave a bit more like C++
// with an underlying C99 implementation
// (and dn't include this in the documentation)
#if defined(_MSC_VER)
#include <float.h>
#define snprintf _snprintf
#define vsnprintf _vsnprintf
namespace std {
inline char tolower(char c) {
return ::tolower(c);
}
inline char toupper(char c) {
return ::toupper(c);
}
inline bool isnan(float f) {
return _isnan(f);
}
inline bool isnan(double f) {
return _isnan(f);
}
inline bool isfinite(float f) {
return _finite(f);
}
inline bool isfinite(double f) {
return _finite(f);
}
inline bool isinf(float f) {
return !_finite(f);
}
inline bool isinf(double f) {
return !_finite(f);
}
};
#endif
#endif /* __MITSUBA_CORE_PLATFORM_H_ */ #endif /* __MITSUBA_CORE_PLATFORM_H_ */

View File

@ -20,90 +20,6 @@
#if !defined(__MITSUBA_CORE_STL_H_) #if !defined(__MITSUBA_CORE_STL_H_)
#define __MITSUBA_CORE_STL_H_ #define __MITSUBA_CORE_STL_H_
/* Include some SGI STL extensions, which might be missing */
#ifdef __GNUC__
#include <ext/functional>
using __gnu_cxx::select2nd;
using __gnu_cxx::compose1;
#else
#include <functional>
/// \cond
// (Don't include in the documentation)
namespace std {
template <class _Pair> struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> {
const typename _Pair::first_type& operator()(const _Pair& __x) const {
return __x.first;
}
};
template <class _Pair> struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> {
const typename _Pair::second_type& operator()(const _Pair& __x) const {
return __x.second;
}
};
template <class _Pair> struct select1st : public _Select1st<_Pair> {};
template <class _Pair> struct select2nd : public _Select2nd<_Pair> {};
template <class _Operation1, class _Operation2> class unary_compose : public unary_function<typename _Operation2::argument_type, typename _Operation1::result_type> {
protected:
_Operation1 _M_fn1;
_Operation2 _M_fn2;
public:
unary_compose(const _Operation1& __x, const _Operation2& __y) : _M_fn1(__x), _M_fn2(__y) {}
typename _Operation1::result_type operator()(const typename _Operation2::argument_type& __x) const {
return _M_fn1(_M_fn2(__x));
}
};
template <class _Operation1, class _Operation2> inline unary_compose<_Operation1,_Operation2> compose1(const _Operation1& __fn1, const _Operation2& __fn2) {
return unary_compose<_Operation1,_Operation2>(__fn1, __fn2);
}
#if defined(_MSC_VER)
#include <float.h>
#define snprintf _snprintf
#define vsnprintf _vsnprintf
inline char tolower(char c) {
return ::tolower(c);
}
inline char toupper(char c) {
return ::toupper(c);
}
inline bool isnan(float f) {
return _isnan(f);
}
inline bool isnan(double f) {
return _isnan(f);
}
inline bool isfinite(float f) {
return _finite(f);
}
inline bool isfinite(double f) {
return _finite(f);
}
inline bool isinf(float f) {
return !_finite(f);
}
inline bool isinf(double f) {
return !_finite(f);
}
#endif
};
using std::select2nd;
using std::compose1;
#endif
namespace mitsuba { namespace mitsuba {
namespace math { namespace math {
#if defined(__LINUX__) && defined(__x86_64__) #if defined(__LINUX__) && defined(__x86_64__)

View File

@ -78,9 +78,9 @@ void Class::initializeOnce(Class *theClass) {
} }
void Class::staticInitialization() { void Class::staticInitialization() {
std::for_each(__classes->begin(), __classes->end(), for (ClassMap::iterator it = __classes->begin();
compose1(std::ptr_fun(initializeOnce), it != __classes->end(); ++it)
select2nd<ClassMap::value_type>())); initializeOnce(it->second);
m_isInitialized = true; m_isInitialized = true;
} }