Skip to content

Commit

Permalink
Refs #4399. Fix for using long on the Mac.
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Mar 6, 2012
1 parent 37d37ae commit dac33c2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
30 changes: 13 additions & 17 deletions Code/Mantid/Framework/Kernel/src/PropertyWithValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,21 @@ namespace Mantid

namespace Kernel
{

/// @cond
template DLLExport class PropertyWithValue<int32_t>;
template DLLExport class PropertyWithValue<int64_t>;
template DLLExport class PropertyWithValue<size_t>;
template DLLExport class PropertyWithValue<bool>;
template DLLExport class PropertyWithValue<double>;
template DLLExport class PropertyWithValue<std::string>;

template DLLExport class PropertyWithValue<std::vector<double> >;
template DLLExport class PropertyWithValue<std::vector<std::string> >;
template DLLExport class PropertyWithValue<std::vector<uint16_t> >;
template DLLExport class PropertyWithValue<std::vector<int16_t> >;
template DLLExport class PropertyWithValue<std::vector<uint32_t> >;
template DLLExport class PropertyWithValue<std::vector<int32_t> >;
template DLLExport class PropertyWithValue<std::vector<uint64_t> >;
template DLLExport class PropertyWithValue<std::vector<int64_t> >;
#define INSTANTIATE(Type) \
template DLLExport class PropertyWithValue<Type>; \
template DLLExport class PropertyWithValue<std::vector<Type> >;

template DLLExport class PropertyWithValue<std::vector<std::vector<std::string> > >;
// Explicit instantiations
INSTANTIATE(int);
INSTANTIATE(long);
INSTANTIATE(long long);
INSTANTIATE(unsigned int);
INSTANTIATE(unsigned long);
INSTANTIATE(unsigned long long);
INSTANTIATE(bool);
INSTANTIATE(double);
INSTANTIATE(std::string);
/// @endcond

} // namespace Kernel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Mantid

// Map the Python types to the best match in C++
REGISTER_MAPPING(PyFloat_Type, double);
REGISTER_MAPPING(PyInt_Type, int);
REGISTER_MAPPING(PyInt_Type, long);
REGISTER_MAPPING(PyString_Type, std::string);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ def BoundedValidator(lower = None, upper = None):
raise TypeError("Cannot create a BoundedValidator with both lower and upper limit unset.")

def get_validator_class(value):
from mantid.kernel import BoundedValidator_double, BoundedValidator_int
if type(value) == float:
from mantid.kernel import BoundedValidator_double
return BoundedValidator_double
elif type(value) == int:
from mantid.kernel import BoundedValidator_int
return BoundedValidator_int
from mantid.kernel import BoundedValidator_long
return BoundedValidator_long
else:
raise TypeError("Unknown type passed for BoundedValidator: %s" % str(type(value)))
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PropertyWithValueFactoryTest: public CxxTest::TestSuite

void test_builtin_type_creates_int_type_property_without_error()
{
CREATE_PROPERTY_TEST_BODY(int, PyInt_FromLong(10));
CREATE_PROPERTY_TEST_BODY(long, PyInt_FromLong(10));
}

void test_builtin_type_creates_double_type_property_without_error()
Expand Down

0 comments on commit dac33c2

Please sign in to comment.