Skip to content

Commit

Permalink
Adjust source code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosbento committed Dec 1, 2023
1 parent 3c82376 commit bc8ae43
Show file tree
Hide file tree
Showing 192 changed files with 992 additions and 992 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PointerAlignment: Left

# Align things as much as possible.
AlignOperands: true
AlignConsecutiveAssignments: AcrossEmptyLines
AlignConsecutiveAssignments: Consecutive
AlignEscapedNewlines: Left
AlignTrailingComments: true

Expand Down
12 changes: 6 additions & 6 deletions ACore/src/ecflow/core/Calendar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ void Calendar::assign(const Calendar& rhs) {
lastTime_ = rhs.lastTime_;
increment_ = rhs.increment_;

day_of_week_ = rhs.day_of_week_; // Cache
day_of_year_ = rhs.day_of_year_; // Cache
day_of_month_ = rhs.day_of_month_; // Cache
month_ = rhs.month_; // Cache
year_ = rhs.year_; // Cache
day_of_week_ = rhs.day_of_week_; // Cache
day_of_year_ = rhs.day_of_year_; // Cache
day_of_month_ = rhs.day_of_month_; // Cache
month_ = rhs.month_; // Cache
year_ = rhs.year_; // Cache
}

void Calendar::init(Clock_t clock) {
Expand Down Expand Up @@ -206,7 +206,7 @@ void Calendar::update(const ecf::CalendarUpdateParams& calUpdateParams) {

time_duration td = suiteTime_.time_of_day();

suiteTime_ = ptime(initTime_.date(), td);
suiteTime_ = ptime(initTime_.date(), td);

#ifdef DEBUG_CALENDAR
cout << "suiteTime_ = " << to_simple_string(suiteTime_) << "\n";
Expand Down
2 changes: 1 addition & 1 deletion ACore/src/ecflow/core/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ std::string File::root_build_dir() {
std::string stem = current_path.stem().string();
int count = 0;
while (stem.find("ecflow") == std::string::npos) {
current_path = current_path.parent_path();
current_path = current_path.parent_path();

the_current_path = current_path.string(); // cos current_path.string() is returned by reference

Expand Down
2 changes: 1 addition & 1 deletion ACore/src/ecflow/core/Str.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void Str::split_using_string_view(std::string_view strv, std::vector<std::string
}

void Str::split_using_string_view2(std::string_view strv, std::vector<std::string>& output, std::string_view delims) {
size_t first = 0;
size_t first = 0;

size_t strv_size = strv.size();
while (first < strv_size) {
Expand Down
2 changes: 1 addition & 1 deletion ACore/src/ecflow/core/WhiteListFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ using namespace ecf;
using namespace std;
using namespace boost;

WhiteListFile::WhiteListFile() = default;
WhiteListFile::WhiteListFile() = default;

WhiteListFile::~WhiteListFile() = default;

Expand Down
10 changes: 5 additions & 5 deletions ACore/test/TestCalendar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(test_calendar_time_series_relative_complex) {
calendar.update(minutes(1));
timeSeries.calendarChanged(calendar);

tm suiteTm = to_tm(calendar.suiteTime());
tm suiteTm = to_tm(calendar.suiteTime());

bool matches = timeSeries.isFree(calendar);

Expand Down Expand Up @@ -308,7 +308,7 @@ BOOST_AUTO_TEST_CASE(test_calendar_time_series_real_complex) {
// Update calendar every minute, then see we can match time series, *RELATIVE* to suite start
calendar.update(minutes(1));

tm suiteTm = to_tm(calendar.suiteTime());
tm suiteTm = to_tm(calendar.suiteTime());

bool matches = timeSeries.isFree(calendar);

Expand Down Expand Up @@ -532,9 +532,9 @@ BOOST_AUTO_TEST_CASE(test_calendar_julian) {
boost::gregorian::date cal_date = calendar.date();
long boost_julian = cal_date.julian_day();

std::string iso_string = to_iso_string(cal_date);
auto date_as_long = ecf::convert_to<long>(iso_string);
long ecmwf_julian = Cal::date_to_julian(date_as_long);
std::string iso_string = to_iso_string(cal_date);
auto date_as_long = ecf::convert_to<long>(iso_string);
long ecmwf_julian = Cal::date_to_julian(date_as_long);

BOOST_CHECK_MESSAGE(boost_julian == ecmwf_julian,
"boost julian " << boost_julian << " != ecmwf julian " << ecmwf_julian << " for "
Expand Down
18 changes: 9 additions & 9 deletions ACore/test/TestFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(test_splitFileIntoLines) {
// This is sanity test for splitFileIntoLines used extensively
cout << "ACore:: ...test_splitFileIntoLines\n";

std::string path = File::test_data("ACore/test/data/test_splitFileIntoLines.txt", "ACore");
std::string path = File::test_data("ACore/test/data/test_splitFileIntoLines.txt", "ACore");

std::string theText = "This is a test string";
{
Expand Down Expand Up @@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE(test_splitFileIntoLines) {
BOOST_AUTO_TEST_CASE(test_file_tokenizer) {
cout << "ACore:: ...test_file_tokenizer\n";

std::string path = File::test_data("ACore/test/data/test_file_tokenizer.txt", "ACore");
std::string path = File::test_data("ACore/test/data/test_file_tokenizer.txt", "ACore");

size_t linesWithText = 100;
std::string theText = "This is a test string";
Expand Down Expand Up @@ -181,8 +181,8 @@ BOOST_AUTO_TEST_CASE(test_file_backwardSearch) {
std::string rootPath = File::test_data("ACore/test/data", "ACore");
std::string expected = File::test_data("ACore/test/data/", "ACore") + nodePath;

std::string path = rootPath;
std::string dir = "dir";
std::string path = rootPath;
std::string dir = "dir";
for (int i = 0; i < 6; i++) {
path += "/" + dir + ecf::convert_to<std::string>(i);
}
Expand Down Expand Up @@ -253,8 +253,8 @@ BOOST_AUTO_TEST_CASE(test_file_forwardSearch) {
std::string rootPath = File::test_data("ACore/test/data", "ACore");
std::string expected = File::test_data("ACore/test/data", "ACore") + nodePath;

std::string path = rootPath;
std::string dir = "dir";
std::string path = rootPath;
std::string dir = "dir";
for (int i = 0; i < 6; i++) {
if (i == 5)
path += "/task";
Expand Down Expand Up @@ -335,9 +335,9 @@ BOOST_AUTO_TEST_CASE(test_create_missing_directories) {
}
cout << "\n";

std::string nodePath = "dir0/dir1/dir2/dir3/dir4/dir5";
std::string rootPath = File::test_data("ACore/test/data", "ACore");
std::string expected = File::test_data("ACore/test/data/", "ACore") + nodePath;
std::string nodePath = "dir0/dir1/dir2/dir3/dir4/dir5";
std::string rootPath = File::test_data("ACore/test/data", "ACore");
std::string expected = File::test_data("ACore/test/data/", "ACore") + nodePath;

std::string dir_remove = rootPath + "/dir0";
{
Expand Down
6 changes: 3 additions & 3 deletions ACore/test/TestRealCalendar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(test_REAL_calendar_time_series_relative_complex) {

timeSeries.calendarChanged(calendar);

tm suiteTm = to_tm(calendar.suiteTime());
tm suiteTm = to_tm(calendar.suiteTime());

bool matches = timeSeries.isFree(calendar);

Expand Down Expand Up @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(test_REAL_calendar_time_series_complex) {
time_now += minutes(1);
calendar.update(time_now);

tm suiteTm = to_tm(calendar.suiteTime());
tm suiteTm = to_tm(calendar.suiteTime());

bool matches = timeSeries.isFree(calendar);

Expand Down Expand Up @@ -318,7 +318,7 @@ BOOST_AUTO_TEST_CASE(test_REAL_day_changed_for_hybrid) {
BOOST_CHECK_MESSAGE(calendar.hybrid(), "calendar type should be real");

// HYBRID calendars allow for day change but not date.
std::string expected_date = to_simple_string(calendar.date());
std::string expected_date = to_simple_string(calendar.date());

boost::posix_time::ptime time_now = Calendar::second_clock_time();

Expand Down
16 changes: 8 additions & 8 deletions ACore/test/TestStringSplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,14 @@ static void test_get_token(const std::string& line, const char* delims = " \t")
BOOST_AUTO_TEST_CASE(test_StringSplitter_get_token) {
cout << "ACore:: ...test_StringSplitter_get_token \n";

std::vector<std::string> test_data = {"This is a string",
"a",
" a",
"a ",
" a ",
" a b c d ",
" - ! $ % ^ & * ( ) - + ? ",
"\n"};
std::vector<std::string> test_data = {"This is a string",
"a",
" a",
"a ",
" a ",
" a b c d ",
" - ! $ % ^ & * ( ) - + ? ",
"\n"};

std::vector<std::string> test_data1 = {
"/a",
Expand Down
4 changes: 2 additions & 2 deletions ANattr/src/ecflow/attribute/ClockAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ ClockAttr::ClockAttr(const boost::posix_time::ptime& time, bool hybrid, bool pos
month_ = theDate.month();
year_ = theDate.year();

tm t = to_tm(time);
gain_ = t.tm_hour * 3600 + t.tm_min * 60 + t.tm_sec;
tm t = to_tm(time);
gain_ = t.tm_hour * 3600 + t.tm_min * 60 + t.tm_sec;
}

ClockAttr::ClockAttr(int day, int month, int year, bool hybrid)
Expand Down
4 changes: 2 additions & 2 deletions ANattr/src/ecflow/attribute/RepeatAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ std::string RepeatDate::value_as_string(int index) const {
}

std::string RepeatDate::next_value_as_string() const {
long val = last_valid_value();
long val = last_valid_value();

long julian = Cal::date_to_julian(val);
julian += delta_;
Expand All @@ -396,7 +396,7 @@ std::string RepeatDate::next_value_as_string() const {
}

std::string RepeatDate::prev_value_as_string() const {
long val = last_valid_value();
long val = last_valid_value();

long julian = Cal::date_to_julian(val);
julian -= delta_;
Expand Down
30 changes: 15 additions & 15 deletions ANattr/src/ecflow/attribute/Zombie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,17 @@ void Zombie::pretty_print(const std::vector<Zombie>& zombies, std::vector<std::s
string host("host");
string explanation("explanation");

size_t path_width = path.size();
size_t type_width = type.size();
size_t duration_width = duration.size();
size_t password_width = password.size();
size_t tryno_width = try_no.size();
size_t rid_width = rid.size();
size_t user_action_width = user_action.size(); // max of FOB,FAIL,ADOPT,BLOCK,REMOVE + (manual- | auto- )
size_t child_type_width = child_type.size();
size_t calls_width = calls.size();
size_t host_width = host.size();
size_t explanation_width = explanation.size();
size_t path_width = path.size();
size_t type_width = type.size();
size_t duration_width = duration.size();
size_t password_width = password.size();
size_t tryno_width = try_no.size();
size_t rid_width = rid.size();
size_t user_action_width = user_action.size(); // max of FOB,FAIL,ADOPT,BLOCK,REMOVE + (manual- | auto- )
size_t child_type_width = child_type.size();
size_t calls_width = calls.size();
size_t host_width = host.size();
size_t explanation_width = explanation.size();

std::string ecf_pid_expl = "PID miss-match, password matches. Job scheduled twice. Check submitter";
std::string ecf_pid_passwd_expl = "Both PID and password miss-match. Re-queue & submit of active job?";
Expand All @@ -278,10 +278,10 @@ void Zombie::pretty_print(const std::vector<Zombie>& zombies, std::vector<std::s
calls_width = std::max(calls_width, no_of_calls.size());
host_width = std::max(host_width, z.host().size());

std::string try_no_int = ecf::convert_to<std::string>(z.try_no());
tryno_width = std::max(tryno_width, try_no_int.size());
child_type_width = std::max(child_type_width, Child::to_string(z.last_child_cmd()).size());
user_action_width = std::max(user_action_width, z.user_action_str().size());
std::string try_no_int = ecf::convert_to<std::string>(z.try_no());
tryno_width = std::max(tryno_width, try_no_int.size());
child_type_width = std::max(child_type_width, Child::to_string(z.last_child_cmd()).size());
user_action_width = std::max(user_action_width, z.user_action_str().size());

switch (z.type()) {
case Child::USER:
Expand Down
6 changes: 3 additions & 3 deletions ANode/src/ecflow/node/AbstractObserver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class Defs;

class AbstractObserver {
public:
virtual ~AbstractObserver() = default;
virtual ~AbstractObserver() = default;

virtual void update_start(const Node*, const std::vector<ecf::Aspect::Type>&) = 0;
virtual void update_start(const Defs*, const std::vector<ecf::Aspect::Type>&) = 0;

virtual void update(const Node*, const std::vector<ecf::Aspect::Type>&) = 0;
virtual void update(const Defs*, const std::vector<ecf::Aspect::Type>&) = 0;
virtual void update(const Node*, const std::vector<ecf::Aspect::Type>&) = 0;
virtual void update(const Defs*, const std::vector<ecf::Aspect::Type>&) = 0;

/// After this call, the node will be deleted, hence observers must *NOT* use the pointers
virtual void update_delete(const Node*) {}
Expand Down
6 changes: 3 additions & 3 deletions ANode/src/ecflow/node/ClientSuites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ defs_ptr ClientSuites::create_defs(defs_ptr server_defs) const {
unsigned int suite_state_change_no = suite->state_change_no();
unsigned int suite_modify_change_no = suite->modify_change_no();

the_max_state_change_no = std::max(the_max_state_change_no, suite_state_change_no);
the_max_modify_change_no = std::max(the_max_modify_change_no, suite_modify_change_no);
the_max_state_change_no = std::max(the_max_state_change_no, suite_state_change_no);
the_max_modify_change_no = std::max(the_max_modify_change_no, suite_modify_change_no);

// To avoid copying the suites, we will just add the suites, to the newly created defs
// However this presents a problem with the suites defs pointer. To avoid corrupting
Expand Down Expand Up @@ -270,7 +270,7 @@ void ClientSuites::update_suite_order() {
const std::vector<suite_ptr>& server_suite_vec = defs_->suiteVec();
size_t server_suite_vec_size = server_suite_vec.size();

auto suites_end = suites_.end();
auto suites_end = suites_.end();
for (auto i = suites_.begin(); i != suites_end; ++i) {
for (size_t s = 0; s < server_suite_vec_size; s++) {
if ((*i).name_ == server_suite_vec[s]->name()) {
Expand Down
12 changes: 6 additions & 6 deletions ANode/src/ecflow/node/Defs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ node_ptr Defs::replaceChild(const std::string& path,
}

// Take a note of begun status, in case the suite is being replaced.
bool begin_node = server_parent->suite()->begun();
bool begin_node = server_parent->suite()->begun();

node_ptr client_node_to_add = last_client_child->remove();
bool addOk = server_parent->addChild(client_node_to_add, client_child_pos);
Expand Down Expand Up @@ -2113,11 +2113,11 @@ std::string Defs::stats() const {
alias += task->aliases().size();

NodeStats stats;
stats.suites_ = suiteVec_.size();
stats.family_ = family_vec.size();
stats.task_ = task_vec.size();
stats.alias_ = alias;
stats.nodes_ = node_vec.size();
stats.suites_ = suiteVec_.size();
stats.family_ = family_vec.size();
stats.task_ = task_vec.size();
stats.alias_ = alias;
stats.nodes_ = node_vec.size();

stats.edit_history_nodes_ = edit_history_.size();
for (const auto& i : edit_history_) {
Expand Down
4 changes: 2 additions & 2 deletions ANode/src/ecflow/node/DefsDelta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ using namespace std;

/// Defs delta can be re-used. reset all data members
void DefsDelta::init(unsigned int client_state_change_no, bool sync_suite_clock) {
sync_suite_clock_ = sync_suite_clock;
client_state_change_no_ = client_state_change_no;
sync_suite_clock_ = sync_suite_clock;
client_state_change_no_ = client_state_change_no;

server_state_change_no_ = 0;
server_modify_change_no_ = 0;
Expand Down
4 changes: 2 additions & 2 deletions ANode/src/ecflow/node/EcfFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ bool EcfFile::get_used_variables(NameValueMap& used_variables, std::string& erro
// get the cached ECF_MICRO variable, typically its one char.
string ecfMicro = ecfMicroCache_;

char microChar = ecfMicro[0];
char microChar = ecfMicro[0];

// We need a stack to properly implement nopp. This is required since we need to pair
// the %end, with nopp. i.e need to handle
Expand Down Expand Up @@ -1186,7 +1186,7 @@ bool EcfFile::extractManual(const std::vector<std::string>& lines,
// get the cached ECF_MICRO variable, typically its one char.
string ecfMicro = ecfMicroCache_;

bool add = false;
bool add = false;
for (const auto& line : lines) {
if (line.find(ecfMicro) == 0) {
if (line.find(T_MANUAL) == 1) {
Expand Down
Loading

0 comments on commit bc8ae43

Please sign in to comment.