-
-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: DataSet assignment operator is missing #503
Changes from 2 commits
1e1e267
3fabfd8
52313ee
44c10c8
2377422
065b565
b4a7b61
d973c8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,21 @@ DataSet::DataSet(const DataSet &original) : H5Object(), AbstractDs(), id(origina | |
incRefCount(); // increment number of references to this id | ||
} | ||
|
||
//-------------------------------------------------------------------------- | ||
// Function: DataSet assignment operator | ||
///\brief Assignment operator: same HDF5 object as \a original | ||
///\param original - IN: DataSet instance to copy | ||
// Programmer Lee Newberg - 2021 | ||
//-------------------------------------------------------------------------- | ||
DataSet & | ||
DataSet::operator=(const DataSet &original) | ||
{ | ||
if (this != &original) { | ||
setId(original.id); | ||
} | ||
return (*this); | ||
} | ||
|
||
//-------------------------------------------------------------------------- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please consider using IdComponent::setId() to ensure the current dataset ID is properly closed. setId() also handles the ref counting. Perhaps, DataType::operator= can be used as an example. Also, please add a test. Thank you! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bmribler Thank you for the feedback. The new code has There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If someone could contribute a test that would be great. I am a little over my head there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you, @Leengit. I'll try to come up with a test. |
||
// Function: DataSet overload constructor - dereference | ||
///\brief Given a reference, ref, to an hdf5 location, creates a | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not excited about programmer graffitti. I'm trying to remove author fields in comments when I find them as they are frequently meaningless. Developers should be using the history to determine this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will be adding test for this and will take care of the issues you mentioned. Thanks!