Charles Kerr
Static Public Member Functions | |
static bool | getHost (std::string *optional_hostname, std::string *optional_address) |
Attempts to get the system's host name and address. | |
static int | getProgramSize () |
The memory currently being used by this program, in pages. | |
static unsigned long | getElapsedCPUTimeMSec () |
Returns the number of milliseconds of CPU time the process has used. | |
static unsigned long | getElapsedClockTimeSec () |
Returns the number of seconds this program has been running. | |
static std::string | getProcessName () |
Returns the process name. | |
static bool | isAbsolutePath (const std::string &path) |
Returns true if path is an absolute path. | |
static std::string | getBaseName (const std::string &filename) |
Analogous to unix-style basename. | |
static std::string | getDirName (const std::string &filename) |
Analogous to unix-style dirname. | |
static unsigned int | testFile (const std::string &filename, unsigned int test_flags) |
Test a file for the properties specified in test_flags. | |
static std::string | getCurrentDir () |
Returns the current working directory. | |
static bool | mkdirp (const std::string &path) |
Create all the directories necessary for the given path. | |
static bool | rmtree (const std::string &path) |
removes a file or subdirectory and any children. | |
static std::string | buildFilename (const char *first_element,...) |
Creates a filename from a series of elements using the correct separator for filenames. | |
static std::string | getUniqueTemporaryFile (const std::string base="wdssii") |
Return a unique temporary name. | |
static std::string | getUniqueTemporaryDir (const std::string base="wdssii") |
Equivalent to getUniqueTemporaryFile() + mkdirp(). | |
static const std::string & | getTempDir () |
Returns the temporary directory to be used by wdssii. | |
static unsigned int | sleepSec (unsigned int seconds) |
Tries to sleep for the specified number of seconds. | |
static void | sleepMsec (unsigned long milliseconds) |
Sleep for the specified number of milliseconds. | |
static int | getppid () |
Equivalent to getppid() on Unix. | |
Static Public Attributes | |
static const char | DIR_SEPARATOR |
static const char *const | DIR_SEPARATOR_STR |
static const unsigned int | FILE_IS_REGULAR |
Test flags that can be passed to testFile(). | |
static const unsigned int | FILE_IS_SYMLINK |
static const unsigned int | FILE_IS_DIRECTORY |
static const unsigned int | FILE_IS_EXECUTABLE |
static const unsigned int | FILE_EXIST |
static std::string code::OS::buildFilename | ( | const char * | first_element, | |
... | ||||
) | [static] |
Creates a filename from a series of elements using the correct separator for filenames.
On Windows, it takes into account that either the backslash (\) or slash (/) can be used as a separator in filenames, but otherwise behaves as on Unix. When file pathname separators need to be inserted, the last one that previously occurred in the parameters (reading from left to right) is used.
static std::string code::OS::getBaseName | ( | const std::string & | filename | ) | [static] |
Analogous to unix-style basename.
We offer our own version for cross-platform support.
static std::string code::OS::getCurrentDir | ( | ) | [static] |
Returns the current working directory.
static std::string code::OS::getDirName | ( | const std::string & | filename | ) | [static] |
Analogous to unix-style dirname.
We offer our own version for cross-platform support.
static unsigned long code::OS::getElapsedClockTimeSec | ( | ) | [static] |
Returns the number of seconds this program has been running.
static unsigned long code::OS::getElapsedCPUTimeMSec | ( | ) | [static] |
Returns the number of milliseconds of CPU time the process has used.
static bool code::OS::getHost | ( | std::string * | optional_hostname, | |
std::string * | optional_address | |||
) | [static] |
Attempts to get the system's host name and address.
the equivalent of gethostname() is used to populate `optional_hostname'.
the equivalent of using the first address of gethostbyname() is used to populate `optional_address'
static int code::OS::getppid | ( | ) | [static] |
static std::string code::OS::getProcessName | ( | ) | [static] |
Returns the process name.
static int code::OS::getProgramSize | ( | ) | [static] |
The memory currently being used by this program, in pages.
static const std::string& code::OS::getTempDir | ( | ) | [static] |
Returns the temporary directory to be used by wdssii.
If set, the TMPDIR environmental variable is used. The fallback is "/tmp" on Unix and "c:\WINDOWS\Temp" on Windows.
static std::string code::OS::getUniqueTemporaryDir | ( | const std::string | base = "wdssii" |
) | [inline, static] |
Equivalent to getUniqueTemporaryFile() + mkdirp().
static std::string code::OS::getUniqueTemporaryFile | ( | const std::string | base = "wdssii" |
) | [static] |
Return a unique temporary name.
No one else will have this name while this executable is running. If you want to use it as a directory, use getUniqueTemporaryDir().
the 'base' string will be the lead part of the basename, and some qualifier will be added to it to ensure uniqueness; ie /tmp/base.some-unique-qualifier
static bool code::OS::isAbsolutePath | ( | const std::string & | path | ) | [static] |
Returns true if path is an absolute path.
static bool code::OS::mkdirp | ( | const std::string & | path | ) | [static] |
Create all the directories necessary for the given path.
Doesn't exist on all Unixes. One workaround, system("mkdir -p dirname"), doesn't work on Windows.
static bool code::OS::rmtree | ( | const std::string & | path | ) | [static] |
removes a file or subdirectory and any children.
static void code::OS::sleepMsec | ( | unsigned long | milliseconds | ) | [static] |
Sleep for the specified number of milliseconds.
static unsigned int code::OS::sleepSec | ( | unsigned int | seconds | ) | [static] |
Tries to sleep for the specified number of seconds.
Equivalent to sleep(unsigned int) on Unix.
static unsigned int code::OS::testFile | ( | const std::string & | filename, | |
unsigned int | test_flags | |||
) | [static] |
Test a file for the properties specified in test_flags.
test_flags can be a bitwise-or'ed set of FILE_IS_REGULAR, FILE_IS_SYMLINK, FILE_IS_DIRECTORY, FILE_IS_EXECUTABLE, and FILE_EXIST.
const char code::OS::DIR_SEPARATOR [static] |
const char* const code::OS::DIR_SEPARATOR_STR [static] |
const unsigned int code::OS::FILE_EXIST [static] |
const unsigned int code::OS::FILE_IS_DIRECTORY [static] |
const unsigned int code::OS::FILE_IS_EXECUTABLE [static] |
const unsigned int code::OS::FILE_IS_REGULAR [static] |
Test flags that can be passed to testFile().
const unsigned int code::OS::FILE_IS_SYMLINK [static] |