Exemple #1
0
void PropertyFS::mapping(const std::string &mapping) {
    if (mapping.empty()) {
        throw EmptyString("mapping");
    }
    setAttr("mapping", mapping);
    forceUpdatedAt();
}
Exemple #2
0
void PropertyFS::unit(const std::string &unit) {
    if (unit.empty()) {
        throw EmptyString("unit");
    }
    setAttr("unit", unit);
    forceUpdatedAt();
}
Exemple #3
0
void PropertyFS::definition(const std::string &definition) {
    if (definition.empty()) {
        throw EmptyString("definition");
    } else {
        setAttr("definition", definition);
        forceUpdatedAt();
    }
}
Exemple #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();
}
Exemple #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();
}
Exemple #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();
}
Exemple #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);
}
Exemple #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();
}
Exemple #9
0
void SectionHDF5::mapping(const string &mapping) {
    group().setAttr("mapping", mapping);
    forceUpdatedAt();
}
Exemple #10
0
void PropertyFS::unit(const nix::none_t t) {
    if (hasAttr("unit")) {
        removeAttr("unit");
    }
    forceUpdatedAt();
}
Exemple #11
0
void SectionHDF5::mapping(const none_t t) {
    if (group().hasAttr("mapping")) {
        group().removeAttr("mapping");
    }
    forceUpdatedAt();
}
Exemple #12
0
void PropertyFS::mapping(const nix::none_t t) {
    if (hasAttr("mapping")) {
        removeAttr("mapping");
        forceUpdatedAt();
    }
}
Exemple #13
0
void PropertyFS::definition(const nix::none_t t) {
    if (hasAttr("definition")) {
        removeAttr("definition");
    }
    forceUpdatedAt();
}
Exemple #14
0
void SectionHDF5::link(const none_t t) {
    if (group().hasGroup("link")) {
        group().removeGroup("link");
    }
    forceUpdatedAt();
}
Exemple #15
0
void EntityWithMetadataHDF5::metadata(const none_t t) {
    if (group().hasGroup("metadata")) {
        group().removeGroup("metadata");
    }
    forceUpdatedAt();
}
Exemple #16
0
void SectionHDF5::repository(const string &repository) {
    group().setAttr("repository", repository);
    forceUpdatedAt();
}
Exemple #17
0
void SectionHDF5::repository(const none_t t) {
    if (group().hasAttr("repository")) {
        group().removeAttr("repository");
    }
    forceUpdatedAt();
}