Clarify ext creation methods
Closed this issue · 1 comments
kabasset commented
There is some asymmetry and some ambiguity in the extension creation methods of MefFile.
For example, initImageExt
creates a data unit full of zeros, while initBintableExt
creates no data unit.
Extending the current methods for insertion would mean adding an index as parameter, but would not be reflected in the method name.
Potential options are:
- append or insert
- image or binary table
- header only (minimal or with user records) or with data (zeros or provided values)
Which potentially makes a lot of methods (although some of them may be less useful).
Proposed naming:
append
orinsert
;Image
orBintable
;Header
(header-only) orExt
(non-empty data);
To avoid the proliferation of methods, the first parameter would be the user records as a RecordSeq, which means the RecordVec constructors should cover all needs, including an empty sequence.
template<typename T = unsinged char>
appendImageHeader(const RecordSeq& records = {}); // No data
template<typename T, N>
appendImageExt(const RecordSeq& records, Position<N> shape); // Fill with zeros, useful?
template<typename TRaster>
appendImageExt(const RecordSeq& records, const TRaster& raster); // Write raster
template<typename... TInfos>
appendBintableHeader(const RecordSeq& records = {}, TInfos... infos); // No data, possibly no column
template<typename... TInfos>
appendBintableExt(const RecordSeq& records, long rowCount, TInfos... infos); // Fill with zeros, useful?
template<typename... TColumns>
appendBintableExt(const RecordSeq& records, TColumns... columns);
kabasset commented
Done.