System Class Reference

#include <system.h>

List of all members.

Static Public Member Functions

static void vdebugPrint (const char *format, va_list args)
static void debugPrint (const char *format,...)
static const char * strptime (const char *buf, const char *format, tm *tm)
static long getLastOSErrorCode ()
static void displayErrorMessage (const char *title, const char *message)
static unsigned long getOSTimeSeconds ()
static void yieldThread ()
static void sleep (unsigned long milliseconds)
static void atomicIncrement (volatile unsigned long &v, CriticalSection *varCS=systemCS)
static void atomicDecrement (volatile unsigned long &v, CriticalSection *varCS=systemCS)
static int initializeSockets ()
static void cleanupSockets ()
static int closeSocket (SOCKET s)
static SOCKET accept (SOCKET s, struct sockaddr *addr, int *addrlen)
static CriticalSectioncreateCriticalSection ()
static LIFOCriticalSectioncreateLIFOCriticalSection ()
static LIFOSemaphorecreateLIFOSemaphore (unsigned long initCount=0L)

Private Member Functions

 System ()

Static Private Attributes

static CriticalSectionsystemCS = createCriticalSection()


Detailed Description

Definition at line 44 of file system.h.


Constructor & Destructor Documentation

System::System (  )  [inline, private]

Definition at line 46 of file system.h.

00046 {} // static object - no construction


Member Function Documentation

void System::vdebugPrint ( const char *  format,
va_list  args 
) [static]

Definition at line 108 of file system.cpp.

Referenced by debugPrint().

00109     {
00110         char buffer[1024];
00111         _vsnprintf( buffer, sizeof(buffer)-4, format, args );
00112         buffer[sizeof(buffer)-2] = '\0';
00113         strcat(buffer, "\n");
00114         OutputDebugString((LPCTSTR)buffer);
00115     }

void System::debugPrint ( const char *  format,
  ... 
) [static]

Definition at line 117 of file system.cpp.

References vdebugPrint().

00118     {
00119         if(format)
00120         {
00121                 va_list args;
00122                 va_start(args, format);
00123             vdebugPrint(format, args);
00124             va_end(args);
00125         }
00126         else
00127         {
00128             assert(format);
00129         }
00130     }

static const char* System::strptime ( const char *  buf,
const char *  format,
tm *  tm 
) [static]

long System::getLastOSErrorCode ( void   )  [static]

Definition at line 137 of file system.cpp.

00138     {
00139             return(GetLastError());
00140     }

void System::displayErrorMessage ( const char *  title,
const char *  message 
) [static]

Definition at line 157 of file system.cpp.

00158     {
00159             MessageBox( NULL, 
00160                                     message,
00161                                     title,
00162                                     MB_OK |
00163                                     MB_SETFOREGROUND |
00164                                     //MB_DEFAULT_DESKTOP_ONLY or MB_SERVICE_NOTIFICATION
00165                                     MB_ICONERROR );
00166     }

unsigned long System::getOSTimeSeconds ( void   )  [static]

Definition at line 142 of file system.cpp.

00143     {
00144             return(time(NULL));
00145     }

void System::yieldThread (  )  [static]

Definition at line 147 of file system.cpp.

00148     {
00149             Sleep(0);
00150     }

void System::sleep ( unsigned long  milliseconds  )  [static]

Definition at line 152 of file system.cpp.

00153     {
00154             Sleep(sleepTimeMillisec);
00155     }

void System::atomicIncrement ( volatile unsigned long &  v,
CriticalSection varCS = systemCS 
) [static]

Definition at line 184 of file system.cpp.

00185     {
00186             InterlockedIncrement( (long *)&v );
00187     }

void System::atomicDecrement ( volatile unsigned long &  v,
CriticalSection varCS = systemCS 
) [static]

Definition at line 189 of file system.cpp.

00190     {
00191             InterlockedDecrement( (long *)&v );
00192     }

int System::initializeSockets (  )  [static]

Definition at line 168 of file system.cpp.

00169     {
00170             WSADATA wsdat;
00171             return( WSAStartup( MAKEWORD( 1, 0 ), &wsdat ) );
00172     }

void System::cleanupSockets (  )  [static]

Definition at line 174 of file system.cpp.

00175     {
00176             WSACleanup();
00177     }

int System::closeSocket ( SOCKET  s  )  [static]

Definition at line 179 of file system.cpp.

00180     {
00181             return( closesocket(s) );
00182     }

SOCKET System::accept ( SOCKET  s,
struct sockaddr *  addr,
int *  addrlen 
) [static]

Definition at line 132 of file system.cpp.

00133     {
00134             return( ::accept( s, addr, addrlen ) );
00135     }

static CriticalSection* System::createCriticalSection (  )  [inline, static]

Definition at line 71 of file system.h.

00072         { return new CriticalSection(); }

static LIFOCriticalSection* System::createLIFOCriticalSection (  )  [inline, static]

Definition at line 74 of file system.h.

00075         { return new LIFOCriticalSection(); }

static LIFOSemaphore* System::createLIFOSemaphore ( unsigned long  initCount = 0L  )  [inline, static]

Definition at line 77 of file system.h.

00078             { return new LIFOSemaphore(initCount); }


Member Data Documentation

CriticalSection * System::systemCS = createCriticalSection() [static, private]

Definition at line 47 of file system.h.


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

Generated on Wed Mar 19 15:00:00 2008 for rwlock by  doxygen 1.5.5