NetDEM v1.0
Loading...
Searching...
No Matches
utils_io.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "utils_macros.hpp"
4#include <fstream>
5#include <iostream>
6#include <sstream>
7
8namespace netdem {
9
10class IO {
11public:
12 static void PrintInfo(std::string const &info);
13
14 static void PrintWarning(std::string const &info);
15
16 static void PrintError(std::string const &info);
17
18 static void PrintDebug(std::string const &info);
19
20 static std::string ToString(int value);
21
22 static std::string ToString(double value);
23
24 static VecXT<VecXT<double>> ImportData(std::string const &filename,
25 int lines_to_skip = 0);
26
27 static bool FileExist(std::string const &filename);
28
29 template <typename T> static void SwapEnd(T &var) {
30 char *varArray = reinterpret_cast<char *>(&var);
31 for (long i = 0; i < static_cast<long>(sizeof(var) / 2); i++)
32 std::swap(varArray[sizeof(var) - 1 - i], varArray[i]);
33 }
34};
35
36} // namespace netdem
Definition utils_io.hpp:10
static void PrintError(std::string const &info)
Definition utils_io.cpp:18
static std::string ToString(int value)
Definition utils_io.cpp:27
static void SwapEnd(T &var)
Definition utils_io.hpp:29
static bool FileExist(std::string const &filename)
Definition utils_io.cpp:95
static void PrintDebug(std::string const &info)
Definition utils_io.cpp:23
static void PrintWarning(std::string const &info)
Definition utils_io.cpp:14
static void PrintInfo(std::string const &info)
Definition utils_io.cpp:10
static VecXT< VecXT< double > > ImportData(std::string const &filename, int lines_to_skip=0)
Definition utils_io.cpp:39
Definition bond_entry.hpp:7
std::vector< T > VecXT
Definition utils_macros.hpp:31