Better handle the release of resources
simogasp opened this issue · 0 comments
So far the release of the resources taken by the class PopSift
relies on an explicit call to the uninit()
method (mostly for the Pipe
object contained within).
This is helpful when the object instantiated from PopSift has a broad scope and resources need to be freed explicitly without waiting for the object to go out of scope.
On the other hand, it would be nice that the object is able to automatically release the resources when it goes out of scope, i.e. the destructor is called. (Single responsibility principle)
One possibility is then to have a boolean attribute in the class, _isInit
, that keeps track of the status of the object so that in the destructor the uninit method can be called if the object is still initialized.