GDCM 3.2.1

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 std::wstring | ConvertToUNC (const char *utf8path)
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 system.
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 * | StrSep (char **stringp, const char *delim)
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

Examples
  BasicAnonymizer.cs, BasicImageAnonymizer.cs, Cleaner.cs, ClinicalTrialIdentificationWorkflow.cs, CompressLossyJPEG.cs, DecompressImageMultiframe.cs, DecompressJPEGFile.cs, DumpCSA.cs, ExplicitLittleEndian.cs, ExtractEncapsulatedFile.cs, ExtractImageRegion.cs, ExtractImageRegionWithLUT.cs, ExtractOneFrame.cs, FileAnonymize.cs, FileChangeTS.cs, FileChangeTSLossy.cs, FileStreaming.cs, GetArray.cs, MetaImageMD5Activiz.cs, MpegVideoInfo.cs, ReformatFile.cs, RescaleImage.cs, ScanDirectory.cs, SimplePrint.cs, and StandardizeFiles.cs.

## Member Function Documentation

## ◆ ConvertToUNC()

std::wstring gdcm::System::ConvertToUNC | ( | const char * | utf8path | ) |
| static

When needed convert a PATH into a UNC equivalent. This allow transparent support for path longer that MAX_PATH. Only on _MSC_VER compiler, return empty string otherwise.

## ◆ DeleteDirectory()

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

remove a directory named source

## ◆ EncodeBytes()

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

## ◆ FileExists()

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

Check whether the specified file exist on the system.

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

## ◆ FileIsDirectory()

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

Check whether the file specified is a directory:

Examples
  DumpVisusChange.cxx, gdcmorthoplanes.cxx, and threadgdcm.cxx.

## ◆ FileIsSymlink()

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

Check whether name is a symlink.

## ◆ FileSize()

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, EncapsulateFileInRawData.cxx, and SimpleScanner.cxx.

## ◆ FileTime()

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

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

## ◆ FormatDateTime()

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]

## ◆ GetCurrentDateTime()

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

Examples
  TemplateEmptyImage.cxx.

## ◆ GetCurrentModuleFileName()

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

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

## ◆ GetCurrentProcessFileName()

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

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

## ◆ GetCurrentResourcesDirectory()

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

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

## ◆ GetCWD()

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

## ◆ GetHostName()

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

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

## ◆ GetLastSystemError()

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

Return the last error.

## ◆ GetLocaleCharset()

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

return locale charmap

## ◆ GetPermissions()

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

NOT THREAD SAFE.

## ◆ GetTimezoneOffsetFromUTC()

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

Return the value for Timezone Offset From UTC as string.

Warning
  not thread safe

## ◆ MakeDirectory()

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

Create a directory name path.

## ◆ ParseDateTime() [1/2]

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)

## ◆ ParseDateTime() [2/2]

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

## ◆ RemoveFile()

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

remove a file named source

## ◆ SetPermissions()

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

## ◆ StrCaseCmp()

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

consistent func for C99 spec of strcasecmp/strncasecmp

## ◆ StrNCaseCmp()

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

Precondition
  n != 0

## ◆ StrSep()

char * gdcm::System::StrSep | ( | char ** | stringp,
|  | const char * | delim )
| static

strsep param stringp is passed by pointer, it may be modified, you'll need to make a copy, in case you want to free the memory pointed at

## ◆ StrTokR()

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