GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Static Public Member Functions | Static Protected Member Functions | List of all members
gdcm::System Class Reference

Class to do system operation. More...

`#include <gdcmSystem.h>`

## Static Public Member Functions

static bool | DeleteDirectory (const char *source)
| remove a directory named source
static size_t | EncodeBytes (char *out, const unsigned char *data, int size)
static bool | FileExists (const char *filename)
| Check whether the specified file exist on the sytem.
static bool | FileIsDirectory (const char *name)
| Check whether the file specified is a directory:
static bool | FileIsSymlink (const char *name)
| Check whether name is a symlink.
static size_t | FileSize (const char *filename)
static time_t | FileTime (const char *filename)
static bool | FormatDateTime (char date[22], time_t t, long milliseconds=0)
static bool | GetCurrentDateTime (char date[22])
static const char * | GetCurrentModuleFileName ()
static const char * | GetCurrentProcessFileName ()
static const char * | GetCurrentResourcesDirectory ()
static const char * | GetCWD ()
static bool | GetHostName (char hostname[255])
static const char * | GetLastSystemError ()
| Return the last error.
static const char * | GetLocaleCharset ()
| return `locale charmap`
static const char * | GetTimezoneOffsetFromUTC ()
static bool | MakeDirectory (const char *path)
| Create a directory name path.
static bool | ParseDateTime (time_t &timep, const char date[22])
| Parse a date stored as ASCII text into a time_t structured (discard millisecond if any)
static bool | ParseDateTime (time_t &timep, long &milliseconds, const char date[22])
static bool | RemoveFile (const char *source)
| remove a file named source
static int | StrCaseCmp (const char *s1, const char *s2)
| consistent func for C99 spec of strcasecmp/strncasecmp
static int | StrNCaseCmp (const char *s1, const char *s2, size_t n)
static char * | StrTokR (char *ptr, const char *sep, char **end)
| strtok_r

## Static Protected Member Functions

static bool | GetPermissions (const char *file, unsigned short &mode)
| NOT THREAD SAFE.
static bool | SetPermissions (const char *file, unsigned short mode)

## Detailed Description

Class to do system operation.

OS independent functionalities

## Member Function Documentation

static bool gdcm::System::DeleteDirectory | ( | const char * | source | ) |

static

remove a directory named source

static size_t gdcm::System::EncodeBytes | ( | char * | out,
|  | const unsigned char * | data,
|  | int | size
| ) |  |

static

Used internally by the UIDGenerator class to convert a uuid tape to a DICOM VR:UI type

static bool gdcm::System::FileExists | ( | const char * | filename | ) |

static

Check whether the specified file exist on the sytem.

Examples:
  EncapsulateFileInRawData.cxx, gdcmorthoplanes.cxx, and MagnifyFile.cxx.

static bool gdcm::System::FileIsDirectory | ( | const char * | name | ) |

static

Check whether the file specified is a directory:

Examples:
  gdcmorthoplanes.cxx, and threadgdcm.cxx.

static bool gdcm::System::FileIsSymlink | ( | const char * | name | ) |

static

Check whether name is a symlink.

static size_t gdcm::System::FileSize | ( | const char * | filename | ) |

static

Return the filesize. 0 if file does not exist.

Warning
  you need to use FileExists to differentiate between empty file and missing file.
  for very large size file and on system where size_t is not appropriate to store off_t value the function will return 0.

Examples:
  CheckBigEndianBug.cxx, CreateARGBImage.cxx, CreateCMYKImage.cxx, and EncapsulateFileInRawData.cxx.

static time_t gdcm::System::FileTime | ( | const char * | filename | ) |

static

Return the time of last modification of file 0 if the file does not exist

static bool gdcm::System::FormatDateTime | ( | char | date[22],
|  | time_t | t,
|  | long | milliseconds = `0`
| ) |  |

static

format as ASCII text a time_t with milliseconds See VR::DT from DICOM PS 3.5 milliseconds is in the range [0, 999999]

static bool gdcm::System::GetCurrentDateTime | ( | char | date[22] | ) |

static

Return the current data time, and format it as ASCII text. This is simply a call to gettimeofday + FormatDateTime, since WIN32 do not have an implementation for gettimeofday, this is more portable. The call time(0) is not precise for our resolution

static const char* gdcm::System::GetCurrentModuleFileName | ( |  | ) |

static

Return the directory the current module is located: NOT THREAD SAFE

static const char* gdcm::System::GetCurrentProcessFileName | ( |  | ) |

static

Return the directory the current process (executable) is located: NOT THREAD SAFE

static const char* gdcm::System::GetCurrentResourcesDirectory | ( |  | ) |

static

On some system (Apple) return the path to the current bundled 'Resources' directory NOT THREAD SAFE

static const char* gdcm::System::GetCWD | ( |  | ) |

static

Return current working directory Warning: if current working path is too long (>2048 bytes) the call will fail and call will return NULL NOT THREAD SAFE

static bool gdcm::System::GetHostName | ( | char | hostname[255] | ) |

static

Retrieve the hostname, only the first 255 byte are copyied. This may come handy to specify the Station Name

static const char* gdcm::System::GetLastSystemError | ( |  | ) |

static

Return the last error.

static const char* gdcm::System::GetLocaleCharset | ( |  | ) |

static

return `locale charmap`

static bool gdcm::System::GetPermissions | ( | const char * | file,
|  | unsigned short & | mode
| ) |  |

staticprotected

NOT THREAD SAFE.

static const char* gdcm::System::GetTimezoneOffsetFromUTC | ( |  | ) |

static

Return the value for Timezone Offset From UTC as string.

Warning
  not thread safe

static bool gdcm::System::MakeDirectory | ( | const char * | path | ) |

static

Create a directory name path.

static bool gdcm::System::ParseDateTime | ( | time_t & | timep,
|  | const char | date[22]
| ) |  |

static

Parse a date stored as ASCII text into a time_t structured (discard millisecond if any)

static bool gdcm::System::ParseDateTime | ( | time_t & | timep,
|  | long & | milliseconds,
|  | const char | date[22]
| ) |  |

static

Parse a date stored as ASCII text into a time_t structured and millisecond

See Also
  FormatDateTime

static bool gdcm::System::RemoveFile | ( | const char * | source | ) |

static

remove a file named source

static bool gdcm::System::SetPermissions | ( | const char * | file,
|  | unsigned short | mode
| ) |  |

staticprotected

static int gdcm::System::StrCaseCmp | ( | const char * | s1,
|  | const char * | s2
| ) |  |

static

consistent func for C99 spec of strcasecmp/strncasecmp

Referenced by gdcm::PrivateTag::operator<().

static int gdcm::System::StrNCaseCmp | ( | const char * | s1,
|  | const char * | s2,
|  | size_t | n
| ) |  |

static

Precondition
  n != 0

static char* gdcm::System::StrTokR | ( | char * | ptr,
|  | const char * | sep,
|  | char ** | end
| ) |  |

static

strtok_r

The documentation for this class was generated from the following file:

- gdcmSystem.h