26 #ifndef VEC_METADATA_H 27 #define VEC_METADATA_H 31 #include <unordered_map> 48 std::vector<MetaDataVecRow>
_rows;
58 void init(
const std::vector<MDLabel>& labelsVector);
61 void _clear(
bool onlyData=
false);
85 const std::vector<MDLabel> *desiredLabels,
bool firstTime)
override;
104 MetaDataVec(
const std::vector<MDLabel> &labelsVector);
125 void clear()
override;
141 void writeText(
const FileName fn,
const std::vector<MDLabel>* desiredLabels)
const override;
150 void addRows(
const std::vector<MDRowVec> &rows);
188 return this->
getValue(label,
id).getValue2(T());
193 return this->
getValue(label,
id).getValue2(T());
196 std::unique_ptr<MDRow>
getRow(
size_t id)
override;
197 std::unique_ptr<const MDRow>
getRow(
size_t id)
const override;
204 bool getRowValues(
size_t id, std::vector<MDObject> &values)
const override;
218 return MetaData::getColumnValues<T>(label);
232 size_t size()
const override;
280 void importObjects(
const MetaData &md,
const std::vector<size_t> &objectsToAdd,
bool doClear=
true)
override;
293 void removeObjects(
const std::vector<size_t> &toRemove)
override;
312 void findObjects(std::vector<size_t> &objectsOut,
const MDQuery &query)
const override;
313 void findObjects(std::vector<size_t> &objectsOut,
int limit = -1)
const override;
330 void _writeRows(std::ostream &os)
const override;
348 const std::vector<MDLabel> *desiredLabels =
nullptr,
350 bool decomposeStack=
true);
357 void read(
const FileName &inFile,
const std::vector<MDLabel> *desiredLabels =
nullptr,
bool decomposeStack =
true)
override;
436 void split(
size_t n, std::vector<MetaDataVec> &results,
462 template <
bool IsConst>
468 std::unique_ptr<RowType> _row;
473 if (_i < _mdv.size())
474 _row.reset(
new RowType(mdv._rows.at(i),
i, mdv._label_to_col, mdv._col_to_label, mdv._no_columns));
479 std::unique_ptr<MDBaseRowIterator<IsConst>>
clone()
override {
480 return memoryUtils::make_unique<MDVecRowIterator<IsConst>>(_mdv, _i);
485 if (_i < _mdv.size())
486 _row.reset(
new RowType(_mdv._rows.at(_i), _i, _mdv._label_to_col, _mdv._col_to_label, _mdv._no_columns));
494 return _i == vri->_i;
502 return {memoryUtils::make_unique<MDVecRowIterator<false>>(*
this, 0)};
505 return {memoryUtils::make_unique<MDVecRowIterator<false>>(*
this, this->
size())};
509 return {memoryUtils::make_unique<MDVecRowIterator<true>>(*
this, 0)};
512 return {memoryUtils::make_unique<MDVecRowIterator<true>>(*
this, this->
size())};
516 template <
bool IsConst>
524 : _mdv(mdv), _i(i) {}
529 return this->_i == dri->_i;
537 std::unique_ptr<MDBaseIdIterator<IsConst>>
clone()
override {
538 return memoryUtils::make_unique<MDVecIdIterator<IsConst>>(_mdv, _i);
543 return {memoryUtils::make_unique<MDVecIdIterator<false>>(*
this, 0)};
547 return {memoryUtils::make_unique<MDVecIdIterator<false>>(*
this, this->
size())};
551 return {memoryUtils::make_unique<MDVecIdIterator<true>>(*
this, 0)};
555 return {memoryUtils::make_unique<MDVecIdIterator<true>>(*
this, this->
size())};
569 const std::vector<MDLabel> &newLabel)
override;
basic_istream< char, std::char_traits< char > > istream