Adding columns to DynamicTable results in invalid colNames #107
Labels
category: bug
errors in the code or code behavior
category: proposal
proposed enhancements or new features
Currently,
DynamicTable
created thecolNames
attribute in itsinitalize
method here:aqnwb/src/nwb/hdmf/table/DynamicTable.cpp
Line 26 in 5c37c40
Adding columns via
DynamicTable.addColumn
, however, does not update thecolNames
.aqnwb/src/nwb/hdmf/table/DynamicTable.cpp
Lines 29 to 47 in 5c37c40
As such, we must set
colNames
before callingDynamicTable
as otherwise thecolNames
will not include any added columns, and is hence invalid.ElectrodeTable
works around this issue, by: 1) fixingcolNames
on construction, and 2) adding afinalize
method in which all columns are added at once, rather than allowing columns to be added individually viaaddColumn
aqnwb/src/nwb/file/ElectrodeTable.cpp
Lines 51 to 65 in 5c37c40
However, if a user would call
addColumn
on ``ElectrodeTableto add other columns it would result in a bad
colNames`.Possible solutions
DynamicTable.finalize
method and setcolNames
at the end rather than ininitialize
so that we can updatecolNames
when adding new columnsDynamicTable
is not valid untilfinalize
is called. This is not too bad for metadata tables that are being created and finalized at the beginning, however, this is problematic for tables that we may want to acquire data into, e.g,.TimeIntervals
orPlaneSegmentation
.colNames
dynamically, i.e., overwrite the attribute each time a new column is being added3) Add a
DynanmicTable.finalizeColumns
method to finish defining all columns to only allow adding new rows but not new columns.SWMR
mode in theHDFIO
backend. I.e., we would call this function before enablingSWMR
mode. We could potentially generalize this, and have aContainer.finalizeFields
function so that we could allfinalizeFields
for allContainers
in theNWBFile
We could
finalizeColumns
The text was updated successfully, but these errors were encountered: