Skip to content
Snippets Groups Projects
Commit a492501f authored by Julien Michel's avatar Julien Michel
Browse files

STY: Use std::auto_ptr instead of bare * (from RFC review)

parent 8088150a
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,8 @@
#ifndef otbSarSensorModelAdapter_h
#define otbSarSensorModelAdapter_h
#include <memory>
#include "otbDEMHandler.h"
namespace ossimplugins
......@@ -55,7 +57,7 @@ public:
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef ossimplugins::ossimSarSensorModel* InternalModelPointer;
typedef std::auto_ptr<ossimplugins::ossimSarSensorModel> InternalModelPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
......
......@@ -46,9 +46,7 @@ SarSensorModelAdapter::SarSensorModelAdapter():
}
SarSensorModelAdapter::~SarSensorModelAdapter()
{
delete m_SensorModel;
}
{}
bool SarSensorModelAdapter::LoadState(const ImageKeywordlist& image_kwl)
{
......@@ -57,19 +55,15 @@ bool SarSensorModelAdapter::LoadState(const ImageKeywordlist& image_kwl)
ossimKeywordlist geom;
image_kwl.convertToOSSIMKeywordlist(geom);
if(m_SensorModel != ITK_NULLPTR)
{
delete m_SensorModel;
}
m_SensorModel = dynamic_cast<ossimplugins::ossimSarSensorModel* >(ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(geom));
m_SensorModel.reset(dynamic_cast<ossimplugins::ossimSarSensorModel* >(ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(geom)));
return IsValidSensorModel();
}
bool SarSensorModelAdapter::SaveState(ImageKeywordlist & image_kwl)
{
if(m_SensorModel != ITK_NULLPTR)
if(m_SensorModel.get() != ITK_NULLPTR)
{
ossimKeywordlist geom;
......@@ -89,12 +83,12 @@ bool SarSensorModelAdapter::SaveState(ImageKeywordlist & image_kwl)
bool SarSensorModelAdapter::IsValidSensorModel() const
{
return m_SensorModel != ITK_NULLPTR;
return m_SensorModel.get() != ITK_NULLPTR;
}
bool SarSensorModelAdapter::Deburst(std::vector<std::pair<unsigned long, unsigned long>> & lines)
{
if(m_SensorModel != ITK_NULLPTR)
if(m_SensorModel.get() != ITK_NULLPTR)
{
return m_SensorModel->deburst(lines);
}
......
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