void PropertyFS::mapping(const std::string &mapping) { if (mapping.empty()) { throw EmptyString("mapping"); } setAttr("mapping", mapping); forceUpdatedAt(); }
void PropertyFS::unit(const std::string &unit) { if (unit.empty()) { throw EmptyString("unit"); } setAttr("unit", unit); forceUpdatedAt(); }
void PropertyFS::definition(const std::string &definition) { if (definition.empty()) { throw EmptyString("definition"); } else { setAttr("definition", definition); forceUpdatedAt(); } }
void FeatureFS::data(const std::string &name_or_id) { if (name_or_id.empty()) throw EmptyString("data(id)"); if (!block->hasEntity({name_or_id, ObjectType::DataArray})) throw std::runtime_error("FeatureFS::data: DataArray not found in block!"); if (hasObject("data")) removeObjectByNameOrAttribute("name", "data"); auto target = std::dynamic_pointer_cast<DataArrayFS>(block->getEntity({name_or_id, ObjectType::DataArray})); bfs::path p(location()), m("data"); target->createLink(p / m); forceUpdatedAt(); }
void FeatureHDF5::data(const std::string &name_or_id) { if (!block->hasDataArray(name_or_id)) { throw std::runtime_error("FeatureHDF5::data: DataArray not found in block!"); } if (group().hasGroup("data")) { group().removeGroup("data"); } auto target = dynamic_pointer_cast<DataArrayHDF5>(block->getDataArray(name_or_id)); group().createLink(target->group(), "data"); forceUpdatedAt(); }
void EntityWithMetadataFS::metadata(const none_t t) { if (fileMode() == FileMode::ReadOnly) { throw std::runtime_error("EntityWithMetdata::metadata trying to set metadata in ReadOnly mode."); } if (hasMetadata()) { bfs::path p(location()), m("metadata"), other_loc(p/m); auto sec_tmp = std::make_shared<EntityWithMetadataFS>(file(), other_loc.string()); bfs::path p1(location()), p2("metadata"); sec_tmp->unlink(p1 / p2); bfs::remove_all(p1/p2); } forceUpdatedAt(); }
PropertyFS::PropertyFS(const std::shared_ptr<base::IFile> &file, const bfs::path &loc, const std::string &id, const std::string &name, const DataType &dataType) : DirectoryWithAttributes(loc / bfs::path(name), file->fileMode()) { if (name.empty()) { throw EmptyString("name"); } else { setAttr("name", name); forceUpdatedAt(); } setAttr("entity_id", id); setAttr("data_type", nix::data_type_to_string(dataType)); time_t t = util::getTime(); setUpdatedAt(); forceCreatedAt(t); }
void FeatureHDF5::linkType(LinkType link_type) { // linkTypeToString will generate an error if link_type is invalid group().setAttr("link_type", linkTypeToString(link_type)); forceUpdatedAt(); }
void SectionHDF5::mapping(const string &mapping) { group().setAttr("mapping", mapping); forceUpdatedAt(); }
void PropertyFS::unit(const nix::none_t t) { if (hasAttr("unit")) { removeAttr("unit"); } forceUpdatedAt(); }
void SectionHDF5::mapping(const none_t t) { if (group().hasAttr("mapping")) { group().removeAttr("mapping"); } forceUpdatedAt(); }
void PropertyFS::mapping(const nix::none_t t) { if (hasAttr("mapping")) { removeAttr("mapping"); forceUpdatedAt(); } }
void PropertyFS::definition(const nix::none_t t) { if (hasAttr("definition")) { removeAttr("definition"); } forceUpdatedAt(); }
void SectionHDF5::link(const none_t t) { if (group().hasGroup("link")) { group().removeGroup("link"); } forceUpdatedAt(); }
void EntityWithMetadataHDF5::metadata(const none_t t) { if (group().hasGroup("metadata")) { group().removeGroup("metadata"); } forceUpdatedAt(); }
void SectionHDF5::repository(const string &repository) { group().setAttr("repository", repository); forceUpdatedAt(); }
void SectionHDF5::repository(const none_t t) { if (group().hasAttr("repository")) { group().removeAttr("repository"); } forceUpdatedAt(); }