COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
devicedisk.h
Go to the documentation of this file.
1 #ifndef DEVICEDISK_H
2 #define DEVICEDISK_H
3 
4 #include "support/configCosmos.h"
5 #include "support/jsondef.h"
6 #include "support/datalib.h"
7 #include "support/stringlib.h"
8 
9 #include <cstdint> // uint64_t
10 #ifndef COSMOS_MAC_OS
11 #if defined (COSMOS_WIN_OS)
12 #include "windows.h"
13 #include <tchar.h>
14 #else
15 #include <stdlib.h>
16 #include <sys/statvfs.h>
17 #include <sys/types.h>
18 #include <sys/sysinfo.h>
19 #include <unistd.h>
20 #endif
21 #endif
22 
23 #if defined(COSMOS_MAC_OS)
24  #include <sys/disk.h>
25  #include <sys/ioctl.h>
26  #include <fcntl.h>
27 #endif
28 
29 
30 static const double GiB = 1024. * 1024. * 1024.;
31 
33 {
34 public:
35  uint64_t Size;
36  uint64_t Used;
37  uint64_t Free;
38  double SizeGiB;
39  double UsedGiB;
40  double FreeGiB;
41  double FreePercent;
42 
43  struct info
44  {
45  string mount;
46  uint64_t size;
47  uint64_t used;
48  uint64_t free;
49  };
50 
51  DeviceDisk();
52  vector <info> getInfo();
53  double getAll(string path);
54  uint64_t getSize(string path);
55  uint64_t getUsed(string path);
56  uint64_t getFree(string path);
57  double getAll();
58  uint64_t getSize();
59  uint64_t getUsed();
60  uint64_t getFree();
61 
62  double getFreeGiB(string path);
63  double getUsedGiB(string path);
64  double getSizeGiB(string path);
65  double getFreeGiB();
66  double getUsedGiB();
67  double getSizeGiB();
68 };
69 
70 #endif // DEVICEDISK_H
double getSizeGiB()
Definition: devicedisk.cpp:110
static const double GiB
Definition: devicedisk.h:30
uint64_t getUsed()
Definition: devicedisk.cpp:116
Data Management header file.
double getAll()
Definition: devicedisk.cpp:9
string mount
Definition: devicedisk.h:45
uint64_t used
Definition: devicedisk.h:47
double SizeGiB
Definition: devicedisk.h:38
double FreeGiB
Definition: devicedisk.h:40
Headers and definitions common to all COSMOS.
DeviceDisk()
Definition: devicedisk.cpp:3
double getFreeGiB()
Definition: devicedisk.cpp:173
uint64_t size
Definition: devicedisk.h:46
uint64_t Size
Definition: devicedisk.h:35
uint64_t Free
Definition: devicedisk.h:37
double FreePercent
Definition: devicedisk.h:41
Definition: devicedisk.h:32
stringlib include file A library providing functions for handling various types of string...
uint64_t getFree()
Definition: devicedisk.cpp:147
vector< info > getInfo()
Definition: devicedisk.cpp:179
uint64_t free
Definition: devicedisk.h:48
uint64_t getSize()
Definition: devicedisk.cpp:85
double getUsedGiB()
Definition: devicedisk.cpp:140
uint64_t Used
Definition: devicedisk.h:36
Definition: devicedisk.h:43
double UsedGiB
Definition: devicedisk.h:39