Commit 520ba015 authored by David Gobbi's avatar David Gobbi
Browse files

Add copy ctors and operators to clear warnings.

This patch modifies classes that broke the "rule of three", which
states that classes that declare a destructor must also declare a
copy constructor and assigment operator.

Change-Id: I06b1bb45b493e80e0bae0e8668aa09f494b8056e
parent b3e976bf
......@@ -120,6 +120,7 @@ public:
typedef typename Base::Parm1 Parm1;
FunctorHandler(Fun& fun) : f_(fun) {}
virtual ~FunctorHandler() {}
ResultType operator()(Parm1& p1)
{ return f_(p1); }
......@@ -127,6 +128,8 @@ public:
private:
Fun f_;
FunctorHandler() : ParentFunctor::Impl() {}
FunctorHandler(const FunctorHandler &b) : ParentFunctor::Impl(b), f_(b.f_) {}
FunctorHandler& operator =(const FunctorHandler& b);
};
......@@ -256,6 +259,7 @@ public:
typedef typename Base::Parm2 Parm2;
FunctorHandler(const Fun& fun) : f_(fun) {}
virtual ~FunctorHandler() {}
ResultType operator()(Parm1& p1,Parm2& p2)
{ return f_(p1,p2); }
......@@ -264,6 +268,8 @@ public:
private:
Fun f_;
FunctorHandler() : ParentFunctor::Impl() {}
FunctorHandler(const FunctorHandler &b) : ParentFunctor::Impl(b), f_(b.f_) {}
FunctorHandler& operator =(const FunctorHandler& b);
};
......
......@@ -3116,34 +3116,14 @@ vtkHyperOctreeLightWeightCursor::vtkHyperOctreeLightWeightCursor()
this->Tree = 0;
}
//-----------------------------------------------------------------------------
vtkHyperOctreeLightWeightCursor::~vtkHyperOctreeLightWeightCursor()
{
this->Level = 0;
this->IsLeaf = 1;
this->Index = 0;
// I can't reference count because of the default copy constructor.
//if (this->Tree)
// {
// this->Tree->UnRegister(0);
// }
this->Tree = 0;
}
//-----------------------------------------------------------------------------
void vtkHyperOctreeLightWeightCursor::Initialize(vtkHyperOctree* tree)
{
//if (this->Tree)
// {
// this->Tree->UnRegister(0);
// }
this->Tree = tree;
if (tree == 0)
{
return;
}
//this->Tree->Register(0);
this->ToRoot();
}
......
......@@ -567,8 +567,6 @@ class VTKCOMMONDATAMODEL_EXPORT vtkHyperOctreeLightWeightCursor
{
public:
vtkHyperOctreeLightWeightCursor();
~vtkHyperOctreeLightWeightCursor();
void Initialize(vtkHyperOctree* tree);
void ToRoot();
void ToChild(int child);
......
......@@ -66,6 +66,12 @@ vtkStructuredAMRNeighbor::vtkStructuredAMRNeighbor(
} // END for all dimensions
}
//-----------------------------------------------------------------------------
vtkStructuredAMRNeighbor::vtkStructuredAMRNeighbor(
const vtkStructuredAMRNeighbor &N)
{
*this = N;
}
//-----------------------------------------------------------------------------
vtkStructuredAMRNeighbor& vtkStructuredAMRNeighbor::operator=(
......
......@@ -67,6 +67,14 @@ public:
int orient[3],
const int relationShip);
// Description:
// Copy constructor.
vtkStructuredAMRNeighbor(const vtkStructuredAMRNeighbor &N);
// Description:
// Destructor.
~vtkStructuredAMRNeighbor() {};
// Description:
// Overload assignment operator.
vtkStructuredAMRNeighbor& operator=(const vtkStructuredAMRNeighbor &N);
......
......@@ -91,6 +91,52 @@ void vtkEnzoReaderBlock::Init()
this->SubdivisionRatio[2] = 1.0;
}
//------------------------------------------------------------------------------
void vtkEnzoReaderBlock::DeepCopy(const vtkEnzoReaderBlock *other)
{
this->BlockFileName = other->BlockFileName;
this->ParticleFileName = other->ParticleFileName;
this->Index = other->Index;
this->Level = other->Level;
this->ParentId = other->ParentId;
this->ChildrenIds = other->ChildrenIds;
this->NumberOfParticles = other->NumberOfParticles;
this->NumberOfDimensions = other->NumberOfDimensions;
this->MinParentWiseIds[0] = other->MinParentWiseIds[0];
this->MinParentWiseIds[1] = other->MinParentWiseIds[1];
this->MinParentWiseIds[2] = other->MinParentWiseIds[2];
this->MaxParentWiseIds[0] = other->MaxParentWiseIds[0];
this->MaxParentWiseIds[1] = other->MaxParentWiseIds[1];
this->MaxParentWiseIds[2] = other->MaxParentWiseIds[2];
this->MinLevelBasedIds[0] = other->MinLevelBasedIds[0];
this->MinLevelBasedIds[1] = other->MinLevelBasedIds[1];
this->MinLevelBasedIds[2] = other->MinLevelBasedIds[2];
this->MaxLevelBasedIds[0] = other->MaxLevelBasedIds[0];
this->MaxLevelBasedIds[1] = other->MaxLevelBasedIds[1];
this->MaxLevelBasedIds[2] = other->MaxLevelBasedIds[2];
this->BlockCellDimensions[0] = other->BlockCellDimensions[0];
this->BlockCellDimensions[1] = other->BlockCellDimensions[1];
this->BlockCellDimensions[2] = other->BlockCellDimensions[2];
this->BlockNodeDimensions[0] = other->BlockNodeDimensions[0];
this->BlockNodeDimensions[1] = other->BlockNodeDimensions[1];
this->BlockNodeDimensions[2] = other->BlockNodeDimensions[2];
this->MinBounds[0] = other->MinBounds[0];
this->MinBounds[1] = other->MinBounds[1];
this->MinBounds[2] = other->MinBounds[2];
this->MaxBounds[0] = other->MaxBounds[0];
this->MaxBounds[1] = other->MaxBounds[1];
this->MaxBounds[2] = other->MaxBounds[2];
this->SubdivisionRatio[0] = other->SubdivisionRatio[0];
this->SubdivisionRatio[1] = other->SubdivisionRatio[1];
this->SubdivisionRatio[2] = other->SubdivisionRatio[2];
}
//------------------------------------------------------------------------------
// get the bounding (cell) Ids of this block in terms of its parent block's
// sub-division resolution (indexing is limited to the scope of the parent)
......
......@@ -62,6 +62,10 @@ class vtkEnzoReaderBlock
public:
vtkEnzoReaderBlock() { this->Init(); }
~vtkEnzoReaderBlock() { this->Init(); }
vtkEnzoReaderBlock(const vtkEnzoReaderBlock& other)
{ this->DeepCopy(&other); }
vtkEnzoReaderBlock& operator=(const vtkEnzoReaderBlock& other)
{ this->DeepCopy(&other); return *this; }
int Index;
int Level;
......@@ -86,6 +90,7 @@ public:
std::string ParticleFileName;
void Init();
void DeepCopy(const vtkEnzoReaderBlock *other);
void GetParentWiseIds( std::vector< vtkEnzoReaderBlock > & blocks );
void GetLevelBasedIds( std::vector< vtkEnzoReaderBlock > & blocks );
};
......
......@@ -58,6 +58,14 @@ public:
ObjectId = src.ObjectId;
ArrayId = src.ArrayId;
}
vtkExodusIICacheKey& operator = ( const vtkExodusIICacheKey& src )
{
Time = src.Time;
ObjectType = src.ObjectType;
ObjectId = src.ObjectId;
ArrayId = src.ArrayId;
return *this;
}
bool match( const vtkExodusIICacheKey&other, const vtkExodusIICacheKey& pattern ) const
{
if ( pattern.Time && this->Time != other.Time )
......
......@@ -426,14 +426,6 @@ private:
typedef vtkStdString Superclass;
public:
vtkFoamError() :
vtkStdString()
{
}
vtkFoamError(const vtkFoamError& e) :
vtkStdString(e)
{
}
// a super-easy way to make use of operator<<()'s defined in
// vtksys_ios::ostringstream class
template <class T> vtkFoamError& operator<<(const T& t)
......
......@@ -40,6 +40,14 @@ struct vtkBalloon
vtkImageData *Image;
vtkBalloon() : Text(), Image(0) {}
vtkBalloon(const vtkBalloon &balloon) :
Text(balloon.Text), Image(balloon.Image)
{
if ( this->Image )
{
this->Image->Register(NULL);
}
}
vtkBalloon(vtkStdString *str, vtkImageData *img)
{
this->Text = *str;
......
......@@ -408,6 +408,9 @@ protected:
bool Loaded;
bool LastLinearInterpolation;
double LastRange[2];
private:
vtkOpacityTable(const vtkOpacityTable&);
vtkOpacityTable& operator=(const vtkOpacityTable&);
};
//-----------------------------------------------------------------------------
......@@ -416,12 +419,28 @@ protected:
class vtkOpacityTables
{
public:
std::vector<vtkOpacityTable> Vector;
vtkOpacityTables(size_t numberOfLevels)
: Vector(numberOfLevels)
vtkOpacityTables(unsigned int numberOfTables)
{
this->Tables = new vtkOpacityTable[numberOfTables];
this->NumberOfTables = numberOfTables;
}
~vtkOpacityTables()
{
delete [] this->Tables;
}
vtkOpacityTable* GetTable(unsigned int i)
{
return &this->Tables[i];
}
unsigned int GetNumberOfTables()
{
return this->NumberOfTables;
}
private:
unsigned int NumberOfTables;
vtkOpacityTable *Tables;
// undefined default constructor.
vtkOpacityTables();
// undefined copy constructor.
vtkOpacityTables(const vtkOpacityTables &other);
// undefined assignment operator.
......@@ -3285,7 +3304,7 @@ int vtkOpenGLGPUVolumeRayCastMapper::UpdateOpacityTransferFunction(
vtkPiecewiseFunction *scalarOpacity=volumeProperty->GetScalarOpacity();
vtkgl::ActiveTexture( vtkgl::TEXTURE2); //stay here
this->OpacityTables->Vector[level].Update(
this->OpacityTables->GetTable(level)->Update(
scalarOpacity,this->BlendMode,
this->ActualSampleDistance,
this->TableRange,
......@@ -4616,7 +4635,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::PreRender(vtkRenderer *ren,
this->CheckFrameBufferStatus();
if(this->OpacityTables!=0 &&
this->OpacityTables->Vector.size()!=numberOfLevels)
this->OpacityTables->GetNumberOfTables()!=numberOfLevels)
{
delete this->OpacityTables;
this->OpacityTables=0;
......@@ -4892,7 +4911,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::RenderBlock(vtkRenderer *ren,
// opacitytable
vtkgl::ActiveTexture(vtkgl::TEXTURE2);
this->OpacityTables->Vector[level].Bind();
this->OpacityTables->GetTable(level)->Bind();
vtkgl::ActiveTexture(vtkgl::TEXTURE0);
vtkOpenGLCheckErrorMacro("after uniforms for projection and shade");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment