Medial Code Documentation
Loading...
Searching...
No Matches
Utils.h
1//
2// Utils.h - general needed and reused usitilities
3//
4
5#ifndef __UTILS__H__
6#define __UTILS__H__
7
8#include <string>
9#include <vector>
10#include <algorithm>
11
12using namespace std;
13
14#define SQUARE(x) ((x)*(x))
15
16// files related (needed locally in order to make InfraMed independent of MedUtils
17
18bool file_exists_IM(const string &fname);
19unsigned long long get_file_size_IM(const string &fname);
20int add_path_to_name_IM(const string &path, string &fname);
21int add_path_to_name_IM(const string &path, vector<string> &fnames);
22int copy_file_IM(const string& in_file, const string& out_file) ;
23int copy_files_IM(const string &in_path, const string &out_path, vector<string>& fnames) ;
24int read_bin_file_IM(string &fname, unsigned char* &data, unsigned long long &size);
25int read_bin_file_IM_parallel(string &fname, unsigned char* &data, unsigned long long &size);
26int write_bin_file_IM(string &fname, unsigned char* data, unsigned long long size);
27
28// forced to keep a copy of these inside in order NOT to depend on external libraries
29// for now assuming an int is enough
30// All will be computed from 1/1/1900
31//int date_to_days_IM(int date);
32//int date_to_hours_IM(int date) { return 24*date_to_days_IM(date); };
33//int date_to_minutes_IM(int date) { return 24*60*date_to_days_IM(date); }
34
35#endif
Definition StdDeque.h:58