Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions CCDB/include/CCDB/CcdbApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,6 @@ class CcdbApi //: public DatabaseInterface
// convert type_info to TClass, throw on failure
static TClass* tinfo2TClass(std::type_info const& tinfo);

// split string on delimiters and return tokens as vector
std::vector<std::string> splitString(const std::string& str, const char* delimiters);

typedef size_t (*CurlWriteCallback)(void*, size_t, size_t, void*);

void initCurlOptionsForRetrieve(CURL* curlHandle, void* pointer, CurlWriteCallback writeCallback, bool followRedirect = true) const;
Expand Down
20 changes: 6 additions & 14 deletions CCDB/src/CcdbApi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "Framework/DataTakingContext.h"
#include <chrono>
#include <memory>
#include <ranges>
#include <sstream>
#include <TFile.h>
#include <TGrid.h>
Expand Down Expand Up @@ -1665,22 +1666,13 @@ int CcdbApi::updateMetadata(std::string const& path, std::map<std::string, std::
return ret;
}

std::vector<std::string> CcdbApi::splitString(const std::string& str, const char* delimiters)
{
std::vector<std::string> tokens;
char stringForStrTok[str.length() + 1];
strcpy(stringForStrTok, str.c_str());
char* token = strtok(stringForStrTok, delimiters);
while (token != nullptr) {
tokens.emplace_back(token);
token = strtok(nullptr, delimiters);
}
return tokens;
}

void CcdbApi::initHostsPool(std::string hosts)
{
hostsPool = splitString(hosts, ",;");
hostsPool.clear();
auto splitted = hosts | std::views::transform([](char c) { return (c == ';') ? ',' : c; }) | std::views::split(',');
for (auto&& part : splitted) {
hostsPool.emplace_back(part.begin(), part.end());
}
}

std::string CcdbApi::getHostUrl(int hostIndex) const
Expand Down