Commit a330df2d authored by Anonymous's avatar Anonymous

Clang-tidy modification

parent 340d4ef2
......@@ -17,11 +17,11 @@
#include "VerticalEventBase.hh"
#include "functions.hh"
CDA* cda = NULL;
CDA* cda = nullptr;
void stopHandler(int){
if (cda != NULL)
if (cda != nullptr)
cda->stop = true;
}
......@@ -153,7 +153,7 @@ private:
try {
if (!ibm)
LineParser(fin, sequences, events, code_events, sequence_events);
else if (extension.compare(".csv") == 0)
else if (extension == ".csv")
CSVparser(fin, sequences, events, code_events, event_sequences, sequence_events);
else
TXTparser(fin, sequences, events, code_events, sequence_events);
......@@ -189,16 +189,16 @@ private:
if (!parse_file(gname, negatives, sequences2, event_sequences, sequence_events2)) return false;
}
for (unsigned int k = (unsigned) sequence_events.size(); k < code_events.size(); k++)
sequence_events.push_back(std::vector<std::vector<int>>(sequences.size(), std::vector<int>()));
for (auto k = (unsigned) sequence_events.size(); k < code_events.size(); k++)
sequence_events.emplace_back(sequences.size(), std::vector<int>());
abstractions = std::vector<int>(code_events.size(), -1);
Abstraction::generatePathways<Event>((int) events.size(), trace, sequence_events);
if (disc) {
Abstraction::generatePathways<Event>((int) events.size(), trace2, sequence_events2);
for (unsigned int k = (unsigned) trace.size(); k < trace2.size(); k++)
trace.push_back(std::vector<std::vector<Event>>(trace[0].size(), std::vector<Event>()));
for (auto k = (unsigned) trace.size(); k < trace2.size(); k++)
trace.emplace_back(trace[0].size(), std::vector<Event>());
}
nb_se = (unsigned) abstractions.size();
......@@ -242,7 +242,7 @@ private:
return false;
}
if (gname.compare("") != 0) {
if (!gname.empty()) {
negatives.open(gname);
if (!negatives) {
std::cerr << "Unable to open " << gname << "." << std::endl;
......@@ -265,7 +265,7 @@ private:
#ifdef HAVE_BOOST_FILESYSTEM
return boost::filesystem::path(p).stem().string();
#else
size_t start = p.find_last_of("/");
size_t start = p.find_last_of('/');
if(start == std::string::npos)
start = 0;
else
......@@ -279,11 +279,11 @@ private:
assert(p.max_total_count() == std::numeric_limits<unsigned>::max());
std::vector<std::string> parts;
const int MAX = 1000;
std::string last = p.name_for_position(MAX);
const std::string &last = p.name_for_position(MAX);
for(size_t i = 0; true; ++i)
{
std::string cur = p.name_for_position(i);
const std::string &cur = p.name_for_position(static_cast<unsigned int>(i));
if(cur == last)
{
parts.push_back(cur);
......@@ -329,9 +329,9 @@ private:
parts.push_back(p.name_for_position((int) i));
}
}
if(desc.options().size() > 0)
if(!desc.options().empty())
{
parts.push_back("[options]");
parts.emplace_back("[options]");
}
std::ostringstream oss;
oss << make_help_description(program_name) << std::endl;
......@@ -350,13 +350,13 @@ private:
std::string fname;
std::string gname;
bool ibm;
float fmin;
float fmin{};
public:
unsigned cwm;
unsigned minsup;
unsigned nb_se;
unsigned minsup{};
unsigned nb_se{};
unsigned mincs;
unsigned maxcs;
......@@ -380,7 +380,7 @@ public:
Options() : gname(""), ibm(false), cwm(0), mincs(0), maxcs(0), gmin(2),
calc_freq(true), close(false), episode(false), disc(false), dif(false), txt(true), verbose(false),
tid(false), b(NULL), b2(NULL) {}
tid(false), b(nullptr), b2(nullptr) {}
};
int main(const int argc, char* argv[])
......@@ -414,7 +414,7 @@ int main(const int argc, char* argv[])
bool disc_exec = true;
if (!options.disc)
res = algo.run(*options.b, base_pct, base_itv, NULL, options.minsup, (int) options.code_events.size(),
res = algo.run(*options.b, base_pct, base_itv, nullptr, options.minsup, (int) options.code_events.size(),
options.nb_se, options.verbose, options.cwm, options.mincs, options.maxcs,
options.close, options.dif, false, options.calc_freq);
else
......@@ -425,11 +425,11 @@ int main(const int argc, char* argv[])
delete options.b;
if (options.disc) delete options.b2;
else {
for (Chronicle c : res) {
for (const Chronicle &c : res) {
if (options.txt)
std::cout << c.txt(options.inv_events, NULL) << std::endl;
std::cout << c.txt(options.inv_events, nullptr) << std::endl;
else
std::cout << c.json(options.inv_events, NULL) << std::endl;
std::cout << c.json(options.inv_events, nullptr) << std::endl;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment