replace deprecated auto_ptr with unique_ptr

This commit is contained in:
wmayer
2016-09-22 13:01:20 +02:00
parent 1ce73dda96
commit f944ab3846
47 changed files with 129 additions and 129 deletions

View File

@@ -132,7 +132,7 @@ private:
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
std::auto_ptr<FemMesh> mesh(new FemMesh);
std::unique_ptr<FemMesh> mesh(new FemMesh);
mesh->read(EncodedName.c_str());
Base::FileInfo file(EncodedName.c_str());
// create new document and add Import feature
@@ -168,7 +168,7 @@ private:
Base::FileInfo file(EncodedName.c_str());
try {
std::auto_ptr<FemMesh> mesh(new FemMesh);
std::unique_ptr<FemMesh> mesh(new FemMesh);
mesh->read(EncodedName.c_str());
FemMeshObject *pcFeature = static_cast<FemMeshObject *>
@@ -232,7 +232,7 @@ private:
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
std::auto_ptr<FemMesh> mesh(new FemMesh);
std::unique_ptr<FemMesh> mesh(new FemMesh);
mesh->read(EncodedName.c_str());
return Py::asObject(new FemMeshPy(mesh.release()));
}

View File

@@ -156,7 +156,7 @@ private:
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
mesh->load(EncodedName.c_str());
return Py::asObject(new MeshPy(mesh.release()));
}
@@ -183,7 +183,7 @@ private:
if (groupName.empty())
groupName = file.fileNamePure();
std::auto_ptr<MeshObject> segm(mesh.meshFromSegment(group.getIndices()));
std::unique_ptr<MeshObject> segm(mesh.meshFromSegment(group.getIndices()));
Mesh::Feature *pcFeature = static_cast<Mesh::Feature *>
(pcDoc->addObject("Mesh::Feature", groupName.c_str()));
pcFeature->Label.setValue(groupName.c_str());
@@ -248,7 +248,7 @@ private:
if (groupName.empty())
groupName = file.fileNamePure();
std::auto_ptr<MeshObject> segm(mesh.meshFromSegment(group.getIndices()));
std::unique_ptr<MeshObject> segm(mesh.meshFromSegment(group.getIndices()));
Mesh::Feature *pcFeature = static_cast<Mesh::Feature *>
(pcDoc->addObject("Mesh::Feature", groupName.c_str()));
pcFeature->Label.setValue(groupName.c_str());
@@ -448,7 +448,7 @@ private:
TriaList.push_back(MeshCore::MeshGeomFacet(Base::Vector3f(-hx, -hy, 0.0),Base::Vector3f(hx, hy, 0.0),Base::Vector3f(-hx, hy, 0.0)));
TriaList.push_back(MeshCore::MeshGeomFacet(Base::Vector3f(-hx, -hy, 0.0),Base::Vector3f(hx, -hy, 0.0),Base::Vector3f(hx, hy, 0.0)));
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
mesh->addFacets(TriaList);
return Py::asObject(new MeshPy(mesh.release()));
}

View File

@@ -82,7 +82,7 @@ App::DocumentObjectExecReturn *HarmonizeNormals::execute(void)
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->harmonizeNormals();
this->Mesh.setValuePtr(mesh.release());
@@ -110,7 +110,7 @@ App::DocumentObjectExecReturn *FlipNormals::execute(void)
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->flipNormals();
this->Mesh.setValuePtr(mesh.release());
@@ -138,7 +138,7 @@ App::DocumentObjectExecReturn *FixNonManifolds::execute(void)
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->removeNonManifolds();
this->Mesh.setValuePtr(mesh.release());
@@ -166,7 +166,7 @@ App::DocumentObjectExecReturn *FixDuplicatedFaces::execute(void)
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->removeDuplicatedFacets();
this->Mesh.setValuePtr(mesh.release());
@@ -194,7 +194,7 @@ App::DocumentObjectExecReturn *FixDuplicatedPoints::execute(void)
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->removeDuplicatedPoints();
this->Mesh.setValuePtr(mesh.release());
@@ -222,7 +222,7 @@ App::DocumentObjectExecReturn *FixDegenerations::execute(void)
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->validateDegenerations(static_cast<float>(Epsilon.getValue()));
this->Mesh.setValuePtr(mesh.release());
@@ -251,7 +251,7 @@ App::DocumentObjectExecReturn *FixDeformations::execute(void)
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->validateDeformations(static_cast<float>(MaxAngle.getValue()),
static_cast<float>(Epsilon.getValue()));
@@ -280,7 +280,7 @@ App::DocumentObjectExecReturn *FixIndices::execute(void)
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->validateIndices();
this->Mesh.setValuePtr(mesh.release());
@@ -310,7 +310,7 @@ App::DocumentObjectExecReturn *FillHoles::execute(void)
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
MeshCore::ConstraintDelaunayTriangulator cTria((float)MaxArea.getValue());
//MeshCore::Triangulator cTria(mesh->getKernel());
@@ -341,7 +341,7 @@ App::DocumentObjectExecReturn *RemoveComponents::execute(void)
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->removeComponents(RemoveCompOfSize.getValue());
this->Mesh.setValuePtr(mesh.release());

View File

@@ -53,7 +53,7 @@ short Mesh::Import::mustExecute(void) const
App::DocumentObjectExecReturn *Mesh::Import::execute(void)
{
std::auto_ptr<MeshObject> apcKernel(new MeshObject());
std::unique_ptr<MeshObject> apcKernel(new MeshObject());
apcKernel->load(FileName.getValue());
Mesh.setValuePtr(apcKernel.release());

View File

@@ -151,7 +151,7 @@ App::DocumentObjectExecReturn *SegmentByMesh::execute(void)
for ( std::vector<unsigned long>::iterator it = faces.begin(); it != faces.end(); ++it )
aFaces.push_back( rMeshKernel.GetFacet(*it) );
std::auto_ptr<MeshObject> pcKernel(new MeshObject);
std::unique_ptr<MeshObject> pcKernel(new MeshObject);
pcKernel->addFacets(aFaces);
Mesh.setValuePtr(pcKernel.release());

View File

@@ -76,7 +76,7 @@ App::DocumentObjectExecReturn *SetOperations::execute(void)
const MeshObject& meshKernel1 = mesh1->Mesh.getValue();
const MeshObject& meshKernel2 = mesh2->Mesh.getValue();
std::auto_ptr<MeshObject> pcKernel(new MeshObject()); // Result Meshkernel
std::unique_ptr<MeshObject> pcKernel(new MeshObject()); // Result Meshkernel
MeshCore::SetOperations::OperationType type;
string ot(OperationType.getValue());

View File

@@ -61,7 +61,7 @@ short Sphere::mustExecute() const
App::DocumentObjectExecReturn *Sphere::execute(void)
{
std::auto_ptr<MeshObject> mesh(MeshObject::createSphere((float)Radius.getValue(),Sampling.getValue()));
std::unique_ptr<MeshObject> mesh(MeshObject::createSphere((float)Radius.getValue(),Sampling.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
Mesh.setValue(mesh->getKernel());
@@ -97,7 +97,7 @@ short Ellipsoid::mustExecute() const
App::DocumentObjectExecReturn *Ellipsoid::execute(void)
{
std::auto_ptr<MeshObject> mesh(MeshObject::createEllipsoid((float)Radius1.getValue(),(float)Radius2.getValue(),Sampling.getValue()));
std::unique_ptr<MeshObject> mesh(MeshObject::createEllipsoid((float)Radius1.getValue(),(float)Radius2.getValue(),Sampling.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
Mesh.setValue(mesh->getKernel());
@@ -138,7 +138,7 @@ short Cylinder::mustExecute() const
App::DocumentObjectExecReturn *Cylinder::execute(void)
{
std::auto_ptr<MeshObject> mesh(MeshObject::createCylinder((float)Radius.getValue(),(float)Length.getValue(),
std::unique_ptr<MeshObject> mesh(MeshObject::createCylinder((float)Radius.getValue(),(float)Length.getValue(),
Closed.getValue(),(float)EdgeLength.getValue(),Sampling.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
@@ -183,7 +183,7 @@ short Cone::mustExecute() const
App::DocumentObjectExecReturn *Cone::execute(void)
{
std::auto_ptr<MeshObject> mesh(MeshObject::createCone((float)Radius1.getValue(),(float)Radius2.getValue(),(float)Length.getValue(),
std::unique_ptr<MeshObject> mesh(MeshObject::createCone((float)Radius1.getValue(),(float)Radius2.getValue(),(float)Length.getValue(),
Closed.getValue(),(float)EdgeLength.getValue(),Sampling.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
@@ -220,7 +220,7 @@ short Torus::mustExecute() const
App::DocumentObjectExecReturn *Torus::execute(void)
{
std::auto_ptr<MeshObject> mesh(MeshObject::createTorus((float)Radius1.getValue(),(float)Radius2.getValue(),Sampling.getValue()));
std::unique_ptr<MeshObject> mesh(MeshObject::createTorus((float)Radius1.getValue(),(float)Radius2.getValue(),Sampling.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
Mesh.setValue(mesh->getKernel());
@@ -256,7 +256,7 @@ short Cube::mustExecute() const
App::DocumentObjectExecReturn *Cube::execute(void)
{
std::auto_ptr<MeshObject> mesh(MeshObject::createCube((float)Length.getValue(),(float)Width.getValue(),(float)Height.getValue()));
std::unique_ptr<MeshObject> mesh(MeshObject::createCube((float)Length.getValue(),(float)Width.getValue(),(float)Height.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
Mesh.setValue(mesh->getKernel());

View File

@@ -1449,7 +1449,7 @@ MeshObject* MeshObject::createMeshFromList(Py::List& list)
}
Base::EmptySequencer seq;
std::auto_ptr<MeshObject> mesh(new MeshObject);
std::unique_ptr<MeshObject> mesh(new MeshObject);
//mesh->addFacets(facets);
mesh->getKernel() = facets;
return mesh.release();

View File

@@ -245,7 +245,7 @@ PyObject* MeshPy::write(PyObject *args)
format = ext[Ext];
}
std::auto_ptr<MeshCore::Material> mat;
std::unique_ptr<MeshCore::Material> mat;
if (List) {
mat.reset(new MeshCore::Material);
Py::List list(List);
@@ -1095,13 +1095,13 @@ PyObject* MeshPy::fillupHoles(PyObject *args)
if (!PyArg_ParseTuple(args, "k|if", &len,&level,&max_area))
return NULL;
try {
std::auto_ptr<MeshCore::AbstractPolygonTriangulator> tria;
std::unique_ptr<MeshCore::AbstractPolygonTriangulator> tria;
if (max_area > 0.0f) {
tria = std::auto_ptr<MeshCore::AbstractPolygonTriangulator>
tria = std::unique_ptr<MeshCore::AbstractPolygonTriangulator>
(new MeshCore::ConstraintDelaunayTriangulator(max_area));
}
else {
tria = std::auto_ptr<MeshCore::AbstractPolygonTriangulator>
tria = std::unique_ptr<MeshCore::AbstractPolygonTriangulator>
(new MeshCore::FlatTriangulator());
}

View File

@@ -58,7 +58,7 @@ private Q_SLOTS:
private:
QString document;
QButtonGroup* buttonGroup;
std::auto_ptr<Ui_Tessellation> ui;
std::unique_ptr<Ui_Tessellation> ui;
};
class TaskTessellation : public Gui::TaskView::TaskDialog

View File

@@ -910,7 +910,7 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args, PyObject *kwds)
}
}
std::auto_ptr<GeomAPI_Interpolate> aBSplineInterpolation;
std::unique_ptr<GeomAPI_Interpolate> aBSplineInterpolation;
if (parameters.IsNull()) {
aBSplineInterpolation.reset(new GeomAPI_Interpolate(interpolationPoints,
PyObject_IsTrue(periodic) ? Standard_True : Standard_False, tol3d));

View File

@@ -79,7 +79,7 @@ App::DocumentObjectExecReturn *Boolean::execute(void)
if (ToolShape.IsNull())
throw Base::Exception("Tool shape is null");
std::auto_ptr<BRepAlgoAPI_BooleanOperation> mkBool(makeOperation(BaseShape, ToolShape));
std::unique_ptr<BRepAlgoAPI_BooleanOperation> mkBool(makeOperation(BaseShape, ToolShape));
if (!mkBool->IsDone()) {
return new App::DocumentObjectExecReturn("Boolean operation failed");
}

View File

@@ -40,7 +40,7 @@ public:
virtual Standard_Boolean UserBreak();
private:
std::auto_ptr<Base::SequencerLauncher> myProgress;
std::unique_ptr<Base::SequencerLauncher> myProgress;
};
}

View File

@@ -1825,19 +1825,19 @@ PyObject* TopoShapePy::getElement(PyObject *args)
try {
if (name.size() > 4 && name.substr(0,4) == "Face" && name[4]>=48 && name[4]<=57) {
std::auto_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
std::unique_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
(getTopoShapePtr()->getSubElementByName(input)));
TopoDS_Shape Shape = s->Shape;
return new TopoShapeFacePy(new TopoShape(Shape));
}
else if (name.size() > 4 && name.substr(0,4) == "Edge" && name[4]>=48 && name[4]<=57) {
std::auto_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
std::unique_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
(getTopoShapePtr()->getSubElementByName(input)));
TopoDS_Shape Shape = s->Shape;
return new TopoShapeEdgePy(new TopoShape(Shape));
}
else if (name.size() > 6 && name.substr(0,6) == "Vertex" && name[6]>=48 && name[6]<=57) {
std::auto_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
std::unique_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
(getTopoShapePtr()->getSubElementByName(input)));
TopoDS_Shape Shape = s->Shape;
return new TopoShapeVertexPy(new TopoShape(Shape));
@@ -2388,19 +2388,19 @@ PyObject *TopoShapePy::getCustomAttributes(const char* attr) const
std::string name(attr);
try {
if (name.size() > 4 && name.substr(0,4) == "Face" && name[4]>=48 && name[4]<=57) {
std::auto_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
std::unique_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
(getTopoShapePtr()->getSubElementByName(attr)));
TopoDS_Shape Shape = s->Shape;
return new TopoShapeFacePy(new TopoShape(Shape));
}
else if (name.size() > 4 && name.substr(0,4) == "Edge" && name[4]>=48 && name[4]<=57) {
std::auto_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
std::unique_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
(getTopoShapePtr()->getSubElementByName(attr)));
TopoDS_Shape Shape = s->Shape;
return new TopoShapeEdgePy(new TopoShape(Shape));
}
else if (name.size() > 6 && name.substr(0,6) == "Vertex" && name[6]>=48 && name[6]<=57) {
std::auto_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
std::unique_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
(getTopoShapePtr()->getSubElementByName(attr)));
TopoDS_Shape Shape = s->Shape;
return new TopoShapeVertexPy(new TopoShape(Shape));

View File

@@ -92,11 +92,11 @@ protected:
virtual const char* getFilletType() const;
private:
void onSelectionChanged(const Gui::SelectionChanges& msg);
void onDeleteObject(const App::DocumentObject&);
void onDeleteDocument(const App::Document&);
void onSelectEdge(const QString& subelement, int type);
void onSelectEdgesOfFace(const QString& subelement, int type);
void onSelectionChanged(const Gui::SelectionChanges& msg);
void onDeleteObject(const App::DocumentObject&);
void onDeleteDocument(const App::Document&);
void onSelectEdge(const QString& subelement, int type);
void onSelectEdgesOfFace(const QString& subelement, int type);
private Q_SLOTS:
void on_shapeObject_activated(int);
@@ -111,9 +111,9 @@ private Q_SLOTS:
void onHighlightEdges();
private:
std::auto_ptr<Ui_DlgFilletEdges> ui;
std::unique_ptr<Ui_DlgFilletEdges> ui;
class Private;
std::auto_ptr<Private> d;
std::unique_ptr<Private> d;
};
class FilletEdgesDialog : public QDialog

View File

@@ -51,7 +51,7 @@ private Q_SLOTS:
void on_maxDeviation_valueChanged(double);
private:
std::auto_ptr<Ui_DlgSettings3DViewPart> ui;
std::unique_ptr<Ui_DlgSettings3DViewPart> ui;
bool checkValue;
};

View File

@@ -88,7 +88,7 @@ private:
if (file.extension().empty())
throw Py::RuntimeError("No file extension");
std::auto_ptr<Reader> reader;
std::unique_ptr<Reader> reader;
if (file.hasExtension("asc")) {
reader.reset(new AscReader);
}
@@ -192,7 +192,7 @@ private:
if (file.extension().empty())
throw Py::RuntimeError("No file extension");
std::auto_ptr<Reader> reader;
std::unique_ptr<Reader> reader;
if (file.hasExtension("asc")) {
reader.reset(new AscReader);
}
@@ -309,7 +309,7 @@ private:
Points::Feature* fea = static_cast<Points::Feature*>(obj);
const PointKernel& kernel = fea->Points.getValue();
std::auto_ptr<Writer> writer;
std::unique_ptr<Writer> writer;
if (file.hasExtension("asc")) {
writer.reset(new AscWriter(kernel));
}

View File

@@ -52,12 +52,12 @@ int PointsPy::PyInit(PyObject* args, PyObject* /*kwd*/)
{
PyObject *pcObj=0;
if (!PyArg_ParseTuple(args, "|O", &pcObj)) // convert args: Python->C
return -1; // NULL triggers exception
// if no mesh is given
return -1; // NULL triggers exception
// if no mesh is given
if (!pcObj) return 0;
if (PyObject_TypeCheck(pcObj, &(PointsPy::Type))) {
*getPointKernelPtr() = *(static_cast<PointsPy*>(pcObj)->getPointKernelPtr());
*getPointKernelPtr() = *(static_cast<PointsPy*>(pcObj)->getPointKernelPtr());
}
else if (PyList_Check(pcObj)) {
if (!addPoints(args))
@@ -82,11 +82,11 @@ PyObject* PointsPy::copy(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
PointKernel* kernel = new PointKernel();
// assign data
*kernel = *getPointKernelPtr();
return new PointsPy(kernel);
PointKernel* kernel = new PointKernel();
// assign data
*kernel = *getPointKernelPtr();
return new PointsPy(kernel);
}
PyObject* PointsPy::read(PyObject * args)
@@ -178,7 +178,7 @@ PyObject* PointsPy::fromSegment(PyObject * args)
try {
const PointKernel* points = getPointKernelPtr();
Py::Sequence list(obj);
std::auto_ptr<PointKernel> pts(new PointKernel());
std::unique_ptr<PointKernel> pts(new PointKernel());
pts->reserve(list.size());
int numPoints = static_cast<int>(points->size());
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
@@ -202,7 +202,7 @@ PyObject* PointsPy::fromValid(PyObject * args)
try {
const PointKernel* points = getPointKernelPtr();
std::auto_ptr<PointKernel> pts(new PointKernel());
std::unique_ptr<PointKernel> pts(new PointKernel());
pts->reserve(points->size());
for (PointKernel::const_iterator it = points->begin(); it != points->end(); ++it) {
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z))

View File

@@ -59,7 +59,7 @@ using namespace std;
Path* Path::Read(istream& is) {
// auto_ptr because exception can be thrown !
// unique_ptr because exception can be thrown !
IOTrace("Path::Read");
char storage[64];
EatWord(is,"[",storage,sizeof(storage));
@@ -78,7 +78,7 @@ Path* Path::Read(istream& is) {
Frame endpos;
is >> startpos;
is >> endpos;
auto_ptr<RotationalInterpolation> orient( RotationalInterpolation::Read(is) );
unique_ptr<RotationalInterpolation> orient( RotationalInterpolation::Read(is) );
double eqradius;
is >> eqradius;
EatEnd(is,']');
@@ -99,7 +99,7 @@ Path* Path::Read(istream& is) {
is >> R_base_end;
is >> alpha;
alpha *= deg2rad;
auto_ptr<RotationalInterpolation> orient( RotationalInterpolation::Read(is) );
unique_ptr<RotationalInterpolation> orient( RotationalInterpolation::Read(is) );
is >> eqradius;
EatEnd(is,']');
IOTracePop();
@@ -119,8 +119,8 @@ Path* Path::Read(istream& is) {
is >> radius;
double eqradius;
is >> eqradius;
auto_ptr<RotationalInterpolation> orient( RotationalInterpolation::Read(is) );
auto_ptr<Path_RoundedComposite> tr(
unique_ptr<RotationalInterpolation> orient( RotationalInterpolation::Read(is) );
unique_ptr<Path_RoundedComposite> tr(
new Path_RoundedComposite(radius,eqradius,orient.release())
);
int size;
@@ -139,7 +139,7 @@ Path* Path::Read(istream& is) {
} else if (strcmp(storage,"COMPOSITE")==0) {
IOTrace("COMPOSITE");
int size;
auto_ptr<Path_Composite> tr( new Path_Composite() );
unique_ptr<Path_Composite> tr( new Path_Composite() );
is >> size;
int i;
for (i=0;i<size;i++) {
@@ -152,7 +152,7 @@ Path* Path::Read(istream& is) {
} else if (strcmp(storage,"CYCLIC_CLOSED")==0) {
IOTrace("CYCLIC_CLOSED");
int times;
auto_ptr<Path> tr( Path::Read(is) );
unique_ptr<Path> tr( Path::Read(is) );
is >> times;
EatEnd(is,']');
IOTracePop();

View File

@@ -110,7 +110,7 @@ Twist Path_Composite::Acc(double s,double sd,double sdd) const {
}
Path* Path_Composite::Clone() {
std::auto_ptr<Path_Composite> comp( new Path_Composite() );
std::unique_ptr<Path_Composite> comp( new Path_Composite() );
for (unsigned int i = 0; i < dv.size(); ++i) {
comp->Add(gv[i].first->Clone(), gv[i].second);
}

View File

@@ -104,11 +104,11 @@ void Path_RoundedComposite::Add(const Frame& F_base_point) {
if (d >= bcdist)
throw Error_MotionPlanning_Not_Feasible(6);
std::auto_ptr < Path
std::unique_ptr < Path
> line1(
new Path_Line(F_base_start, F_base_via,
orient->Clone(), eqradius));
std::auto_ptr < Path
std::unique_ptr < Path
> line2(
new Path_Line(F_base_via, F_base_point,
orient->Clone(), eqradius));

View File

@@ -51,7 +51,7 @@ namespace KDL {
using namespace std;
RotationalInterpolation* RotationalInterpolation::Read(istream& is) {
// auto_ptr because exception can be thrown !
// unique_ptr because exception can be thrown !
IOTrace("RotationalInterpolation::Read");
char storage[64];
EatWord(is,"[",storage,sizeof(storage));

View File

@@ -55,15 +55,15 @@ namespace KDL {
using namespace std;
Trajectory* Trajectory::Read(std::istream& is) {
// auto_ptr because exception can be thrown !
// unique_ptr because exception can be thrown !
IOTrace("Trajectory::Read");
char storage[64];
EatWord(is,"[",storage,sizeof(storage));
Eat(is,'[');
if (strcmp(storage,"SEGMENT")==0) {
IOTrace("SEGMENT");
auto_ptr<Path> geom( Path::Read(is) );
auto_ptr<VelocityProfile> motprof( VelocityProfile::Read(is) );
unique_ptr<Path> geom( Path::Read(is) );
unique_ptr<VelocityProfile> motprof( VelocityProfile::Read(is) );
EatEnd(is,']');
IOTracePop();
IOTracePop();

View File

@@ -99,12 +99,12 @@ Py::Object DocumentProtectorPy::getattr(const char * attr)
}
else {
Py::Object obj = Py::PythonExtension<DocumentProtectorPy>::getattr(attr);
if (PyCFunction_Check(obj.ptr())) {
PyCFunctionObject* op = reinterpret_cast<PyCFunctionObject*>(obj.ptr());
if (!pycxx_handler)
pycxx_handler = op->m_ml->ml_meth;
op->m_ml->ml_meth = method_varargs_ext_handler;
}
if (PyCFunction_Check(obj.ptr())) {
PyCFunctionObject* op = reinterpret_cast<PyCFunctionObject*>(obj.ptr());
if (!pycxx_handler)
pycxx_handler = op->m_ml->ml_meth;
op->m_ml->ml_meth = method_varargs_ext_handler;
}
return obj;
}
}
@@ -239,7 +239,7 @@ int DocumentObjectProtectorPy::setattr(const char * attr, const Py::Object & val
throw Py::AttributeError(s_out.str());
}
Base::PyGILStateRelease unlock;
std::auto_ptr<App::Property> copy(static_cast<App::Property*>
std::unique_ptr<App::Property> copy(static_cast<App::Property*>
(prop->getTypeId().createInstance()));
if (PyObject_TypeCheck(value.ptr(), DocumentObjectProtectorPy::type_object())) {
copy->setPyObject(static_cast<const DocumentObjectProtectorPy*>(value.ptr())->getObject().ptr());

View File

@@ -216,7 +216,7 @@ bool
SceneEventFilter::eventFilter(QObject * obj, QEvent * qevent)
{
// Convert the scene event back to a standard event
std::auto_ptr<QEvent> sceneev;
std::unique_ptr<QEvent> sceneev;
switch (qevent->type()) {
//GraphicsSceneContextMenu = 159,
//GraphicsSceneHoverEnter = 160,

View File

@@ -63,7 +63,7 @@ private:
void hidePoints();
private:
std::auto_ptr<Ui_TaskSketcherValidation> ui;
std::unique_ptr<Ui_TaskSketcherValidation> ui;
Sketcher::SketchObject* sketch;
SoGroup* coincidenceRoot;

View File

@@ -801,7 +801,7 @@ void CmdSpreadsheetSetAlias::activated(int iMsg)
range.push_back(Range(selection[0].row(), selection[0].column(),
selection[0].row(), selection[0].column()));
std::auto_ptr<PropertiesDialog> dialog(new PropertiesDialog(sheet, range, sheetView));
std::unique_ptr<PropertiesDialog> dialog(new PropertiesDialog(sheet, range, sheetView));
dialog->selectAlias();

View File

@@ -184,7 +184,7 @@ void PropertiesDialog::displayUnitChanged(const QString & text)
QPalette palette = ui->displayUnit->palette();
try {
std::auto_ptr<UnitExpression> e(App::ExpressionParser::parseUnit(sheet, text.toUtf8().constData()));
std::unique_ptr<UnitExpression> e(App::ExpressionParser::parseUnit(sheet, text.toUtf8().constData()));
displayUnit = DisplayUnit(text.toUtf8().constData(), e->getUnit(), e->getScaler());
palette.setColor(QPalette::Text, Qt::black);

View File

@@ -80,7 +80,7 @@ SheetTableView::SheetTableView(QWidget *parent)
void SheetTableView::cellProperties()
{
std::auto_ptr<PropertiesDialog> dialog(new PropertiesDialog(sheet, selectedRanges(), this));
std::unique_ptr<PropertiesDialog> dialog(new PropertiesDialog(sheet, selectedRanges(), this));
if (dialog->exec() == QDialog::Accepted) {
dialog->apply();

View File

@@ -55,7 +55,7 @@ public:
private:
bool initialized;
std::auto_ptr<WorkbenchHelper> workbenchHelper;
std::unique_ptr<WorkbenchHelper> workbenchHelper;
protected:
Gui::MenuItem *setupMenuBar() const;