Skip to content

Commit

Permalink
STYLE: Move getKVstoreDriver(std::string) into unnamed namespace
Browse files Browse the repository at this point in the history
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
  • Loading branch information
N-Dekker committed Aug 22, 2024
1 parent bd43bfe commit a4dd225
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/itkOMEZarrNGFFImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename TPixel>
void
ReadFromStore(const tensorstore::TensorStore<> & store, const ImageIORegion & storeIORegion, TPixel * buffer)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a4dd225

Please sign in to comment.