Skip to content

Commit 7f63810

Browse files
authored
cleanup (#156)
1 parent 4fb84c7 commit 7f63810

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

co_sim_io/impl/communication/file_communication.hpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ namespace Internals {
3131

3232
namespace { // helpers namespace
3333

34-
static double ElapsedSeconds(const std::chrono::steady_clock::time_point& rStartTime)
35-
{
36-
using namespace std::chrono;
37-
return duration_cast<duration<double>>(steady_clock::now() - rStartTime).count();
38-
}
39-
40-
static bool PathExists(const fs::path& rPath)
41-
{
42-
return fs::exists(rPath);
43-
}
44-
4534
template <typename T>
4635
static void CheckStream(const T& rStream, const fs::path& rPath)
4736
{
@@ -522,17 +511,17 @@ class FileCommunication : public Communication
522511
void WaitForPath(const fs::path& rPath) const
523512
{
524513
CO_SIM_IO_INFO_IF("CoSimIO", GetEchoLevel()>0) << "Waiting for: " << rPath << std::endl;
525-
while(!PathExists(rPath)) {
514+
while(!fs::exists(rPath)) {
526515
std::this_thread::sleep_for(std::chrono::milliseconds(5)); // wait 0.001s before next check
527516
}
528517
CO_SIM_IO_INFO_IF("CoSimIO", GetEchoLevel()>0) << "Found: " << rPath << std::endl;
529518
}
530519

531520
void WaitUntilFileIsRemoved(const fs::path& rPath) const
532521
{
533-
if (PathExists(rPath)) { // only issue the wating message if the file exists initially
522+
if (fs::exists(rPath)) { // only issue the wating message if the file exists initially
534523
CO_SIM_IO_INFO_IF("CoSimIO", GetEchoLevel()>0) << "Waiting for: " << rPath << " to be removed" << std::endl;
535-
while(PathExists(rPath)) {
524+
while(fs::exists(rPath)) {
536525
std::this_thread::sleep_for(std::chrono::milliseconds(5)); // wait 0.001s before next check
537526
}
538527
CO_SIM_IO_INFO_IF("CoSimIO", GetEchoLevel()>0) << rPath << " was removed" << std::endl;

co_sim_io/impl/utilities.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// System includes
1717
#include <string>
1818
#include <map>
19+
#include <chrono>
1920

2021
// Project includes
2122
#include "define.hpp"
@@ -53,6 +54,12 @@ inline void CheckEntry(const std::string& rEntry, const std::string& rKey)
5354
}
5455
}
5556

57+
inline double ElapsedSeconds(const std::chrono::steady_clock::time_point& rStartTime)
58+
{
59+
using namespace std::chrono;
60+
return duration_cast<duration<double>>(steady_clock::now() - rStartTime).count();
61+
}
62+
5663
inline int GetNumberOfNodesForElementType(ElementType Type)
5764
{
5865
const std::map<ElementType, int> type_num_nodes_map {

0 commit comments

Comments
 (0)