Skip to content

Commit

Permalink
- close wiff file after using spectra in test harness
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cox-sciex committed Dec 17, 2024
1 parent 33e0755 commit 042a9ea
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pwiz/data/msdata/MSData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,9 @@ class PWIZ_API_DECL SpectrumList
// (as with msconvert's --ignoreCalibrationScans flag)
virtual bool calibrationSpectraAreOmitted() const;

virtual ~SpectrumList(){}
virtual ~SpectrumList(){}

virtual void close(){}
};


Expand Down
2 changes: 2 additions & 0 deletions pwiz/data/vendor_readers/ABI/Reader_ABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ void Reader_ABI::readIds(const string& filename,
vector<string> sampleNames = wifffile->getSampleNames();
for (vector<string>::iterator it = sampleNames.begin(); it != sampleNames.end(); it++)
results.push_back(*it);

wifffile->close();
}
catch (std::exception& e)
{
Expand Down
4 changes: 4 additions & 0 deletions pwiz/data/vendor_readers/ABI/SpectrumList_ABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ PWIZ_API_DECL size_t SpectrumList_ABI::find(const string& id) const
return scanItr->second;
}

PWIZ_API_DECL void SpectrumList_ABI::close()
{
wifffile_->close();
}

PWIZ_API_DECL SpectrumPtr SpectrumList_ABI::spectrum(size_t index, bool getBinaryData) const
{
Expand Down
1 change: 1 addition & 0 deletions pwiz/data/vendor_readers/ABI/SpectrumList_ABI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class PWIZ_API_DECL SpectrumList_ABI : public SpectrumListBase
virtual size_t size() const;
virtual const SpectrumIdentity& spectrumIdentity(size_t index) const;
virtual size_t find(const std::string& id) const;

This comment has been minimized.

Copy link
@chambm

chambm Dec 17, 2024

Member

Can't the close call just go into ~WiffFile2Impl? I try to have SpectrumList dtor handle its resource cleanup at the same time as the pointer deletion.

virtual void close();
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData) const;
virtual SpectrumPtr spectrum(size_t index, DetailLevel detailLevel) const;
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData, const pwiz::util::IntegerSet& msLevelsToCentroid) const;
Expand Down
2 changes: 2 additions & 0 deletions pwiz/utility/misc/VendorReaderTestHarness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,8 @@ void testRead(const Reader& reader, const string& rawpath, const bfs::path& pare
if (msd_reverse.run.chromatogramListPtr.get())
for (size_t j = 0, end = msd_reverse.run.chromatogramListPtr->size(); j < end; ++j)
msd_reverse.run.chromatogramListPtr->chromatogram(end - j - 1);

msd_reverse.run.spectrumListPtr->close();
}

// no unicode test for HTTP paths
Expand Down
1 change: 1 addition & 0 deletions pwiz_aux/msrc/utility/vendor_api/ABI/WiffFileTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void test(const string& rawpath)
cout << "Full data enumeration: " << bpt::to_simple_string(stop - start) << endl;
}
}
wiffFile->close();
}


Expand Down
Binary file modified pwiz_aux/msrc/utility/vendor_api_ABI.7z
Binary file not shown.

0 comments on commit 042a9ea

Please sign in to comment.