Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

sword::System Class Reference

Portable access to some operating system-dependant operations. More...


Static Public Methods

void copy (void *dst, const void *src, size_t length) throw ()
 Block copy of memory from 'src' to 'dst' on 'length' bytes.

void move (void *dst, const void *src, size_t length) throw ()
 Block copy of memory from 'src' to 'dst' on 'length' bytes.

void zero (void *dst, size_t length) throw ()
 Sets the memory area starting at 'dst' on 'length' bytes to 0.

void fill (void *dst, size_t length, word8 value) throw ()
 Sets the memory area starting at 'dst' on 'length' bytes to 'value'.

int compare (const void *a, const void *b, size_t length) throw ()
 Compares two memory buffers using lexicographic order.

void sleep (int milliseconds)
 Pause the program without consuming CPU.

std::string uuid ()
 Generate a unique string id.

word64 memoryFootprint ()
 Obtain the memory footprint of this program in the operating system.

std::string errorMessage (int error)
 Returns a textual message for an operating-system error.

std::string hostName ()
 Obtain the hostname of this machine.

std::string userName ()
 Obtain the current user login name.

std::string applicationPath ()
 Obtain the path to where this application binary is.


Static Public Attributes

ACE_Thread_Mutex consoleMutex
 A global mutex to guard all access to the console (std::cout).


Detailed Description

Portable access to some operating system-dependant operations.


Member Function Documentation

std::string sword::System::applicationPath   [static]
 

Obtain the path to where this application binary is.

int sword::System::compare const void *    a,
const void *    b,
size_t    length
throw () [static]
 

Compares two memory buffers using lexicographic order.

Compares the buffers at 'a' and at 'b' on length 'length' and returns

  • <0 if 'a' is "lower" than 'b'
  • =0 if 'a' and 'b' are stricly the same
  • >0 if 'a' is "greater" than 'b'

void sword::System::copy void *    dst,
const void *    src,
size_t    length
throw () [static]
 

Block copy of memory from 'src' to 'dst' on 'length' bytes.

The memory areas must not overlap, otherwise the result is undefined. If you need overlapping buffers, use move. copy is, however, faster.

See also:
System::move

std::string sword::System::errorMessage int    error [static]
 

Returns a textual message for an operating-system error.

void sword::System::fill void *    dst,
size_t    length,
word8    value
throw () [static]
 

Sets the memory area starting at 'dst' on 'length' bytes to 'value'.

If you need to set memory to 'value=0', use the zero method whith is faster on some operating systems.

See also:
System::zero

std::string sword::System::hostName   [static]
 

Obtain the hostname of this machine.

word64 sword::System::memoryFootprint   [static]
 

Obtain the memory footprint of this program in the operating system.

This is not the exact amount of memory allocated by the program. It can be bigger if the malloc()/new() implementation decides to allocate more than required (handle pools). It can be smaller if part of the program code or data has been swapped out of memory.

void sword::System::move void *    dst,
const void *    src,
size_t    length
throw () [static]
 

Block copy of memory from 'src' to 'dst' on 'length' bytes.

The memory areas can overlap. If your buffers do not overlap, use copy, which is faster.

See also:
System::copy

void sword::System::sleep int    milliseconds [static]
 

Pause the program without consuming CPU.

Pause the program for 'milliseconds' milliseconds without consuming CPU cycles. The precision of the pause's length may vary depending on the actual operating system implementation.

std::string sword::System::userName   [static]
 

Obtain the current user login name.

std::string sword::System::uuid   [static]
 

Generate a unique string id.

void sword::System::zero void *    dst,
size_t    length
throw () [static]
 

Sets the memory area starting at 'dst' on 'length' bytes to 0.

Always use this method rather than fill with a '0' value, because on some operating systems it is faster.

See also:
System::fill


Field Documentation

ACE_Thread_Mutex sword::System::consoleMutex [static]
 

A global mutex to guard all access to the console (std::cout).


Generated on Tue Dec 23 20:08:57 2003 for SWORD by doxygen1.3-rc2