Commit 004944f0 authored by David Gobbi's avatar David Gobbi Committed by Code Review
Browse files

Merge topic 'arrayweights-copy-ctor' into master

e6d1e307 Add a copy constructor to vtkArrayWeights.
parents 313d19c3 e6d1e307
......@@ -67,6 +67,11 @@ vtkArrayWeights::vtkArrayWeights(double i, double j, double k, double l)
this->Storage->Storage[3] = l;
}
vtkArrayWeights::vtkArrayWeights(const vtkArrayWeights& other)
{
this->Storage = new vtkArrayWeightsStorage(*other.Storage);
}
// ----------------------------------------------------------------------------
vtkArrayWeights::~vtkArrayWeights()
{
......@@ -93,3 +98,9 @@ const double& vtkArrayWeights::operator[](vtkIdType i) const
{
return this->Storage->Storage[static_cast<size_t>(i)];
}
vtkArrayWeights& vtkArrayWeights::operator=(const vtkArrayWeights& other)
{
*this->Storage = *other.Storage;
return *this;
}
......@@ -53,6 +53,10 @@ public:
// Create an empty collection of weights
vtkArrayWeights();
// Description:
// Copy the weights from another object.
vtkArrayWeights(const vtkArrayWeights& other);
// Description:
// Create a collection containing one weight.
vtkArrayWeights(double i);
......@@ -91,6 +95,10 @@ public:
// Accesses the i-th weight in the collection.
const double& operator[](vtkIdType) const;
// Description:
// Assignment operator.
vtkArrayWeights& operator=(const vtkArrayWeights& other);
protected:
vtkArrayWeightsStorage *Storage;
};
......
Markdown is supported
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