Project
Loading...
Searching...
No Matches
StringUtils.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12/*
13 * File: StringUtils.h
14 * Author: John Lång (john.larry.lang@cern.ch)
15 *
16 * Created on 14 July 2015, 10:37
17 *
18 * This library contains miscellaneous functions used in this program for
19 * handling (C-style) strings.
20 */
21
22#ifndef O2_DCS_STRING_UTILS_H
23#define O2_DCS_STRING_UTILS_H
24
25#include <string>
26#include <vector>
27#include <list>
28#include <memory>
29
30namespace o2
31{
32namespace dcs
33{
42std::string random_string(const size_t length) noexcept;
43
54std::string random_string2(const size_t length) noexcept;
55
65uint64_t hash_code(const std::string& input) noexcept;
66
71std::unique_ptr<std::vector<std::string>> convert_strings(const int argc,
72 char** argv) noexcept;
73
80inline void to_upper_case(std::string& str) noexcept
81{
82 for (char& c : str) {
83 c = toupper(c);
84 }
85}
86
93inline void to_lower_case(std::string& str) noexcept
94{
95 for (char& c : str) {
96 c = tolower(c);
97 }
98}
99
107std::unique_ptr<std::vector<std::string>> split(const std::string& source,
108 const char separator) noexcept;
109
117std::unique_ptr<std::vector<std::string>> split_by_whitespace(
118 const std::string& source) noexcept;
119
129std::string to_hex_big_endian(const char* const start, size_t length) noexcept;
130
140std::string to_hex_little_endian(const char* const start, size_t length) noexcept;
141
151 const std::string& list_name,
152 const std::list<std::pair<std::string, std::string>>& parameters) noexcept;
153
154} // namespace dcs
155} // namespace o2
156
157#endif /* O2_DCS_STRING_UTILS_H */
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
uint32_t c
Definition RawData.h:2
GLsizei GLsizei GLchar * source
Definition glcorearb.h:798
GLuint GLsizei GLsizei * length
Definition glcorearb.h:790
std::string random_string2(const size_t length) noexcept
std::string to_hex_little_endian(const char *const start, size_t length) noexcept
std::unique_ptr< std::vector< std::string > > split(const std::string &source, const char separator) noexcept
uint64_t hash_code(const std::string &input) noexcept
std::unique_ptr< std::vector< std::string > > convert_strings(const int argc, char **argv) noexcept
std::string to_hex_big_endian(const char *const start, size_t length) noexcept
void to_upper_case(std::string &str) noexcept
Definition StringUtils.h:80
void print_k_v_list(const std::string &list_name, const std::list< std::pair< std::string, std::string > > &parameters) noexcept
void to_lower_case(std::string &str) noexcept
Definition StringUtils.h:93
std::string random_string(const size_t length) noexcept
std::unique_ptr< std::vector< std::string > > split_by_whitespace(const std::string &source) noexcept
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
const std::string str