From a4dd225d2953f17f3e6e4f1d609925d6f9d8bafb Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Wed, 21 Aug 2024 23:31:00 +0200 Subject: [PATCH] STYLE: Move `getKVstoreDriver(std::string)` into unnamed namespace Allowed `getKVstoreDriver` to be called by other functions from the unnamed namespace more easily. Following C++ Core Guidelines, May 11, 2024, "Use an unnamed (anonymous) namespace for all internal/non-exported entities", http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf22-use-an-unnamed-anonymous-namespace-for-all-internalnon-exported-entities --- src/itkOMEZarrNGFFImageIO.cxx | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/itkOMEZarrNGFFImageIO.cxx b/src/itkOMEZarrNGFFImageIO.cxx index 2a84b12..37c6344 100644 --- a/src/itkOMEZarrNGFFImageIO.cxx +++ b/src/itkOMEZarrNGFFImageIO.cxx @@ -166,6 +166,26 @@ itkToTensorstoreComponentType(const IOComponentEnum itkComponentType) } } +// Returns TensorStore KvStore driver name appropriate for this path. +// Options are file, zip. TODO: http, gcs (GoogleCouldStorage), etc. +std::string +getKVstoreDriver(std::string path) +{ + if (path.size() < 4) + { + return "file"; + } + if (path.substr(0, 4) == "http") + { // http or https + return "http"; + } + if (path.substr(path.size() - 4) == ".zip" || path.substr(path.size() - 7) == ".memory") + { + return "zip_memory"; + } + return "file"; +} + template void ReadFromStore(const tensorstore::TensorStore<> & store, const ImageIORegion & storeIORegion, TPixel * buffer) @@ -293,26 +313,6 @@ OMEZarrNGFFImageIO::PrintSelf(std::ostream & os, Indent indent) const os << indent << "ChannelIndex: " << m_ChannelIndex << std::endl; } -// Returns TensorStore KvStore driver name appropriate for this path. -// Options are file, zip. TODO: http, gcs (GoogleCouldStorage), etc. -std::string -getKVstoreDriver(std::string path) -{ - if (path.size() < 4) - { - return "file"; - } - if (path.substr(0, 4) == "http") - { // http or https - return "http"; - } - if (path.substr(path.size() - 4) == ".zip" || path.substr(path.size() - 7) == ".memory") - { - return "zip_memory"; - } - return "file"; -} - // JSON file path, e.g. "C:/Dev/ITKIOOMEZarrNGFF/v0.4/cyx.ome.zarr/.zgroup" void writeJson(nlohmann::json json, std::string path, std::string driver)