Пример #1
0
void PropertyFS::mapping(const std::string &mapping) {
    if (mapping.empty()) {
        throw EmptyString("mapping");
    }
    setAttr("mapping", mapping);
    forceUpdatedAt();
}
Пример #2
0
void PropertyFS::unit(const std::string &unit) {
    if (unit.empty()) {
        throw EmptyString("unit");
    }
    setAttr("unit", unit);
    forceUpdatedAt();
}
Пример #3
0
void PropertyFS::definition(const std::string &definition) {
    if (definition.empty()) {
        throw EmptyString("definition");
    } else {
        setAttr("definition", definition);
        forceUpdatedAt();
    }
}
Пример #4
0
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();
}
Пример #5
0
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();
}
Пример #6
0
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();
}
Пример #7
0
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);
}
Пример #8
0
void FeatureHDF5::linkType(LinkType link_type) {
    // linkTypeToString will generate an error if link_type is invalid
    group().setAttr("link_type", linkTypeToString(link_type));
    forceUpdatedAt();
}
Пример #9
0
void SectionHDF5::mapping(const string &mapping) {
    group().setAttr("mapping", mapping);
    forceUpdatedAt();
}
Пример #10
0
void PropertyFS::unit(const nix::none_t t) {
    if (hasAttr("unit")) {
        removeAttr("unit");
    }
    forceUpdatedAt();
}
Пример #11
0
void SectionHDF5::mapping(const none_t t) {
    if (group().hasAttr("mapping")) {
        group().removeAttr("mapping");
    }
    forceUpdatedAt();
}
Пример #12
0
void PropertyFS::mapping(const nix::none_t t) {
    if (hasAttr("mapping")) {
        removeAttr("mapping");
        forceUpdatedAt();
    }
}
Пример #13
0
void PropertyFS::definition(const nix::none_t t) {
    if (hasAttr("definition")) {
        removeAttr("definition");
    }
    forceUpdatedAt();
}
Пример #14
0
void SectionHDF5::link(const none_t t) {
    if (group().hasGroup("link")) {
        group().removeGroup("link");
    }
    forceUpdatedAt();
}
Пример #15
0
void EntityWithMetadataHDF5::metadata(const none_t t) {
    if (group().hasGroup("metadata")) {
        group().removeGroup("metadata");
    }
    forceUpdatedAt();
}
Пример #16
0
void SectionHDF5::repository(const string &repository) {
    group().setAttr("repository", repository);
    forceUpdatedAt();
}
Пример #17
0
void SectionHDF5::repository(const none_t t) {
    if (group().hasAttr("repository")) {
        group().removeAttr("repository");
    }
    forceUpdatedAt();
}