Skip to content

Commit 1bdb3a2

Browse files
author
Lawrence
committed
Allow BlueprintPipe to report data size.
Originally, this was only possible for BoundPipes as they forwarded DataStub data, but this method is also used when setting certain data types (i.e ElectricalSeries). Since BlueprintPipe technically can hold data, we do want to at least report what data it actually has. This is technically a hole as classes like ElectricalSeries don't have continuous validation whenever the BlueprintPipe configuration is set. This means that it is relatively simple to circumvent the internal class's data shape this way.
1 parent 71f39ab commit 1bdb3a2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

+types/+untyped/DataPipe.m

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,14 @@
232232
end
233233

234234
function sz = size(obj, varargin)
235-
assert(isa(obj.internal, 'types.untyped.datapipe.BoundPipe'),...
236-
'NWB:DataPipe:LoadingUnboundPipe',...
237-
['DataPipe must be successfully exported before DataStub '...
238-
'features are allowed.']);
239-
sz = size(obj.internal, varargin{:});
235+
if isa(obj.internal, 'types.untyped.datapipe.BoundPipe')
236+
sz = size(obj.internal, varargin{:});
237+
elseif isa(obj.internal, 'types.untyped.datapipe.BlueprintPipe')
238+
sz = size(obj.internal.data, varargin{:});
239+
else
240+
error('MatNWB:DataPipe:UnhandledPipe', ['Internal Datapipe of type `%s` does not '...
241+
'have a handled size() method.'], class(obj.internal));
242+
end
240243
end
241244

242245
function append(obj, data)

0 commit comments

Comments
 (0)