Commit 4a2691ff authored by Victor Poughon's avatar Victor Poughon

ENH: Replace ITK_NULLPTR by nullptr

parent 64983845
......@@ -65,7 +65,7 @@ private:
otb::ogr::UniqueGeometryPtr
ReprojectTransformationFunctor::operator()(OGRGeometry const* in) const
{
otb::ogr::UniqueGeometryPtr out(in ? in->clone() : ITK_NULLPTR);
otb::ogr::UniqueGeometryPtr out(in ? in->clone() : nullptr);
if (out)
{
const OGRErr err = out->transform(m_reprojector.get());
......@@ -207,7 +207,7 @@ int main (int argc, char **argv)
otb::ogr::DataSource::Pointer output
= options.workingInplace ? input
: options.outputIsStdout ? ITK_NULLPTR
: options.outputIsStdout ? nullptr
: otb::ogr::DataSource::New( options.outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly);
std::cout << "input: " << otb::ogr::version_proxy::GetFileListAsStringVector(&input->ogr())[0] << " should be: " << options.inputFile << "\n";
if (output)
......@@ -234,7 +234,7 @@ int main (int argc, char **argv)
}
else
{
filter->UpdateOutputData(ITK_NULLPTR);
filter->UpdateOutputData(nullptr);
assert(filter->GetOutput() && "output not set");
filter->GetOutput()->Print(std::cout, 0);
}
......
......@@ -35,7 +35,7 @@ struct SwapXYFunctor
typedef OGRGeometry TransformedElementType;
otb::ogr::UniqueGeometryPtr operator()(OGRGeometry const* in) const
{
otb::ogr::UniqueGeometryPtr out(in ? in->clone() : ITK_NULLPTR);
otb::ogr::UniqueGeometryPtr out(in ? in->clone() : nullptr);
if (out)
{
#if GDAL_VERSION_NUM >= 1900
......@@ -74,7 +74,7 @@ int main (int argc, char **argv)
otb::ogr::DataSource::Pointer output
= workingInplace ? input
: outputIsStdout ? ITK_NULLPTR
: outputIsStdout ? nullptr
: otb::ogr::DataSource::New( outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly);
std::cout << "input: " << otb::ogr::version_proxy::GetFileListAsStringVector(&input->ogr())[0] << " should be: " << inputFile << "\n";
if (output)
......@@ -97,7 +97,7 @@ int main (int argc, char **argv)
}
else
{
filter->UpdateOutputData(ITK_NULLPTR);
filter->UpdateOutputData(nullptr);
assert(filter->GetOutput() && "output not set");
filter->GetOutput()->Print(std::cout, 0);
}
......
......@@ -109,7 +109,7 @@ int main(int argc, char * argv[])
otb::ogr::DataSource::Pointer destination = otb::ogr::DataSource::New(
argv[2], otb::ogr::DataSource::Modes::Update_LayerCreateOnly);
otb::ogr::Layer destLayer = destination->CreateLayer(
argv[2], ITK_NULLPTR, wkbMultiPolygon);
argv[2], nullptr, wkbMultiPolygon);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......
......@@ -102,7 +102,7 @@ int main(int argc, char * argv[])
// Software Guide : EndCodeSnippet
char * fileNameIn = argv[1];
char * fileNameImgInit = ITK_NULLPTR;
char * fileNameImgInit = nullptr;
char * fileNameOut = argv[2];
int numberOfClasses = atoi(argv[3]);
int numberOfIteration = atoi(argv[4]);
......@@ -148,7 +148,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
if (fileNameImgInit != ITK_NULLPTR)
if (fileNameImgInit != nullptr)
{
typedef otb::ImageFileReader<OutputImageType> ImgInitReaderType;
ImgInitReaderType::Pointer segReader = ImgInitReaderType::New();
......
......@@ -408,7 +408,7 @@ int main(int itkNotUsed(argc), char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
if (actMapFileName != ITK_NULLPTR)
if (actMapFileName != nullptr)
{
ActivationWriterType::Pointer actWriter = ActivationWriterType::New();
actWriter->SetFileName(actMapFileName);
......
......@@ -155,8 +155,8 @@ int main(int argc, char* argv[])
orthoRectifFilter->SetDisplacementFieldSpacing(gridSpacing);
ImageType::PointType origin;
origin[0] = strtod(argv[5], ITK_NULLPTR);
origin[1] = strtod(argv[6], ITK_NULLPTR);
origin[0] = strtod(argv[5], nullptr);
origin[1] = strtod(argv[6], nullptr);
orthoRectifFilter->SetOutputOrigin(origin);
// Software Guide : EndCodeSnippet
......
......@@ -187,8 +187,8 @@ int main(int argc, char* argv[])
spacing[1] = -0.00001;
ImageType::PointType origin;
origin[0] = strtod(argv[3], ITK_NULLPTR); //longitude
origin[1] = strtod(argv[4], ITK_NULLPTR); //latitude
origin[0] = strtod(argv[3], nullptr); //longitude
origin[1] = strtod(argv[4], nullptr); //latitude
ImageType::RegionType region;
......
......@@ -133,7 +133,7 @@ public:
protected:
ImageUniqueValuesCalculator()
{
m_Image = ITK_NULLPTR;
m_Image = nullptr;
}
~ImageUniqueValuesCalculator() ITK_OVERRIDE
{
......@@ -472,7 +472,7 @@ private:
int main(int argc, char *argv[])
{
char *cmifname = ITK_NULLPTR;
char *cmifname = nullptr;
if (argc != 10)
{
if (argc == 11) // cloud mask filename optional parameter
......@@ -807,7 +807,7 @@ int main(int argc, char *argv[])
miReader->UpdateOutputInformation();
MaskImageType::Pointer maskImage = miReader->GetOutput();
if (cmifname != ITK_NULLPTR)
if (cmifname != nullptr)
{
MaskReaderType::Pointer cmiReader = MaskReaderType::New();
......
......@@ -142,8 +142,8 @@ int main(int argc, char* argv[])
spacing[1] = atof(argv[11]);
ImageType::PointType origin;
origin[0] = strtod(argv[6], ITK_NULLPTR);
origin[1] = strtod(argv[7], ITK_NULLPTR);
origin[0] = strtod(argv[6], nullptr);
origin[1] = strtod(argv[7], nullptr);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......
......@@ -178,7 +178,7 @@ public:
{
m_File = fopen(infname, "wb");
if (m_File == ITK_NULLPTR)
if (m_File == nullptr)
{
itkExceptionMacro(<<" otbCurlHelper::FileResource : failed to open the file ."<< infname);
}
......
......@@ -283,7 +283,7 @@ public:
* \return the extent of all layers
* \throw itk::ExceptionObject if the layers extents can not be retrieved.
*/
OGREnvelope GetGlobalExtent(bool force = false, std::string * outwkt=ITK_NULLPTR) const;
OGREnvelope GetGlobalExtent(bool force = false, std::string * outwkt=nullptr) const;
/** Grafts data and information from one data source to another.
* \deprecated \c OGRLayer has an embedded input iterator. As a consequence,
......@@ -330,7 +330,7 @@ public:
*/
Layer CreateLayer(
std::string const& name,
OGRSpatialReference * poSpatialRef = ITK_NULLPTR,
OGRSpatialReference * poSpatialRef = nullptr,
OGRwkbGeometryType eGType = wkbUnknown,
std::vector<std::string> const& papszOptions = std::vector<std::string>());
......@@ -473,7 +473,7 @@ public:
* \see <em>Imperfect C++</em>, Matthew Wilson, Addisson-Welsey, par 24.6
*/
operator int boolean ::* () const {
return m_DataSource ? &boolean::i : ITK_NULLPTR;
return m_DataSource ? &boolean::i : nullptr;
}
/** Flushes all changes to disk.
......
......@@ -82,7 +82,7 @@ struct OTBGdalAdapters_EXPORT StringListConverter
{
m_raw.push_back(b->c_str());
}
m_raw.push_back(ITK_NULLPTR);
m_raw.push_back(nullptr);
assert(CSLCount(const_cast <char**>(&m_raw[0])) == static_cast<int>(boost::size(strings)));
}
/**
......@@ -91,7 +91,7 @@ struct OTBGdalAdapters_EXPORT StringListConverter
char ** to_ogr() const
{
return m_raw.size() == 1
? ITK_NULLPTR
? nullptr
: const_cast <char**>(&m_raw[0]);
}
private:
......
......@@ -234,7 +234,7 @@ public:
*/
operator int boolean ::* () const
{
return m_Layer ? &boolean::i : ITK_NULLPTR;
return m_Layer ? &boolean::i : nullptr;
}
/** Access to raw \c OGRLayer.
......@@ -336,12 +336,12 @@ public:
struct enabler {};
public:
feature_iter()
: m_Layer(ITK_NULLPTR), m_Crt(ITK_NULLPTR) {}
: m_Layer(nullptr), m_Crt(nullptr) {}
explicit feature_iter(otb::ogr::Layer & layer)
: m_Layer(&layer), m_Crt(layer.GetNextFeature()) {}
template <class OtherValue> feature_iter(
feature_iter<OtherValue> const& other,
typename boost::enable_if<boost::is_convertible<OtherValue*,Value*> >::type* = ITK_NULLPTR
typename boost::enable_if<boost::is_convertible<OtherValue*,Value*> >::type* = nullptr
)
: m_Layer(other.m_Layer), m_Crt(other.m_Crt)
{}
......
......@@ -218,7 +218,7 @@ void otb::GeometriesToGeometriesFilter::GenerateData(void )
OGRSpatialReference* otb::GeometriesToGeometriesFilter::DoDefineNewLayerSpatialReference(
ogr::Layer const& itkNotUsed(source)) const
{
return ITK_NULLPTR;
return nullptr;
}
/*virtual*/
......
......@@ -44,7 +44,7 @@
bool otb::ogr::DataSource::Clear()
{
Reset(ITK_NULLPTR);
Reset(nullptr);
return true;
}
......@@ -111,7 +111,7 @@ char const* DeduceDriverName(std::string filename)
boost::bind(&ExtensionDriverAssociation::Matches, _1, extension));
if (whichIt == boost::end(k_ExtensionDriverMap))
{
return ITK_NULLPTR; // nothing found
return nullptr; // nothing found
}
return whichIt->driverName;
}
......@@ -119,7 +119,7 @@ char const* DeduceDriverName(std::string filename)
otb::ogr::DataSource::DataSource()
: m_DataSource(ITK_NULLPTR),
: m_DataSource(nullptr),
m_LayerOptions() ,
m_OpenMode(Modes::Update_LayerUpdate),
m_FirstModifiableLayerID(0)
......@@ -231,7 +231,7 @@ otb::ogr::DataSource::New(std::string const& datasourceName, Modes::type mode)
ogr::version_proxy::GDALDatasetType * ds =
ogr::version_proxy::Open( simpleFileName.c_str() , true );
bool ds_exists = (ds!=ITK_NULLPTR);
bool ds_exists = (ds!=nullptr);
ogr::version_proxy::Close(ds);
......@@ -398,7 +398,7 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer(
}
itkGenericExceptionMacro(<< "GDALDataset opening mode not supported");
return Layer(ITK_NULLPTR, false); // keep compiler happy
return Layer(nullptr, false); // keep compiler happy
}
otb::ogr::Layer otb::ogr::DataSource::CopyLayer(
......@@ -614,7 +614,7 @@ otb::ogr::Layer otb::ogr::DataSource::ExecuteSQL(
// Cannot use the deleter made for result sets obtained from
// GDALDataset::ExecuteSQL because it checks for non-nullity....
// *sigh*
return otb::ogr::Layer(ITK_NULLPTR, modifiable);
return otb::ogr::Layer(nullptr, modifiable);
#endif
}
return otb::ogr::Layer(layer_ptr, *m_DataSource, modifiable);
......
......@@ -279,7 +279,7 @@ OGRSpatialReference const* otb::ogr::Layer::GetSpatialRef() const
std::string otb::ogr::Layer::GetProjectionRef() const
{
assert(m_Layer && "OGRLayer not initialized");
char * wkt = ITK_NULLPTR;
char * wkt = nullptr;
OGRSpatialReference const* srs = GetSpatialRef();
if(srs)
{
......
......@@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_shp_overwrite)
ogr::DataSource::Pointer ds
= ogr::DataSource::New(filename, ogr::DataSource::Modes::Overwrite);
BOOST_ASSERT(ds);
ogr::Layer l = ds -> CreateLayer(layer1, ITK_NULLPTR, wkbPoint);
ogr::Layer l = ds -> CreateLayer(layer1, nullptr, wkbPoint);
OGRFeatureDefn & defn = l.GetLayerDefn();
l.CreateField(k_f0);
l.CreateField(k_f1);
......@@ -225,7 +225,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_shp_overwrite)
ogr::DataSource::Pointer ds
= ogr::DataSource::New(filename, ogr::DataSource::Modes::Overwrite);
BOOST_ASSERT(ds);
ogr::Layer l = ds -> CreateLayer(layer1, ITK_NULLPTR, wkbPoint);
ogr::Layer l = ds -> CreateLayer(layer1, nullptr, wkbPoint);
OGRFeatureDefn & defn = l.GetLayerDefn();
l.CreateField(k_f0);
l.CreateField(k_f1);
......@@ -476,7 +476,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_sqlite_overwrite)
ogr::DataSource::Pointer ds
= ogr::DataSource::New(filename, ogr::DataSource::Modes::Overwrite);
BOOST_ASSERT(ds);
ogr::Layer l = ds -> CreateLayer(layer1, ITK_NULLPTR, wkbPoint);
ogr::Layer l = ds -> CreateLayer(layer1, nullptr, wkbPoint);
OGRFeatureDefn & defn = l.GetLayerDefn();
l.CreateField(k_f0);
l.CreateField(k_f1);
......@@ -510,7 +510,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_sqlite_overwrite)
ogr::DataSource::Pointer ds
= ogr::DataSource::New(filename, ogr::DataSource::Modes::Overwrite);
BOOST_ASSERT(ds);
ogr::Layer l = ds -> CreateLayer(layer1, ITK_NULLPTR, wkbPoint);
ogr::Layer l = ds -> CreateLayer(layer1, nullptr, wkbPoint);
OGRFeatureDefn & defn = l.GetLayerDefn();
l.CreateField(k_f0);
l.CreateField(k_f1);
......@@ -603,7 +603,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_sqlite_overwrite)
// Check that we can read the file
BOOST_ASSERT(ds);
ogr::Layer l = ds -> CreateLayer(layer1, ITK_NULLPTR, wkbPoint);
ogr::Layer l = ds -> CreateLayer(layer1, nullptr, wkbPoint);
BOOST_CHECK_EQUAL(l.GetFeatureCount(true), 0);
// OGRFeatureDefn & defn = l.GetLayerDefn();
......@@ -678,7 +678,7 @@ BOOST_AUTO_TEST_CASE(Add_n_Del_Fields)
ogr::FieldDefn f5(*defn.GetFieldDefn(5));
BOOST_CHECK_EQUAL(f5, k_f5);
BOOST_CHECK_EQUAL(defn.GetFieldDefn(6), (void*)ITK_NULLPTR);
BOOST_CHECK_EQUAL(defn.GetFieldDefn(6), (void*)nullptr);
}
#if GDAL_VERSION_NUM >= 1900
......@@ -802,7 +802,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_new_shp_with_features)
const std::string k_shp = "SomeShapeFileWithFeatures";
ogr::DataSource::Pointer ds = ogr::DataSource::New(k_shp+".shp", ogr::DataSource::Modes::Overwrite);
ogr::Layer l = ds -> CreateLayer(k_one, ITK_NULLPTR, wkbPoint);
ogr::Layer l = ds -> CreateLayer(k_one, nullptr, wkbPoint);
OGRFeatureDefn & defn = l.GetLayerDefn();
l.CreateField(k_f0);
......@@ -840,7 +840,7 @@ BOOST_AUTO_TEST_CASE(Local_Geometries)
BOOST_AUTO_TEST_CASE(Add_n_Read_Geometries)
{
ogr::DataSource::Pointer ds = ogr::DataSource::New();
ogr::Layer l = ds -> CreateLayer(k_one, ITK_NULLPTR, wkbPoint);
ogr::Layer l = ds -> CreateLayer(k_one, nullptr, wkbPoint);
OGRFeatureDefn & defn = l.GetLayerDefn();
for (int u=-10; u!=10; ++u) {
......
......@@ -45,7 +45,7 @@ int otbOGRExtendedFileNameGDALLayer(int , char* argv[])
{
auto test = otb::ogr::DataSource::New( argv[1] , otb::ogr::DataSource::Modes::Update_LayerOverwrite);
test->CreateLayer( "2layertest" ,
ITK_NULLPTR ,
nullptr ,
wkbUnknown );
std::string error = CPLGetLastErrorMsg();
if ( error.find( "does not support layer creation option layeroption" ) )
......@@ -58,7 +58,7 @@ int otbOGRExtendedFileNameGDALLayerOption(int , char* argv[])
auto test = otb::ogr::DataSource::New( argv[1] , otb::ogr::DataSource::Modes::Update_LayerOverwrite);
std::vector<std::string> option { "vectorlayeroption=OPTION" };
test->CreateLayer( "2layertest" ,
ITK_NULLPTR ,
nullptr ,
wkbUnknown ,
option );
std::string error = CPLGetLastErrorMsg();
......
......@@ -92,7 +92,7 @@ int DEMConvertAdapter::Convert(std::string tempFilename, std::string output)
ih->initialize();
ossimRefPtr<ossimImageSource> source = ih.get();
ossimRefPtr<ossimBandSelector> bs = ITK_NULLPTR;
ossimRefPtr<ossimBandSelector> bs = nullptr;
// Get the image rectangle for the rrLevel selected.
......
......@@ -51,15 +51,15 @@
namespace otb
{
/** Initialize the singleton */
DEMHandler::Pointer DEMHandler::m_Singleton = ITK_NULLPTR;
DEMHandler::Pointer DEMHandler::m_Singleton = nullptr;
DEMHandler::Pointer DEMHandler::Instance()
{
if(m_Singleton.GetPointer() == ITK_NULLPTR)
if(m_Singleton.GetPointer() == nullptr)
{
m_Singleton = itk::ObjectFactory<Self>::Create();
if(m_Singleton.GetPointer() == ITK_NULLPTR)
if(m_Singleton.GetPointer() == nullptr)
{
m_Singleton = new DEMHandler;
}
......@@ -152,7 +152,7 @@ bool
DEMHandler
::OpenGeoidFile(const char* geoidFile)
{
if ((ossimGeoidManager::instance()->findGeoidByShortName("geoid1996")) == ITK_NULLPTR)
if ((ossimGeoidManager::instance()->findGeoidByShortName("geoid1996")) == nullptr)
{
otbMsgDevMacro(<< "Opening geoid: " << geoidFile);
ossimFilename geoid(geoidFile);
......
......@@ -32,7 +32,7 @@ DateTimeAdapter::DateTimeAdapter()
DateTimeAdapter::~DateTimeAdapter()
{
if (m_LocalTm != ITK_NULLPTR)
if (m_LocalTm != nullptr)
{
delete m_LocalTm;
}
......
......@@ -44,7 +44,7 @@ EllipsoidAdapter::EllipsoidAdapter()
EllipsoidAdapter::~EllipsoidAdapter()
{
if (m_Ellipsoid != ITK_NULLPTR)
if (m_Ellipsoid != nullptr)
{
delete m_Ellipsoid;
}
......
......@@ -45,16 +45,16 @@
namespace otb {
GeometricSarSensorModelAdapter::GeometricSarSensorModelAdapter():
m_SensorModel(ITK_NULLPTR)
m_SensorModel(nullptr)
{
}
GeometricSarSensorModelAdapter::~GeometricSarSensorModelAdapter()
{
if (m_SensorModel != ITK_NULLPTR)
if (m_SensorModel != nullptr)
{
delete m_SensorModel;
m_SensorModel = ITK_NULLPTR;
m_SensorModel = nullptr;
}
}
......
......@@ -359,15 +359,15 @@ ReadGeometryFromRPCTag(const std::string& filename)
// try to use GeoTiff RPC tag if present.
// Warning : RPC in subdatasets are not supported
GDALDriverH identifyDriverH = GDALIdentifyDriver(filename.c_str(), ITK_NULLPTR);
if(identifyDriverH == ITK_NULLPTR)
GDALDriverH identifyDriverH = GDALIdentifyDriver(filename.c_str(), nullptr);
if(identifyDriverH == nullptr)
{
// If no driver has identified the dataset, don't try to open it and exit
return otb_kwl;
}
GDALDatasetH datasetH = GDALOpen(filename.c_str(), GA_ReadOnly);
if (datasetH != ITK_NULLPTR)
if (datasetH != nullptr)
{
GDALDataset* dataset = static_cast<GDALDataset*>(datasetH);
GDALRPCInfo rpcStruct;
......
......@@ -76,13 +76,13 @@ namespace otb
{
MapProjectionAdapter::MapProjectionAdapter():
m_MapProjection(ITK_NULLPTR), m_ProjectionRefWkt(""), m_ReinstanciateProjection(true)
m_MapProjection(nullptr), m_ProjectionRefWkt(""), m_ReinstanciateProjection(true)
{
}
MapProjectionAdapter::~MapProjectionAdapter()
{
if (m_MapProjection != ITK_NULLPTR)
if (m_MapProjection != nullptr)
{
delete m_MapProjection;
}
......@@ -91,7 +91,7 @@ MapProjectionAdapter::~MapProjectionAdapter()
MapProjectionAdapter::InternalMapProjectionPointer MapProjectionAdapter::GetMapProjection()
{
itkDebugMacro("returning MapProjection address " << this->m_MapProjection);
if ((m_ReinstanciateProjection) || (m_MapProjection == ITK_NULLPTR))
if ((m_ReinstanciateProjection) || (m_MapProjection == nullptr))
{
this->InstantiateProjection();
}
......@@ -102,7 +102,7 @@ MapProjectionAdapter::InternalMapProjectionPointer MapProjectionAdapter::GetMapP
MapProjectionAdapter::InternalMapProjectionConstPointer MapProjectionAdapter::GetMapProjection() const
{
itkDebugMacro("returning MapProjection address " << this->m_MapProjection);
if ((m_ReinstanciateProjection) || (m_MapProjection == ITK_NULLPTR))
if ((m_ReinstanciateProjection) || (m_MapProjection == nullptr))
{
itkExceptionMacro(<< "m_MapProjection not up-to-date, call InstantiateProjection() first");
}
......@@ -114,7 +114,7 @@ std::string MapProjectionAdapter::GetWkt() const
{
ossimKeywordlist kwl;
this->GetMapProjection();
if (m_MapProjection == ITK_NULLPTR)
if (m_MapProjection == nullptr)
{
return "";
}
......@@ -227,7 +227,7 @@ std::string MapProjectionAdapter::GetParameter(const std::string& key) const
bool MapProjectionAdapter::InstantiateProjection()
{
if ((this->m_ReinstanciateProjection) || (m_MapProjection == ITK_NULLPTR))
if ((this->m_ReinstanciateProjection) || (m_MapProjection == nullptr))
{
ossimKeywordlist kwl;
ossimOgcWktTranslator wktTranslator;
......@@ -258,7 +258,7 @@ bool MapProjectionAdapter::InstantiateProjection()
// ossimUtmProjection for example)
ossimString name(m_ProjectionRefWkt);
m_MapProjection = ossimMapProjectionFactory::instance()->createProjection(name);
if (m_MapProjection == ITK_NULLPTR)
if (m_MapProjection == nullptr)