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

STYLE: OTB-134/OGR ...

parent cf6d4087
No related branches found
No related tags found
No related merge requests found
......@@ -28,8 +28,8 @@
/*===========================================================================*/
/*===========================[ Static Assertions ]===========================*/
/*===========================================================================*/
namespace types_
{
namespace otb { namespace ogr {
namespace metaprog {
BOOST_STATIC_ASSERT(!(boost::is_same<
MemberGetterPtr<int, &OGRFeature::GetFieldAsInteger>,
MemberGetterPtr<double, &OGRFeature::GetFieldAsDouble>
......@@ -67,6 +67,7 @@ BOOST_STATIC_ASSERT(!(boost::is_same<
>::value
));
}
} } // end namespace otb::ogr
/*===========================================================================*/
/*===============================[ FieldDefn ]===============================*/
......
......@@ -37,24 +37,9 @@ class OGRFieldDefn;
#include "itkIndent.h"
#include <cassert>
#if 0
#include <iomanip>
template <typename RT, typename CT> void print_adress(RT (CT::*p)(int))
{
unsigned char const * first = reinterpret_cast<unsigned char *>(&p);
unsigned char const * last = reinterpret_cast<unsigned char *>(&p + 1);
for (; first != last; ++first)
{
std::cout << std::hex << std::setw(2) << std::setfill('0')
<< (int)*first << ' ';
}
std::cout << "\n";
}
#endif
namespace otb { namespace ogr {
namespace types_ { // namespace types_
namespace metaprog { // namespace metaprog
using namespace boost::mpl;
typedef boost::mpl::map
< pair<int, int_<OFTInteger> >
......@@ -107,9 +92,8 @@ typedef map
// , pair<int_<OFTStringList>, MemberGetterPtr<char const*, &OGRFeature::GetFieldAsString, std::string> >
> FieldGetters_Map;
} // namespace types_
} // namespace metaprog
namespace otb { namespace ogr {
class FieldDefn
{
public:
......@@ -185,11 +169,11 @@ public:
#endif
template <typename T> T GetValue() const
{
const int VALUE = boost::mpl::at<types_::FieldType_Map, T>::type::value;
typedef typename boost::mpl::at<types_::FieldType_Map, T>::type Kind;
const int VALUE = boost::mpl::at<metaprog::FieldType_Map, T>::type::value;
typedef typename boost::mpl::at<metaprog::FieldType_Map, T>::type Kind;
BOOST_STATIC_ASSERT(!(boost::is_same<Kind, boost::mpl::void_>::value));
assert(m_Definition.GetType() == Kind::value);
typedef typename boost::mpl::at<types_::FieldGetters_Map, Kind>::type GetterType;
typedef typename boost::mpl::at<metaprog::FieldGetters_Map, Kind>::type GetterType;
BOOST_STATIC_ASSERT(!(boost::is_same<GetterType, boost::mpl::void_>::value));
assert(m_index >= 0 && m_index < m_Feature->GetFieldCount());
return GetterType::call(*m_Feature, m_index);
......@@ -199,7 +183,9 @@ public:
private:
FieldDefn m_Definition;
boost::shared_ptr<OGRFeature> & m_Feature;
size_t m_index; // all the fields decoding is at the wrong place (OGRFeature instead of OGRField)
// all the fields decoding is at the wrong place (OGRFeature instead of
// OGRField) => need for an index
size_t m_index;
};
} } // end namespace otb::ogr
......
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