ATLAS Offline Software
utils.h
Go to the documentation of this file.
1 /* emacs: this is -*- c++ -*- */
21 #ifndef READCARDS_UTILS_H
22 #define READCARDS_UTILS_H
23 
24 #include <string>
25 #include <vector>
26 #include <iostream>
27 
28 
29 // get tokens off the front (chop) and back (chomp)
30 std::string chop(std::string& , const std::string& );
31 std::string chomp(std::string& , const std::string& );
32 
33 // chop token off of end of string, leave string unchaged, return the token
34 std::string choptoken(std::string& , const std::string& );
35 
36 // chop token off of end of string, leave string unchaged, return the token
37 std::string chomptoken(std::string& , const std::string& );
38 
39 
40 // removes whitespace
41 void removespace(std::string& s, const std::string& s2=" \t");
42 
43 // replaces whitespace
44 void replace(std::string& s, const std::string& s2=" \t", const std::string& s3="-");
45 void replace(std::string& s, char c1, char c2) noexcept;
46 
47 // chops s1 to the first not of s2
48 std::string chopfirst(std::string& s1, const std::string& s2="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.:/");
49 
50 // chops s1 from the the last not of s2
51 std::string choplast(std::string& s1, const std::string& s2="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_");
52 
53 // chops from both ends all of s2
54 std::string chopends(std::string& s1, const std::string& s2=" \t");
55 
56 // functions for manipulating filenames
57 std::string basename( std::string name );
58 std::string dirname( std::string name );
59 
60 // removes colons
61 void depunctuate(std::string& );
62 
63 // helper methods, calculate delta phi form two phi angles
64 double deltaPhi(double , double );
65 
66 // checks to see if a particular file can be opened
67 bool canopen(const std::string& );
68 
69 
70 // converts number into integer string ...
71 std::string number(const int& i, const std::string& s="%d");
72 std::string number(const double& d, const std::string& s="%lf");
73 
74 
75 
76 #endif /* READCARDS_UTILS_H */
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
chopfirst
std::string chopfirst(std::string &s1, const std::string &s2="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.:/")
Definition: hcg.cxx:257
hist_file_dump.d
d
Definition: hist_file_dump.py:137
extractSporadic.c1
c1
Definition: extractSporadic.py:134
deltaPhi
double deltaPhi(double, double)
Definition: utils.cxx:169
dirname
std::string dirname(std::string name)
Definition: utils.cxx:200
canopen
bool canopen(const std::string &)
Definition: utils.cxx:178
chopends
std::string chopends(std::string &s1, const std::string &s2=" \t")
Definition: hcg.cxx:287
chop
std::string chop(std::string &, const std::string &)
Definition: hcg.cxx:158
choptoken
std::string choptoken(std::string &, const std::string &)
Definition: hcg.cxx:230
number
std::string number(const int &i, const std::string &s="%d")
Definition: utils.cxx:192
basename
std::string basename(std::string name)
Definition: utils.cxx:207
choplast
std::string choplast(std::string &s1, const std::string &s2="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_")
Definition: hcg.cxx:273
lumiFormat.i
int i
Definition: lumiFormat.py:85
depunctuate
void depunctuate(std::string &)
Definition: utils.cxx:157
replace
void replace(std::string &s, const std::string &s2=" \t", const std::string &s3="-")
Definition: utils.cxx:142
removespace
void removespace(std::string &s, const std::string &s2=" \t")
Definition: hcg.cxx:297
ReadCellNoiseFromCoolCompare.s3
s3
Definition: ReadCellNoiseFromCoolCompare.py:380
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.DataFormatRates.c2
c2
Definition: DataFormatRates.py:123
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
chomp
std::string chomp(std::string &, const std::string &)
Definition: hcg.cxx:211
chomptoken
std::string chomptoken(std::string &, const std::string &)
Definition: hcg.cxx:244