2424#include " Framework/DataTakingContext.h"
2525#include < chrono>
2626#include < memory>
27+ #include < ranges>
2728#include < sstream>
2829#include < TFile.h>
2930#include < TGrid.h>
@@ -843,7 +844,7 @@ bool CcdbApi::retrieveBlob(std::string const& path, std::string const& targetdir
843844 return false ;
844845 }
845846
846- o2 ::pmr::vector<char > buff;
847+ std ::pmr::vector<char > buff;
847848 std::map<std::string, std::string> headers;
848849 // avoid creating snapshot via loadFileToMemory itself
849850 loadFileToMemory (buff, path, metadata, timestamp, &headers, " " , createdNotAfter, createdNotBefore, false );
@@ -1665,22 +1666,13 @@ int CcdbApi::updateMetadata(std::string const& path, std::map<std::string, std::
16651666 return ret;
16661667}
16671668
1668- std::vector<std::string> CcdbApi::splitString (const std::string& str, const char * delimiters)
1669- {
1670- std::vector<std::string> tokens;
1671- char stringForStrTok[str.length () + 1 ];
1672- strcpy (stringForStrTok, str.c_str ());
1673- char * token = strtok (stringForStrTok, delimiters);
1674- while (token != nullptr ) {
1675- tokens.emplace_back (token);
1676- token = strtok (nullptr , delimiters);
1677- }
1678- return tokens;
1679- }
1680-
16811669void CcdbApi::initHostsPool (std::string hosts)
16821670{
1683- hostsPool = splitString (hosts, " ,;" );
1671+ hostsPool.clear ();
1672+ auto splitted = hosts | std::views::transform ([](char c) { return (c == ' ;' ) ? ' ,' : c; }) | std::views::split (' ,' );
1673+ for (auto && part : splitted) {
1674+ hostsPool.emplace_back (part.begin (), part.end ());
1675+ }
16841676}
16851677
16861678std::string CcdbApi::getHostUrl (int hostIndex) const
@@ -1838,7 +1830,7 @@ void CcdbApi::removeLeakingSemaphores(std::string const& snapshotdir, bool remov
18381830
18391831void CcdbApi::getFromSnapshot (bool createSnapshot, std::string const & path,
18401832 long timestamp, std::map<std::string, std::string>& headers,
1841- std::string& snapshotpath, o2 ::pmr::vector<char >& dest, int & fromSnapshot, std::string const & etag) const
1833+ std::string& snapshotpath, std ::pmr::vector<char >& dest, int & fromSnapshot, std::string const & etag) const
18421834{
18431835 if (createSnapshot) { // create named semaphore
18441836 std::string logfile = mSnapshotCachePath + " /log" ;
@@ -1892,7 +1884,7 @@ void CcdbApi::loadFileToMemory(std::vector<char>& dest, std::string const& path,
18921884 std::map<std::string, std::string>* headers, std::string const & etag,
18931885 const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot) const
18941886{
1895- o2 ::pmr::vector<char > destP;
1887+ std ::pmr::vector<char > destP;
18961888 destP.reserve (dest.size ());
18971889 loadFileToMemory (destP, path, metadata, timestamp, headers, etag, createdNotAfter, createdNotBefore, considerSnapshot);
18981890 dest.clear ();
@@ -1902,7 +1894,7 @@ void CcdbApi::loadFileToMemory(std::vector<char>& dest, std::string const& path,
19021894 }
19031895}
19041896
1905- void CcdbApi::loadFileToMemory (o2 ::pmr::vector<char >& dest, std::string const & path,
1897+ void CcdbApi::loadFileToMemory (std ::pmr::vector<char >& dest, std::string const & path,
19061898 std::map<std::string, std::string> const & metadata, long timestamp,
19071899 std::map<std::string, std::string>* headers, std::string const & etag,
19081900 const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot) const
@@ -1920,7 +1912,7 @@ void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, std::string const& p
19201912 vectoredLoadFileToMemory (contexts);
19211913}
19221914
1923- void CcdbApi::appendFlatHeader (o2 ::pmr::vector<char >& dest, const std::map<std::string, std::string>& headers)
1915+ void CcdbApi::appendFlatHeader (std ::pmr::vector<char >& dest, const std::map<std::string, std::string>& headers)
19241916{
19251917 size_t hsize = getFlatHeaderSize (headers), cnt = dest.size ();
19261918 dest.resize (cnt + hsize);
@@ -1985,7 +1977,7 @@ void CcdbApi::vectoredLoadFileToMemory(std::vector<RequestContext>& requestConte
19851977 }
19861978}
19871979
1988- bool CcdbApi::loadLocalContentToMemory (o2 ::pmr::vector<char >& dest, std::string& url) const
1980+ bool CcdbApi::loadLocalContentToMemory (std ::pmr::vector<char >& dest, std::string& url) const
19891981{
19901982 if (url.find (" alien:/" , 0 ) != std::string::npos) {
19911983 std::map<std::string, std::string> localHeaders;
@@ -2013,7 +2005,7 @@ bool CcdbApi::loadLocalContentToMemory(o2::pmr::vector<char>& dest, std::string&
20132005 return false ;
20142006}
20152007
2016- void CcdbApi::loadFileToMemory (o2 ::pmr::vector<char >& dest, const std::string& path, std::map<std::string, std::string>* localHeaders, bool fetchLocalMetaData) const
2008+ void CcdbApi::loadFileToMemory (std ::pmr::vector<char >& dest, const std::string& path, std::map<std::string, std::string>* localHeaders, bool fetchLocalMetaData) const
20172009{
20182010 // Read file to memory as vector. For special case of the locally cached file retriev metadata stored directly in the file
20192011 constexpr size_t MaxCopySize = 0x1L << 25 ;
0 commit comments