Skip to content

Commit 6ca90bf

Browse files
authored
Remove napi5 and most of napi test layer (#39691)
### Description of work #### Summary of work With PR #39657, now `napi5` is almost completely unused, and `napi` is only being used for `NXopenaddress` (to be removed in PR #39658). It is therefore safe at this point to remove `napi5` and most of the tests of `napi`. The following have been left in the `napi` layer: - `napi` because `NXopenaddress` is still being called, and it is needed for the remaining tests to work - `NapiUnitTest` because it may have useful tests to be duplicated in `NexusFileTest`, and contains some notes on proper functionality - `napi_test_cpp` because it is actually a test of `Nexus::File` - `test_nxunlimited` because it has a useful test of unlimited dimensions that doesn't seem to be replicated in other tests Part of #38332 EWM 11399 #### Further detail of work Lots of deletions. It feels good. Note that `napi.cpp` now implements `NXgetdata` and `NXgetchardata` from `napi5`. These methods now *only* show up in the tests of the `napi` layer, so it doesn't particularly matter how this is implemented at this point so long as the tests pass. ### To test: This is a refactor. The existing tests passing, in particular tests in the Nexus and DataHandling layers, should suffice. This does not require release notes because it is a purely internal matter. <!-- --> --- ### Reviewer Please comment on the points listed below ([full description](http://developer.mantidproject.org/ReviewingAPullRequest.html)). **Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review.** If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed. #### Code Review - Is the code of an acceptable quality? - Does the code conform to the [coding standards](http://developer.mantidproject.org/Standards/)? - Are the unit tests small and test the class in isolation? - If there is GUI work does it follow the [GUI standards](http://developer.mantidproject.org/Standards/GUIStandards.html)? - If there are changes in the release notes then do they describe the changes appropriately? - Do the release notes conform to the [release notes guide](https://developer.mantidproject.org/Standards/ReleaseNotesGuide.html)? #### Functional Tests - Do changes function as described? Add comments below that describe the tests performed? - Do the changes handle unexpected situations, e.g. bad input? - Has the relevant (user and developer) documentation been added/updated? Does everything look good? Mark the review as **Approve**. A member of `@mantidproject/gatekeepers` will take care of it. ### Gatekeeper If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.
1 parent dede124 commit 6ca90bf

20 files changed

+203
-1271
lines changed

Framework/DataHandling/src/LoadISISNexus2.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ void LoadISISNexus2::exec() {
386386
m_spec.clear();
387387
m_monitors.clear();
388388
m_wsInd2specNum_map.clear();
389+
m_nexusFile->close();
389390
}
390391
/**
391392
Check for a set of synthetic logs associated with multi-period log data. Raise

Framework/Nexus/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ set(SRC_FILES
22
src/H5Util.cpp
33
src/NexusClasses.cpp
44
src/napi.cpp
5-
src/napi5.cpp
65
src/napi_helper.cpp
76
src/NexusDescriptor.cpp
87
src/NexusException.cpp
@@ -16,7 +15,6 @@ set(INC_FILES
1615
inc/MantidNexus/NexusIOHelper.h
1716
inc/MantidNexus/NexusFile_fwd.h
1817
inc/MantidNexus/napi.h
19-
inc/MantidNexus/napi5.h
2018
inc/MantidNexus/napi_helper.h
2119
inc/MantidNexus/NexusDescriptor.h
2220
inc/MantidNexus/NexusException.h

Framework/Nexus/inc/MantidNexus/NexusFile_fwd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ typedef struct {
8282
* \li EOD end of file -1
8383
* \ingroup cpp_types
8484
*/
85-
enum class NXstatus : const int { NX_OK = 1, NX_ERROR = 0, NX_EOD = -1 };
85+
enum class NXstatus : const int { NX_OK = 1, NX_ERROR = 0 };
8686

8787
/*--------------------------------------------------------------------------*/
8888

Framework/Nexus/inc/MantidNexus/napi5.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

Framework/Nexus/inc/MantidNexus/napi_helper.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
#include <hdf5.h>
88

9-
MANTID_NEXUS_DLL pNexusFile5 NXI5assert(NXhandle fid);
10-
119
MANTID_NEXUS_DLL herr_t readStringAttribute(hid_t attr, char **data);
1210

1311
MANTID_NEXUS_DLL herr_t readStringAttributeN(hid_t attr, char *data, std::size_t maxlen);

Framework/Nexus/src/NexusFile.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ using std::string;
2020
using std::stringstream;
2121
using std::vector;
2222

23+
#ifdef H5_VERSION_GE
24+
#if !H5_VERSION_GE(1, 8, 0)
25+
#error HDF5 Version must be 1.8.0 or higher
26+
#endif
27+
#endif
28+
2329
#ifdef WIN32
30+
#define snprintf _snprintf
2431
#define strdup _strdup
2532
#endif
2633

@@ -1355,11 +1362,10 @@ template <typename NumT> void File::readData(std::string const &dataName, std::v
13551362
}
13561363

13571364
template <typename NumT> void File::readData(std::string const &dataName, NumT &data) {
1358-
std::vector<NumT> dataVector;
1365+
std::vector<NumT> dataVector(1, 0);
13591366
this->openData(dataName);
13601367
this->getData(dataVector);
1361-
if (!dataVector.empty())
1362-
data = dataVector[0];
1368+
data = dataVector[0];
13631369
this->closeData();
13641370
}
13651371

0 commit comments

Comments
 (0)