5 #include <SimoxUtility/algorithm/string/string_tools.h>
18 const std::string& exportName,
20 const std::shared_ptr<Processors>& filters) :
22 DiskMemoryItemMixin(p, exportName, id),
23 MongoDBStorageMixin(
s, exportName, id)
51 auto& dictConverter =
processors->defaultObjectConverter;
59 std::string dataFilename = (
DATA_FILENAME + dictConverter.suffix);
61 std::filesystem::path dataPath =
getFullPath() / dataFilename;
62 std::filesystem::path metadataPath =
getFullPath() / metadataFilename;
68 auto dataaron = dictConverter.convert({datafilecontent,
""}, {});
73 ARMARX_ERROR <<
"Could not find the data file '" << dataPath.string()
74 <<
"'. Continuing without data.";
81 auto metadataaron = dictConverter.convert({metadatafilecontent,
""}, {});
86 ARMARX_ERROR <<
"Could not find the metadata file '" << metadataPath.string()
87 <<
"'. Continuing without metadata.";
93 for (
const auto& [key, m] : datadict->getElements())
100 for (
const auto& filepath : allFilesInIndexFolder)
105 std::string mode = simox::alg::remove_suffix(
106 simox::alg::remove_prefix(filepath.filename(), key), f->suffix);
109 auto memberaron = f->convert(
110 {memberfilecontent, mode},
112 datadict->setElement(key, memberaron);
126 if (
id().instanceIndex < 0)
129 <<
"During storage of segment '" << e.
id().
str()
130 <<
"' I noticed that the corresponding LTM has no id set. "
131 <<
"I set the id of the LTM to the same name, however this should not happen!";
135 auto& dictConverter =
processors->defaultObjectConverter;
146 auto dataAron = std::make_shared<aron::data::Dict>();
147 auto metadataAron = std::make_shared<aron::data::Dict>();
148 to_aron(metadataAron, dataAron, e);
150 std::shared_ptr<aron::data::Dict>
source;
152 bool saveAndExtract =
159 source = dataAron->clone();
174 auto dataExt =
c->extractor->extract(
source);
176 for (
const auto& [memberName, var] : dataExt.extraction)
180 auto [memberDataVec, memberDataModeSuffix] =
c->convert(var);
182 std::string
filename = (memberName + memberDataModeSuffix +
c->suffix);
190 auto [dataVec, dataVecModeSuffix] = dictConverter.convert(dataAron);
191 auto [metadataVec, metadataVecModeSuffix] = dictConverter.convert(metadataAron);
195 auto dataToReturn = nlohmann::json::parse(std::string(dataVec.begin(), dataVec.end()));
198 std::string dataFilename = (
DATA_FILENAME + dictConverter.suffix);
200 std::filesystem::path dataPath =
getFullPath() / dataFilename;
201 std::filesystem::path metadataPath =
getFullPath() / metadataFilename;