From: Alberto Luaces <aluaces@udc.es>
Date: Thu, 7 Nov 2019 18:13:59 +0100
Subject: Explicitly declare copy constructor and operators.
examples/osgphotoalbum/ImageReaderWriter.cpp | 15 +++++++++++++++
examples/osgphotoalbum/ImageReaderWriter.h | 1 +
include/osg/BoundingSphere | 6 ++++++
include/osg/GLExtensions | 9 +++++++++
include/osg/Quat | 2 ++
src/osgDB/DatabasePager.cpp | 4 ++--
src/osgDB/Registry.cpp | 4 ++--
src/osgPlugins/OpenFlight/Vertex.cpp | 18 ++++++++++++++++++
src/osgPlugins/OpenFlight/Vertex.h | 2 ++
src/osgPlugins/cfg/RenderSurface.h | 10 ++++++++++
src/osgPlugins/gles/glesUtil | 4 ++--
src/osgSim/SphereSegment.cpp | 6 +++---
src/osgViewer/PixelBufferWin32.cpp | 2 +-
13 files changed, 73 insertions(+), 10 deletions(-)
@@ -60,6 +60,21 @@ ImageReaderWriter::DataReference::DataReference(const DataReference& rhs):
_backPage(rhs._backPage) {}
+ImageReaderWriter::DataReference &ImageReaderWriter::DataReference::operator= (const ImageReaderWriter::DataReference& rhs)
+{
+ _fileName = rhs._fileName;
+ _resolutionX = rhs._resolutionX;
+ _resolutionY = rhs._resolutionY;
+ _center = rhs._center;
+ _maximumWidth = rhs._maximumWidth;
+ _maximumHeight = rhs._maximumHeight;
+ _numPointsAcross = rhs._numPointsAcross;
+ _numPointsUp = rhs._numPointsUp;
+ _backPage = rhs._backPage;
+
+ return *this;
+}
+
ImageReaderWriter::ImageReaderWriter()
{
@@ -68,6 +68,7 @@ class ImageReaderWriter : public osgDB::ReaderWriter
DataReference();
DataReference(const std::string& fileName, unsigned int res, float width, float height,bool backPage);
DataReference(const DataReference& rhs);
+ DataReference &operator= (const DataReference& rhs);
std::string _fileName;
unsigned int _resolutionX;
@@ -52,6 +52,12 @@ class BoundingSphereImpl
/** Creates a bounding sphere initialized to the given extents. */
BoundingSphereImpl(const BoundingBoxImpl<VT>& bb) : _center(0.0,0.0,0.0),_radius(-1.0) { expandBy(bb); }
+ BoundingSphereImpl& operator= (const BoundingSphereImpl &o){
+ _center = o._center;
+ _radius = o._radius;
+ return *this;
+ }
+
/** Clear the bounding sphere. Reset to default values. */
inline void init()
{
@@ -149,6 +149,15 @@ class VertexAttribAlias
_osgName(osgName),
_declaration(declaration) {}
+ VertexAttribAlias &operator = (const VertexAttribAlias &o) {
+ _location = o._location;
+ _glName = o._glName;
+ _osgName = o._osgName;
+ _declaration = o._declaration;
+
+ return *this;
+ }
+
GLuint _location;
std::string _glName;
std::string _osgName;
@@ -92,6 +92,8 @@ class OSG_EXPORT Quat
makeRotate(angle1,axis1,angle2,axis2,angle3,axis3);
}
+ Quat(const Quat& q) { _v[0]=q._v[0]; _v[1]=q._v[1]; _v[2]=q._v[2]; _v[3]=q._v[3]; }
+
inline Quat& operator = (const Quat& v) { _v[0]=v._v[0]; _v[1]=v._v[1]; _v[2]=v._v[2]; _v[3]=v._v[3]; return *this; }
inline bool operator == (const Quat& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2] && _v[3]==v._v[3]; }
@@ -340,7 +340,7 @@ public:
protected:
- FindCompileableGLObjectsVisitor& operator = (const FindCompileableGLObjectsVisitor&) { return *this; }
+ FindCompileableGLObjectsVisitor& operator = (const FindCompileableGLObjectsVisitor&) = delete;
};
@@ -1832,7 +1832,7 @@ public:
protected:
- FindPagedLODsVisitor& operator = (const FindPagedLODsVisitor&) { return *this; }
+ FindPagedLODsVisitor& operator = (const FindPagedLODsVisitor&) = delete;
};
@@ -89,7 +89,7 @@ public:
protected:
- AvailableReaderWriterIterator& operator = (const AvailableReaderWriterIterator&) { return *this; }
+ AvailableReaderWriterIterator& operator = (const AvailableReaderWriterIterator&) = delete;
Registry::ReaderWriterList& _rwList;
OpenThreads::ReentrantMutex& _pluginMutex;
@@ -133,7 +133,7 @@ public:
protected:
- AvailableArchiveIterator& operator = (const AvailableArchiveIterator&) { return *this; }
+ AvailableArchiveIterator& operator = (const AvailableArchiveIterator&) = delete;
Registry::ArchiveCache& _archives;
OpenThreads::ReentrantMutex& _mutex;
@@ -46,6 +46,24 @@ Vertex::Vertex(const Vertex& vertex):
}
}
+Vertex & Vertex::operator= (const Vertex &vertex)
+{
+ _coord = vertex._coord;
+ _color = vertex._color;
+ _normal = vertex._normal;
+ _validColor = vertex._validColor;
+ _validNormal = vertex._validNormal;
+
+ for (int layer=0; layer<MAX_LAYERS; layer++)
+ {
+ _uv[layer] = vertex._uv[layer];
+ _validUV[layer] = vertex._validUV[layer];
+ }
+
+ return *this;
+}
+
+
void Vertex::setCoord(const osg::Vec3& coord)
{
_coord = coord;
@@ -35,6 +35,8 @@ public:
Vertex();
Vertex(const Vertex& vertex);
+ Vertex &operator= (const Vertex &vertex);
+
void setCoord(const osg::Vec3& coord);
void setColor(const osg::Vec4& color);
void setNormal(const osg::Vec3& normal);
@@ -73,6 +73,16 @@ class RenderSurface : public osg::Referenced
_width = ir._width;
_height = ir._height;
}
+
+ InputRectangle &operator = (const InputRectangle &ir)
+ {
+ _left = ir._left;
+ _bottom = ir._bottom;
+ _width = ir._width;
+ _height = ir._height;
+ return *this;
+ }
+
virtual ~InputRectangle() {}
void set( float left, float right, float bottom, float top )
@@ -224,7 +224,7 @@ namespace glesUtil {
virtual void apply(osg::MatrixfArray& array) { remap(array); }
protected:
- RemapArray& operator= (const RemapArray&) { return *this; }
+ RemapArray& operator= (const RemapArray&) = delete;
};
@@ -254,7 +254,7 @@ namespace glesUtil {
}
protected:
- VertexAttribComparitor& operator= (const VertexAttribComparitor&) { return *this; }
+ VertexAttribComparitor& operator= (const VertexAttribComparitor&) = delete;
};
// Move the values in an array to new positions, based on the
@@ -1945,7 +1945,7 @@ namespace SphereSegmentIntersector
protected:
- AzimPlaneIntersector& operator = (const AzimPlaneIntersector&) { return *this; }
+ AzimPlaneIntersector& operator = (const AzimPlaneIntersector&) = delete;
};
struct ElevationIntersector
@@ -2086,7 +2086,7 @@ namespace SphereSegmentIntersector
protected:
- ElevationIntersector& operator = (const ElevationIntersector&) { return *this; }
+ ElevationIntersector& operator = (const ElevationIntersector&) = delete;
};
@@ -2216,7 +2216,7 @@ namespace SphereSegmentIntersector
protected:
- RadiusIntersector& operator = (const RadiusIntersector&) { return *this; }
+ RadiusIntersector& operator = (const RadiusIntersector&) = delete;
};
}
@@ -212,7 +212,7 @@ protected:
_context(0),
_instance(0) {}
- TemporaryWindow &operator=(const TemporaryWindow &) { return *this; }
+ TemporaryWindow &operator=(const TemporaryWindow &) = delete;
void create();
void kill();