Functions: Wrap into blender namespace

Similar to previous commit, aims to resolve compilation on
devtoolset-6.
This commit is contained in:
Sergey Sharybin 2020-06-12 15:39:16 +02:00
parent f8696742bb
commit 9cc0597556
4 changed files with 16 additions and 4 deletions

@ -70,6 +70,7 @@
#include "BLI_math_base.h"
#include "BLI_string_ref.hh"
namespace blender {
namespace FN {
using blender::IndexMask;
@ -719,13 +720,14 @@ static std::unique_ptr<const CPPType> create_cpp_type(StringRef name, const T &d
}
} // namespace FN
} // namespace blender
#define MAKE_CPP_TYPE(IDENTIFIER, TYPE_NAME) \
static TYPE_NAME default_value_##IDENTIFIER; \
static std::unique_ptr<const FN::CPPType> CPPTYPE_##IDENTIFIER##_owner = \
FN::create_cpp_type<TYPE_NAME>(STRINGIFY(IDENTIFIER), default_value_##IDENTIFIER); \
const FN::CPPType &CPPType_##IDENTIFIER = *CPPTYPE_##IDENTIFIER##_owner; \
template<> const FN::CPPType &FN::CPPType::get<TYPE_NAME>() \
static std::unique_ptr<const blender::FN::CPPType> CPPTYPE_##IDENTIFIER##_owner = \
blender::FN::create_cpp_type<TYPE_NAME>(STRINGIFY(IDENTIFIER), default_value_##IDENTIFIER); \
const blender::FN::CPPType &CPPType_##IDENTIFIER = *CPPTYPE_##IDENTIFIER##_owner; \
template<> const blender::FN::CPPType &blender::FN::CPPType::get<TYPE_NAME>() \
{ \
return CPPType_##IDENTIFIER; \
}

@ -26,6 +26,7 @@
#include "FN_cpp_type.hh"
namespace blender {
namespace FN {
extern const CPPType &CPPType_bool;
@ -44,5 +45,6 @@ extern const CPPType &CPPType_Color4b;
extern const CPPType &CPPType_string;
} // namespace FN
} // namespace blender
#endif /* __FN_CPP_TYPES_HH__ */

@ -21,6 +21,7 @@
#include "BLI_float3.hh"
#include "BLI_float4x4.hh"
namespace blender {
namespace FN {
MAKE_CPP_TYPE(bool, bool)
@ -39,3 +40,4 @@ MAKE_CPP_TYPE(Color4b, blender::Color4b)
MAKE_CPP_TYPE(string, std::string)
} // namespace FN
} // namespace blender

@ -19,6 +19,9 @@
#include "FN_cpp_type.hh"
namespace blender {
namespace FN {
static const int default_constructed_value = 1;
static const int copy_constructed_value = 2;
static const int move_constructed_value = 3;
@ -297,3 +300,6 @@ TEST(cpp_type, FillUninitialized)
EXPECT_EQ(buffer2[8], copy_constructed_value);
EXPECT_EQ(buffer2[9], 0);
}
} // namespace FN
} // namespace blender