Skip to content
Snippets Groups Projects
Commit 92f37c3b authored by Luc Hermitte's avatar Luc Hermitte
Browse files

COM: OTB-134/OGR -> Compilation issue under VC2008/Debug

parent bb3e509b
No related branches found
No related tags found
No related merge requests found
......@@ -66,18 +66,18 @@ BOOST_STATIC_ASSERT(!(boost::is_same<
>::value
));
BOOST_STATIC_ASSERT((boost::is_array<int[42]>::value));
BOOST_STATIC_ASSERT(!(boost::is_array<boost::array<int, 42> >::value));
BOOST_STATIC_ASSERT(!(boost::is_array<std::vector<int> >::value));
BOOST_MPL_ASSERT((boost::is_array<int[42]>));
BOOST_MPL_ASSERT_NOT((boost::is_array<boost::array<int, 42> >));
BOOST_MPL_ASSERT_NOT((boost::is_array<std::vector<int> >));
BOOST_STATIC_ASSERT((boost::is_contiguous<int*>::value));
BOOST_STATIC_ASSERT((boost::is_contiguous<int[42]>::value));
BOOST_STATIC_ASSERT((boost::is_contiguous<boost::array<int, 42> >::value));
BOOST_STATIC_ASSERT((boost::is_contiguous<std::vector<int> >::value));
BOOST_STATIC_ASSERT((boost::is_same<int, CppToOGRConverter_trait<int>::type >::value));
BOOST_STATIC_ASSERT((boost::is_same<char*, CppToOGRConverter_trait<char[8]>::type >::value));
BOOST_STATIC_ASSERT(!(boost::is_same<char*, char[8] >::value));
BOOST_MPL_ASSERT((boost::is_same<int, CppToOGRConverter_trait<int>::type >));
BOOST_MPL_ASSERT((boost::is_same<char*, CppToOGRConverter_trait<char[8]>::type >));
BOOST_MPL_ASSERT_NOT((boost::is_same<char*, char[8] >));
}
} } // end namespace otb::ogr
......
......@@ -119,19 +119,6 @@ public:
*/
template <typename T> void SetValue(T const& value);
/**
* Value setter.
* This overload is meant to help type promotions from <tt>char const[42]</tt> to
* <tt>char const*</tt>.
* \param[in] value New value for the field.
* \throw None
* \pre \c value's kind must match the field's type.
* \internal
* This function automagically decodes the type of the parameter in order to
* use the ad'hoc setter from \c OGRFeature.
*/
template <typename T, size_t N> void SetValue(T const value[N]);
/**
* Value getter.
* \tparam T expected type for the stored value.
......
......@@ -30,6 +30,8 @@
#include <boost/mpl/pair.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/assert.hpp>
// #include <boost/mpl/print.hpp>
#include <boost/static_assert.hpp>
#include <boost/range/size.hpp>
......@@ -72,6 +74,7 @@ typedef boost::mpl::map
, pair<std::vector<double> , int_<OFTRealList> >
, pair<std::string , int_<OFTString> >
, pair<char* , int_<OFTString> >
, pair<char const* , int_<OFTString> >
, pair<std::vector<std::string>, int_<OFTStringList> >
// OFTBinary
// OFTDate
......@@ -383,25 +386,20 @@ void otb::ogr::Field::SetValue(T const& value)
CheckInvariants();
typedef internal::CppToOGRConverter_trait<T> Converter;
typedef typename Converter::type InterfaceType;
// BOOST_STATIC_ASSERT(!(boost::is_array<InterfaceType>::value));
// uncomment the next line to debug the InterfaceType computed
// boost::mpl::print<typename internal::CppToOGRConverter_trait<T>::type> interface_type; (void) interface_type;
BOOST_MPL_ASSERT_MSG(!boost::is_array<InterfaceType>::value, InterFaceType_Cant_Be_An_array, (T, InterfaceType));
typedef typename boost::mpl::at<internal::FieldType_Map, InterfaceType>::type Kind;
BOOST_MPL_ASSERT_MSG(!(boost::is_same<Kind, boost::mpl::void_>::value), UNEXPECTED_KIND_TYPE, (T, InterfaceType, Kind));
const int VALUE = Kind::value;
BOOST_STATIC_ASSERT(!(boost::is_same<Kind, boost::mpl::void_>::value));
assert(m_Definition.GetType() == VALUE && "OGR field type mismatches the type of new field value");
typedef typename boost::mpl::at<internal::FieldSetters_Map, Kind>::type SetterType;
// If you experience a static assertion failure in the line below, it means
// the type of the parameter is not supported to set a field.
BOOST_STATIC_ASSERT(!(boost::is_same<SetterType, boost::mpl::void_>::value));
BOOST_MPL_ASSERT_NOT((boost::is_same<SetterType, boost::mpl::void_>));
SetterType::call(*m_Feature, m_index, Converter::convert(value));
}
template <typename T, size_t N>
inline
void otb::ogr::Field::SetValue(T const value[N])
{
this->SetValue(&value[0]);
}
template <typename T>
inline
T otb::ogr::Field::GetValue() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment