Skip to content

Commit d58dca7

Browse files
authored
Clang tidy everything else (#1826)
1 parent 4ff9436 commit d58dca7

File tree

140 files changed

+1810
-1776
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1810
-1776
lines changed

Conditions/include/Conditions/GeneralCSVLoader.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class GeneralCSVLoader {
2222
virtual ~GeneralCSVLoader() {}
2323

2424
/** Get the column names */
25-
std::vector<std::string> columnNames() const { return colNames_; }
25+
std::vector<std::string> columnNames() const { return col_names_; }
2626

2727
/** Advance to next row if possible */
2828
bool nextRow();
@@ -45,11 +45,11 @@ class GeneralCSVLoader {
4545
/**
4646
* The column names
4747
*/
48-
std::vector<std::string> colNames_;
48+
std::vector<std::string> col_names_;
4949
/**
5050
* The row data
5151
*/
52-
std::vector<std::string> rowData_;
52+
std::vector<std::string> row_data_;
5353
};
5454

5555
/** @brief Specialization of the GeneralCSVLoader for loading from a string
@@ -77,7 +77,7 @@ class StringCSVLoader : public GeneralCSVLoader {
7777
/**
7878
* The current start and end pointers
7979
*/
80-
std::string::size_type rowBegin_, rowEnd_;
80+
std::string::size_type row_begin_, row_end_;
8181
};
8282

8383
/** @brief Specialization of the GeneralCSVLoader for loading from a file/stream
@@ -115,7 +115,7 @@ class StreamCSVLoader : public GeneralCSVLoader {
115115
/**
116116
* Own stream?
117117
*/
118-
bool ownStream_;
118+
bool own_stream_;
119119
/**
120120
* Line buffer
121121
*/

Conditions/include/Conditions/SimpleCSVTableProvider.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ class SimpleCSVTableProvider : public framework::ConditionsObjectProvider {
7070
getCondition(const ldmx::EventHeader& context);
7171

7272
private:
73-
enum { OBJ_unknown, OBJ_int, OBJ_double } objectType_;
73+
enum { OBJ_unknown, OBJ_int, OBJ_double } object_type_;
7474
std::vector<std::string> columns_;
75-
std::string entriesURL_;
76-
std::string conditions_baseURL_;
75+
std::string entries_url_;
76+
std::string conditions_base_url_;
7777

7878
void entriesFromPython(std::vector<framework::config::Parameters>&);
7979
void entriesFromCSV();

Conditions/include/Conditions/SimpleTableCondition.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,29 @@ class BaseTableCondition : public framework::ConditionsObject {
2626
const std::vector<std::string>& columns)
2727
: framework::ConditionsObject{name},
2828
columns_{columns},
29-
idMask_{0xFFFFFFFFu} {
30-
columnCount_ = (unsigned int)(columns.size());
29+
id_mask_{0xFFFFFFFFu} {
30+
column_count_ = (unsigned int)(columns.size());
3131
}
3232

3333
/**
3434
* Get a the column number for the given column name
3535
*/
3636
unsigned int getColumnNumber(const std::string& colname) const {
37-
for (unsigned int i = 0; i < columnCount_; i++)
37+
for (unsigned int i = 0; i < column_count_; i++)
3838
if (colname == columns_[i]) return i;
39-
return columnCount_;
39+
return column_count_;
4040
}
4141

4242
/**
4343
* Get the number of columns
4444
*/
45-
unsigned int getColumnCount() const { return columnCount_; }
45+
unsigned int getColumnCount() const { return column_count_; }
4646

4747
/**
4848
* Get the name of the given column
4949
*/
5050
const std::string& getColumnName(unsigned int icol) const {
51-
if (icol >= columnCount_) {
51+
if (icol >= column_count_) {
5252
EXCEPTION_RAISE("ConditionsException",
5353
std::string("Column index out of range in ") + getName());
5454
}
@@ -80,13 +80,13 @@ class BaseTableCondition : public framework::ConditionsObject {
8080
* Set an AND mask to be applied to the id. Typically used to "flatten" a
8181
* table in some manner.
8282
*/
83-
void setIdMask(unsigned int mask) { idMask_ = mask; }
83+
void setIdMask(unsigned int mask) { id_mask_ = mask; }
8484

8585
/**
8686
* Get the AND mask to be applied to the id. Typically used to "flatten" a
8787
* table in some manner.
8888
*/
89-
unsigned int getIdMask() const { return idMask_; }
89+
unsigned int getIdMask() const { return id_mask_; }
9090

9191
/**
9292
* Streams a given row of this table
@@ -101,9 +101,9 @@ class BaseTableCondition : public framework::ConditionsObject {
101101
std::size_t findKeyInsert(unsigned int id) const;
102102

103103
std::vector<std::string> columns_;
104-
unsigned int columnCount_;
104+
unsigned int column_count_;
105105
std::vector<uint32_t> keys_;
106-
unsigned int idMask_;
106+
unsigned int id_mask_;
107107
};
108108

109109
template <class T>
@@ -125,12 +125,12 @@ class HomogenousTableCondition : public BaseTableCondition {
125125

126126
/** Add an entry to the table */
127127
void add(unsigned int id, const std::vector<T>& values) {
128-
if (values.size() != columnCount_) {
128+
if (values.size() != column_count_) {
129129
EXCEPTION_RAISE("ConditionsException",
130130
getName() + ": Attempted to insert a row with " +
131131
std::to_string(values.size()) +
132132
" columns into a table with " +
133-
std::to_string(columnCount_) + " columns");
133+
std::to_string(column_count_) + " columns");
134134
}
135135
std::size_t loc = findKey(id);
136136
if (loc != getRowCount()) {
@@ -143,7 +143,7 @@ class HomogenousTableCondition : public BaseTableCondition {
143143
// insert into the keys
144144
keys_.insert(keys_.begin() + loc, id);
145145
// insert into the values
146-
values_.insert(values_.begin() + loc * columnCount_, values.begin(),
146+
values_.insert(values_.begin() + loc * column_count_, values.begin(),
147147
values.end());
148148
}
149149

@@ -153,12 +153,12 @@ class HomogenousTableCondition : public BaseTableCondition {
153153
*/
154154
T get(unsigned int id, unsigned int col) const {
155155
std::size_t irow = findKey(id);
156-
if (col >= columnCount_ || irow == getRowCount()) { // raise exception
156+
if (col >= column_count_ || irow == getRowCount()) { // raise exception
157157
EXCEPTION_RAISE("ConditionsException",
158158
"No such column " + std::to_string(col) + " or id " +
159159
std::to_string(id));
160160
}
161-
return values_[irow * columnCount_ + col];
161+
return values_[irow * column_count_ + col];
162162
}
163163

164164
/**
@@ -170,8 +170,8 @@ class HomogenousTableCondition : public BaseTableCondition {
170170
EXCEPTION_RAISE("ConditionsException",
171171
"Row out of range: " + std::to_string(irow));
172172
}
173-
std::vector<T> rv(&(values_[irow * columnCount_]),
174-
&(values_[(irow + 1) * columnCount_]));
173+
std::vector<T> rv(&(values_[irow * column_count_]),
174+
&(values_[(irow + 1) * column_count_]));
175175
return std::pair<unsigned int, std::vector<T> >(keys_[irow], rv);
176176
}
177177

@@ -194,8 +194,8 @@ class HomogenousTableCondition : public BaseTableCondition {
194194
"Row out of range: " + std::to_string(irow));
195195
}
196196
s << keys_[irow];
197-
for (int i = 0; i < columnCount_; i++)
198-
s << ',' << values_[irow * columnCount_ + i];
197+
for (int i = 0; i < column_count_; i++)
198+
s << ',' << values_[irow * column_count_ + i];
199199
return s << std::endl;
200200
}
201201

Conditions/src/Conditions/BaseTableCondition.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ std::ostream& operator<<(std::ostream& s,
2121
namespace conditions {
2222

2323
std::size_t BaseTableCondition::findKey(unsigned int id) const {
24-
unsigned int effid = id & idMask_;
24+
unsigned int effid = id & id_mask_;
2525
std::vector<unsigned int>::const_iterator ptr =
2626
std::lower_bound(keys_.begin(), keys_.end(), effid);
2727
if (ptr == keys_.end() || *ptr != effid)
@@ -31,7 +31,7 @@ std::size_t BaseTableCondition::findKey(unsigned int id) const {
3131
}
3232

3333
std::size_t BaseTableCondition::findKeyInsert(unsigned int id) const {
34-
unsigned int effid = id & idMask_;
34+
unsigned int effid = id & id_mask_;
3535
std::vector<unsigned int>::const_iterator ptr =
3636
std::lower_bound(keys_.begin(), keys_.end(), effid);
3737
return std::distance(keys_.begin(), ptr);

Conditions/src/Conditions/GeneralCSVLoader.cxx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ namespace conditions {
1414
const std::string& GeneralCSVLoader::get(const std::string& colname,
1515
bool ignore_case) const {
1616
size_t i;
17-
for (i = 0; i < colNames_.size(); i++) {
18-
if (ignore_case && !strcasecmp(colNames_[i].c_str(), colname.c_str()))
17+
for (i = 0; i < col_names_.size(); i++) {
18+
if (ignore_case && !strcasecmp(col_names_[i].c_str(), colname.c_str()))
1919
break;
20-
if (colNames_[i] == colname) break;
20+
if (col_names_[i] == colname) break;
2121
}
22-
if (i == colNames_.size()) {
22+
if (i == col_names_.size()) {
2323
EXCEPTION_RAISE("CSVNoSuchColumn",
2424
"No such column '" + colname + "' reading CSV");
2525
}
26-
return rowData_[i];
26+
return row_data_[i];
2727
}
2828

2929
int GeneralCSVLoader::getInteger(const std::string& colname,
@@ -48,17 +48,17 @@ bool GeneralCSVLoader::nextRow() {
4848
for (auto chunk : tok) {
4949
line_split.push_back(chunk);
5050
}
51-
if (colNames_.empty()) {
52-
colNames_.swap(line_split);
51+
if (col_names_.empty()) {
52+
col_names_.swap(line_split);
5353
continue;
5454
}
55-
if (line_split.size() == colNames_.size()) {
56-
rowData_.swap(line_split);
55+
if (line_split.size() == col_names_.size()) {
56+
row_data_.swap(line_split);
5757
} else {
5858
EXCEPTION_RAISE("CSVLineMismatch",
5959
"Reading CSV found line with " +
6060
std::to_string(line_split.size()) + " in CSV with " +
61-
std::to_string(colNames_.size()) + " columns");
61+
std::to_string(col_names_.size()) + " columns");
6262
}
6363

6464
return true;
@@ -67,32 +67,32 @@ bool GeneralCSVLoader::nextRow() {
6767

6868
StringCSVLoader::StringCSVLoader(const std::string& source,
6969
const std::string lineseparators)
70-
: source_{source}, linesep_{lineseparators}, rowBegin_{0}, rowEnd_{0} {
70+
: source_{source}, linesep_{lineseparators}, row_begin_{0}, row_end_{0} {
7171
getNextLine();
7272
}
7373

7474
std::string StringCSVLoader::getNextLine() {
7575
std::string retval;
76-
if (rowBegin_ != rowEnd_) {
77-
if (rowEnd_ == std::string::npos) {
78-
retval = source_.substr(rowBegin_, rowEnd_);
76+
if (row_begin_ != row_end_) {
77+
if (row_end_ == std::string::npos) {
78+
retval = source_.substr(row_begin_, row_end_);
7979
} else {
80-
retval = source_.substr(rowBegin_, rowEnd_ - rowBegin_);
80+
retval = source_.substr(row_begin_, row_end_ - row_begin_);
8181
}
8282
}
8383
// now we look for the follow on.
8484
// find the first non-end-of-line character
85-
rowBegin_ = source_.find_first_not_of(linesep_, rowEnd_);
86-
if (rowBegin_ != std::string::npos) {
87-
rowEnd_ = source_.find_first_of(linesep_, rowBegin_);
85+
row_begin_ = source_.find_first_not_of(linesep_, row_end_);
86+
if (row_begin_ != std::string::npos) {
87+
row_end_ = source_.find_first_of(linesep_, row_begin_);
8888
} else {
89-
rowEnd_ = std::string::npos;
89+
row_end_ = std::string::npos;
9090
}
9191
return retval;
9292
}
9393

9494
StreamCSVLoader::StreamCSVLoader(const std::string& filename)
95-
: source_{0}, ownStream_{true} {
95+
: source_{0}, own_stream_{true} {
9696
std::string expanded_fname = filename;
9797
wordexp_t p;
9898

@@ -125,10 +125,10 @@ StreamCSVLoader::StreamCSVLoader(const std::string& filename)
125125
}
126126

127127
StreamCSVLoader::StreamCSVLoader(std::istream& stream)
128-
: source_{&stream}, ownStream_{false} {}
128+
: source_{&stream}, own_stream_{false} {}
129129

130130
StreamCSVLoader::~StreamCSVLoader() {
131-
if (ownStream_ && source_) delete source_;
131+
if (own_stream_ && source_) delete source_;
132132
source_ = 0;
133133
}
134134

0 commit comments

Comments
 (0)