Skip to content

Commit

Permalink
apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
stephprince authored Aug 29, 2024
1 parent 84f5597 commit 5b6b5c0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
5 changes: 4 additions & 1 deletion docs/pages/devdocs/nwb_schema.dox
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
* \section dev_docs_updating_nwb_schema_section Updating the schema
*
* Currently, the version of the schema being used for development is fixed and stored in the `/resources/schema` folder.
* At a later date, these folders will be updated to git submodules, and we will add further instructions on coordinating schema updates with AqNWB API updates.
* Updating to a newer version of the schema requires:
* - Regeneration of the `spec` header files via `resources/generate_spec_files.py`
* - Update of existing `Container` classes and unit tests in AqNWB to match changes in the new schema compared to the previous schema
* - Successful completion of all unit-test and round-trip testing with PyNWB and MatNWB
*
*/

2 changes: 1 addition & 1 deletion resources/generate_spec_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
with open(header_file, 'w') as fo:
fo.write('#pragma once\n\n')
fo.write('#include <string>\n#include <string_view>\n#include <array>\n\n')
fo.write(f'namespace AQNWB::spec::{ns['name'].replace('-', '_')}\n{{\n\n')
fo.write(f'namespace AQNWB::SPEC::{ns['name'].upper().replace('-', '_')}\n{{\n\n')
fo.write(f'const std::string version = "{ns["version"]}";\n\n')

# load and convert schema files
Expand Down
12 changes: 6 additions & 6 deletions src/nwb/NWBFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Status NWBFile::createFileStructure()
}

io->createCommonNWBAttributes("/", "core", "NWBFile", "");
io->createAttribute(AQNWB::spec::core::version, "/", "nwb_version");
io->createAttribute(AQNWB::SPEC::CORE::version, "/", "nwb_version");

io->createGroup("/acquisition");
io->createGroup("/analysis");
Expand All @@ -71,13 +71,13 @@ Status NWBFile::createFileStructure()
io->createGroup("/specifications");
io->createReferenceAttribute("/specifications", "/", ".specloc");

cacheSpecifications("core", spec::core::version, spec::core::specVariables);
cacheSpecifications("core", AQNWB::SPEC::CORE::version, AQNWB::SPEC::CORE::specVariables);
cacheSpecifications("hdmf-common",
spec::hdmf_common::version,
spec::hdmf_common::specVariables);
AQNWB::SPEC::HDMF_COMMON::version,
AQNWB::SPEC::HDMF_COMMON::specVariables);
cacheSpecifications("hdmf-experimental",
spec::hdmf_experimental::version,
spec::hdmf_experimental::specVariables);
AQNWB::SPEC::HDMF_EXPERIMENTAL::version,
AQNWB::SPEC::HDMF_EXPERIMENTAL::specVariables);

std::string time = getCurrentTime();
std::vector<std::string> timeVec = {time};
Expand Down
4 changes: 3 additions & 1 deletion src/nwb/NWBFile.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#pragma once

#include <array>
#include <cstdint>
#include <map>
#include <memory>
#include <string>
#include <string_view>
#include <vector>

#include "BaseIO.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/spec/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string>
#include <string_view>

namespace AQNWB::spec::core
namespace AQNWB::SPEC::CORE
{

const std::string version = "2.7.0";
Expand Down
2 changes: 1 addition & 1 deletion src/spec/hdmf_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string>
#include <string_view>

namespace AQNWB::spec::hdmf_common
namespace AQNWB::SPEC::HDMF_COMMON
{

const std::string version = "1.8.0";
Expand Down
2 changes: 1 addition & 1 deletion src/spec/hdmf_experimental.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string>
#include <string_view>

namespace AQNWB::spec::hdmf_experimental
namespace AQNWB::SPEC::HDMF_EXPERIMENTAL
{

const std::string version = "0.5.0";
Expand Down

0 comments on commit 5b6b5c0

Please sign in to comment.