MCPcopy Create free account
hub / github.com/PDAL/PDAL / store

Method store

io/private/ept/Addon.cpp:63–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63AddonList Addon::store(const connector::Connector& connector, const NL::json& spec,
64 const PointLayout& layout)
65{
66 AddonList addons;
67 std::string filename;
68 try
69 {
70 for (auto it : spec.items())
71 {
72 std::string filename = it.key();
73 std::string dimName = it.value().get<std::string>();
74 if (!Utils::endsWith(filename, "ept-addon.json"))
75 filename += "/ept-addon.json";
76
77 Dimension::Id id = layout.findDim(dimName);
78 if (id == Dimension::Id::Unknown)
79 throw pdal_error("Invalid dimension '" + dimName + "' in "
80 "addon specification. Does not exist in source data.");
81 Dimension::Type type = layout.dimType(id);
82 std::string typestring = Dimension::toName(Dimension::base(type));
83 size_t size = Dimension::size(type);
84
85 Addon addon(dimName, filename, type);
86
87 NL::json meta;
88 meta["type"] = typestring;
89 meta["size"] = size;
90 meta["version"] = "1.0.0";
91 meta["dataType"] = "binary";
92
93 connector.makeDir(FileUtils::getDirectory(filename));
94 connector.put(filename, meta.dump());
95
96 addons.emplace_back(dimName, filename, type);
97 addons.back().setExternalId(id);
98 }
99 }
100 catch (NL::json::parse_error&)
101 {
102 throw pdal_error("Unable to parse EPT addon file '" + filename + "'.");
103 }
104 return addons;
105}
106
107AddonList Addon::load(const connector::Connector& connector, const NL::json& spec)
108{

Callers

nothing calls this directly

Calls 14

endsWithFunction · 0.85
toNameFunction · 0.85
baseFunction · 0.85
getDirectoryFunction · 0.85
itemsMethod · 0.80
makeDirMethod · 0.80
setExternalIdMethod · 0.80
sizeFunction · 0.50
keyMethod · 0.45
valueMethod · 0.45
findDimMethod · 0.45
dimTypeMethod · 0.45

Tested by

no test coverage detected