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,11 @@ 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+ for (auto host : std::views::split (hosts, " ,;" )) {
1672+ hostsPool.emplace_back (&*host.begin (), std::ranges::distance (host));
1673+ }
16841674}
16851675
16861676std::string CcdbApi::getHostUrl (int hostIndex) const
@@ -1838,7 +1828,7 @@ void CcdbApi::removeLeakingSemaphores(std::string const& snapshotdir, bool remov
18381828
18391829void CcdbApi::getFromSnapshot (bool createSnapshot, std::string const & path,
18401830 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
1831+ std::string& snapshotpath, std ::pmr::vector<char >& dest, int & fromSnapshot, std::string const & etag) const
18421832{
18431833 if (createSnapshot) { // create named semaphore
18441834 std::string logfile = mSnapshotCachePath + " /log" ;
@@ -1892,7 +1882,7 @@ void CcdbApi::loadFileToMemory(std::vector<char>& dest, std::string const& path,
18921882 std::map<std::string, std::string>* headers, std::string const & etag,
18931883 const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot) const
18941884{
1895- o2 ::pmr::vector<char > destP;
1885+ std ::pmr::vector<char > destP;
18961886 destP.reserve (dest.size ());
18971887 loadFileToMemory (destP, path, metadata, timestamp, headers, etag, createdNotAfter, createdNotBefore, considerSnapshot);
18981888 dest.clear ();
@@ -1902,7 +1892,7 @@ void CcdbApi::loadFileToMemory(std::vector<char>& dest, std::string const& path,
19021892 }
19031893}
19041894
1905- void CcdbApi::loadFileToMemory (o2 ::pmr::vector<char >& dest, std::string const & path,
1895+ void CcdbApi::loadFileToMemory (std ::pmr::vector<char >& dest, std::string const & path,
19061896 std::map<std::string, std::string> const & metadata, long timestamp,
19071897 std::map<std::string, std::string>* headers, std::string const & etag,
19081898 const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot) const
@@ -1920,7 +1910,7 @@ void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, std::string const& p
19201910 vectoredLoadFileToMemory (contexts);
19211911}
19221912
1923- void CcdbApi::appendFlatHeader (o2 ::pmr::vector<char >& dest, const std::map<std::string, std::string>& headers)
1913+ void CcdbApi::appendFlatHeader (std ::pmr::vector<char >& dest, const std::map<std::string, std::string>& headers)
19241914{
19251915 size_t hsize = getFlatHeaderSize (headers), cnt = dest.size ();
19261916 dest.resize (cnt + hsize);
@@ -1985,7 +1975,7 @@ void CcdbApi::vectoredLoadFileToMemory(std::vector<RequestContext>& requestConte
19851975 }
19861976}
19871977
1988- bool CcdbApi::loadLocalContentToMemory (o2 ::pmr::vector<char >& dest, std::string& url) const
1978+ bool CcdbApi::loadLocalContentToMemory (std ::pmr::vector<char >& dest, std::string& url) const
19891979{
19901980 if (url.find (" alien:/" , 0 ) != std::string::npos) {
19911981 std::map<std::string, std::string> localHeaders;
@@ -2013,7 +2003,7 @@ bool CcdbApi::loadLocalContentToMemory(o2::pmr::vector<char>& dest, std::string&
20132003 return false ;
20142004}
20152005
2016- void CcdbApi::loadFileToMemory (o2 ::pmr::vector<char >& dest, const std::string& path, std::map<std::string, std::string>* localHeaders, bool fetchLocalMetaData) const
2006+ void CcdbApi::loadFileToMemory (std ::pmr::vector<char >& dest, const std::string& path, std::map<std::string, std::string>* localHeaders, bool fetchLocalMetaData) const
20172007{
20182008 // Read file to memory as vector. For special case of the locally cached file retriev metadata stored directly in the file
20192009 constexpr size_t MaxCopySize = 0x1L << 25 ;
0 commit comments