Skip to content

Commit

Permalink
Add FieldObserver::onFieldDestruction
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Oct 7, 2024
1 parent 380eecd commit e5823e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/atlas/field/detail/FieldImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ FieldImpl::FieldImpl(const std::string& name, array::Array* array)
}

FieldImpl::~FieldImpl() {
for (FieldObserver* observer : field_observers_) {
observer->onFieldDestruction(*this);
}
array_->detach();
if (array_->owners() == 0) {
for (auto& f : callback_on_destruction_) {
Expand Down
3 changes: 2 additions & 1 deletion src/atlas/field/detail/FieldImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ class FieldObserver {
}
}

virtual void onFieldRename(FieldImpl&) = 0;
virtual void onFieldRename(FieldImpl&) {}
virtual void onFieldDestruction(FieldImpl&) {}
};

//----------------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit e5823e0

Please sign in to comment.