2#include <SimoxUtility/algorithm/vector.hpp>
12 const std::string& prefix)
14 if (not defs->hasDefinition(prefix +
"packageName"))
17 prefix +
"packageName",
18 "The name of the prior knowledge data package.");
31 const std::filesystem::path absPathToDataset = this->
getFullPath(dataset);
32 if (std::filesystem::is_regular_file(absPathToDataset))
38 for (
const auto& d : std::filesystem::directory_iterator(absPathToDataset))
40 if (!d.is_directory())
45 std::string k = d.path().filename();
46 if (simox::alg::contains(ID_BLACKLIST, k))
51 if (not this->
check(dataset, k))
63 if (std::filesystem::is_regular_file(absPath))
69 for (
const auto& d : std::filesystem::directory_iterator(absPath))
71 if (!d.is_directory())
76 std::string k = d.path().filename();
77 if (simox::alg::contains(DATASET_FOLDERS_BLACKLIST, k))
93 if (simox::alg::contains(DATASET_FOLDERS_BLACKLIST, dataset))
98 if (simox::alg::contains(ID_BLACKLIST,
id))
103 const std::filesystem::path idPath = std::filesystem::path(dataset) / id;
104 const std::filesystem::path absPathToId = this->
getFullPath(idPath);
106 return this->
accept(absPathToId);
113 if (std::filesystem::is_regular_file(absPath))
119 for (
const auto& d : std::filesystem::directory_iterator(absPath))
121 if (!d.is_directory())
126 std::string k = d.path().filename();
127 if (simox::alg::contains(DATASET_FOLDERS_BLACKLIST, k))
132 if (this->
check(k,
id))
140 std::optional<PKDatasetFinderInfo>
143 const std::filesystem::path idPath = std::filesystem::path(dataset) / id;
144 const std::filesystem::path absPathToId = this->
getFullPath(idPath);
146 if (this->
check(dataset,
id))
158 std::optional<PKDatasetFinderInfo>
162 if (std::filesystem::is_regular_file(absPath))
168 std::vector<PKDatasetFinderInfo> ret;
169 for (
const auto& d : std::filesystem::directory_iterator(absPath))
171 if (!d.is_directory())
176 std::string k = d.path().filename();
177 if (simox::alg::contains(DATASET_FOLDERS_BLACKLIST, k))
182 if (
auto op = this->
find(k,
id); op.has_value())
190 std::vector<PKDatasetFinderInfo>
194 if (std::filesystem::is_regular_file(absPath))
200 std::vector<PKDatasetFinderInfo> ret;
201 for (
const auto& d : std::filesystem::directory_iterator(absPath))
203 if (!d.is_directory())
208 std::string k = d.path().filename();
209 if (simox::alg::contains(DATASET_FOLDERS_BLACKLIST, k))
214 auto idsForDataset = this->
findAll(k);
215 simox::alg::append(ret, idsForDataset);
220 std::vector<PKDatasetFinderInfo>
223 const std::filesystem::path absPathToDataset = this->
getFullPath(dataset);
224 if (std::filesystem::is_regular_file(absPathToDataset))
230 std::vector<PKDatasetFinderInfo> ret;
231 for (
const auto& d : std::filesystem::directory_iterator(absPathToDataset))
233 if (!d.is_directory())
238 std::string k = d.path().filename();
239 if (simox::alg::contains(ID_BLACKLIST, k))
244 if (
auto op = this->
find(dataset, k); op.has_value())
246 ret.emplace_back(op.value());
std::filesystem::path getFullPath() const
virtual bool accept(const std::filesystem::path &idPath) const =0
std::string getPackageName() const
std::filesystem::path getAbsolutePackagePath() const
void recalculateBasePath()
std::filesystem::path getRelativePath() const
The PKDatasetFinderInfo class Specialization of the DatasetFinderInfo with strings as dataset and id ...
std::optional< PKDatasetFinderInfo > find(const std::string &dataset, const std::string &id) const override
std::vector< PKDatasetFinderInfo > findAll() const override
bool checkAll() const override
virtual void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &defs, const std::string &prefix)
bool check(const std::string &id) const override
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.