CArch Class Reference

Delegating mplementation of architecture dependent interfaces. More...

#include <CArch.h>

Inherits IArchConsole, IArchDaemon, IArchFile, IArchLog, IArchMultithread, IArchNetwork, IArchSleep, IArchString, IArchSystem, IArchTaskBar, and IArchTime.

Collaboration diagram for CArch:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CArch (void *args=NULL)
virtual void openConsole (const char *)
 Open the console.
virtual void closeConsole ()
 Close the console.
virtual void showConsole (bool showIfEmpty)
 Show the console.
virtual void writeConsole (const char *)
 Write to the console.
virtual const char * getNewlineForConsole ()
 Returns the newline sequence for the console.
virtual void installDaemon (const char *name, const char *description, const char *pathname, const char *commandLine, const char *dependencies, bool allUsers)
 Install daemon.
virtual void uninstallDaemon (const char *name, bool allUsers)
 Uninstall daemon.
virtual int daemonize (const char *name, DaemonFunc func)
 Daemonize the process.
virtual bool canInstallDaemon (const char *name, bool allUsers)
 Check if user has permission to install the daemon.
virtual bool isDaemonInstalled (const char *name, bool allUsers)
 Check if the daemon is installed.
virtual const char * getBasename (const char *pathname)
 Extract base name.
virtual std::string getUserDirectory ()
 Get user's home directory.
virtual std::string getSystemDirectory ()
 Get system directory.
virtual std::string concatPath (const std::string &prefix, const std::string &suffix)
 Concatenate path components.
virtual void openLog (const char *)
 Open the log.
virtual void closeLog ()
virtual void showLog (bool showIfEmpty)
 Show the log.
virtual void writeLog (ELevel, const char *)
 Write to the log.
virtual CArchCond newCondVar ()
 Create a condition variable.
virtual void closeCondVar (CArchCond)
 Destroy a condition variable.
virtual void signalCondVar (CArchCond)
 Signal a condition variable.
virtual void broadcastCondVar (CArchCond)
 Broadcast a condition variable.
virtual bool waitCondVar (CArchCond, CArchMutex, double timeout)
 Wait on a condition variable.
virtual CArchMutex newMutex ()
 Create a recursive mutex.
virtual void closeMutex (CArchMutex)
 Destroy a mutex.
virtual void lockMutex (CArchMutex)
 Lock a mutex.
virtual void unlockMutex (CArchMutex)
 Unlock a mutex.
virtual CArchThread newThread (ThreadFunc, void *)
 Start a new thread.
virtual CArchThread newCurrentThread ()
 Get a reference to the calling thread.
virtual CArchThread copyThread (CArchThread)
 Copy a thread object.
virtual void closeThread (CArchThread)
 Release a thread reference.
virtual void cancelThread (CArchThread)
 Force a thread to exit.
virtual void setPriorityOfThread (CArchThread, int n)
 Change thread priority.
virtual void testCancelThread ()
 Cancellation point.
virtual bool wait (CArchThread, double timeout)
 Wait for a thread to exit.
virtual bool isSameThread (CArchThread, CArchThread)
 Compare threads.
virtual bool isExitedThread (CArchThread)
 Test if thread exited.
virtual void * getResultOfThread (CArchThread)
 Returns the exit code of a thread.
virtual ThreadID getIDOfThread (CArchThread)
 Returns an ID for a thread.
virtual void setSignalHandler (ESignal, SignalFunc, void *)
 Set the interrupt handler.
virtual void raiseSignal (ESignal)
 Invoke the signal handler.
virtual CArchSocket newSocket (EAddressFamily, ESocketType)
 Create a new socket.
virtual CArchSocket copySocket (CArchSocket s)
 Copy a socket object.
virtual void closeSocket (CArchSocket s)
 Release a socket reference.
virtual void closeSocketForRead (CArchSocket s)
 Close socket for further reads.
virtual void closeSocketForWrite (CArchSocket s)
 Close socket for further writes.
virtual void bindSocket (CArchSocket s, CArchNetAddress addr)
 Bind socket to address.
virtual void listenOnSocket (CArchSocket s)
 Listen for connections on socket.
virtual CArchSocket acceptSocket (CArchSocket s, CArchNetAddress *addr)
 Accept connection on socket.
virtual bool connectSocket (CArchSocket s, CArchNetAddress name)
 Connect socket.
virtual int pollSocket (CPollEntry[], int num, double timeout)
 Check socket state.
virtual void unblockPollSocket (CArchThread thread)
 Unblock thread in pollSocket().
virtual size_t readSocket (CArchSocket s, void *buf, size_t len)
 Read data from socket.
virtual size_t writeSocket (CArchSocket s, const void *buf, size_t len)
 Write data from socket.
virtual void throwErrorOnSocket (CArchSocket)
 Check error on socket.
virtual bool setNoDelayOnSocket (CArchSocket, bool noDelay)
 Turn Nagle algorithm on or off on socket.
virtual bool setReuseAddrOnSocket (CArchSocket, bool reuse)
 Turn address reuse on or off on socket.
virtual std::string getHostName ()
 Return local host's name.
virtual CArchNetAddress newAnyAddr (EAddressFamily)
 Create an "any" network address.
virtual CArchNetAddress copyAddr (CArchNetAddress)
 Copy a network address.
virtual CArchNetAddress nameToAddr (const std::string &)
 Convert a name to a network address.
virtual void closeAddr (CArchNetAddress)
 Destroy a network address.
virtual std::string addrToName (CArchNetAddress)
 Convert an address to a host name.
virtual std::string addrToString (CArchNetAddress)
 Convert an address to a string.
virtual EAddressFamily getAddrFamily (CArchNetAddress)
 Get an address's family.
virtual void setAddrPort (CArchNetAddress, int port)
 Set the port of an address.
virtual int getAddrPort (CArchNetAddress)
 Get the port of an address.
virtual bool isAnyAddr (CArchNetAddress)
 Test for the "any" address.
virtual bool isEqualAddr (CArchNetAddress, CArchNetAddress)
 Test addresses for equality.
virtual void sleep (double timeout)
 Sleep.
virtual int vsnprintf (char *str, int size, const char *fmt, va_list ap)
 printf() to limited size buffer with va_list
virtual int convStringMBToWC (wchar_t *, const char *, UInt32 n, bool *errors)
 Convert multibyte string to wide character string.
virtual int convStringWCToMB (char *, const wchar_t *, UInt32 n, bool *errors)
 Convert wide character string to multibyte string.
virtual EWideCharEncoding getWideCharEncoding ()
 Return the architecture's native wide character encoding.
virtual std::string getOSName () const
 Identify the OS.
virtual std::string getPlatformName () const
 Identify the platform.
virtual void addReceiver (IArchTaskBarReceiver *)
 Add a receiver.
virtual void removeReceiver (IArchTaskBarReceiver *)
 Remove a receiver.
virtual void updateReceiver (IArchTaskBarReceiver *)
 Update a receiver.
virtual double time ()
 Get the current time.

Static Public Member Functions

static CArchgetInstance ()
 Return the singleton instance.

Detailed Description

Delegating mplementation of architecture dependent interfaces.

This class is a centralized interface to all architecture dependent interface implementations (except miscellaneous functions). It instantiates an implementation of each interface and delegates calls to each method to those implementations. Clients should use the ARCH macro to access this object. Clients must also instantiate exactly one of these objects before attempting to call any method, typically at the beginning of main().

Definition at line 48 of file CArch.h.


Member Function Documentation

CArchSocket CArch::acceptSocket ( CArchSocket  s,
CArchNetAddress addr 
) [virtual]

Accept connection on socket.

Accepts a connection on socket s, returning a new socket for the connection and filling in addr with the address of the remote end. addr may be NULL if the remote address isn't required. The original socket s is unaffected and remains in the listening state. The new socket shares most of the properties of s except it's not in the listening state and it's connected. Returns NULL if there are no pending connection requests.

Implements IArchNetwork.

Definition at line 456 of file CArch.cpp.

References IArchNetwork::acceptSocket().

void CArch::addReceiver ( IArchTaskBarReceiver  )  [virtual]

Add a receiver.

Add a receiver object to be notified of user and application events. This should be called before other methods. When the receiver is added to the task bar, its icon appears on the task bar.

Implements IArchTaskBar.

Definition at line 624 of file CArch.cpp.

References IArchTaskBar::addReceiver().

void CArch::bindSocket ( CArchSocket  s,
CArchNetAddress  addr 
) [virtual]

Bind socket to address.

Binds socket s to the address addr.

Implements IArchNetwork.

Definition at line 444 of file CArch.cpp.

References IArchNetwork::bindSocket().

void CArch::broadcastCondVar ( CArchCond   )  [virtual]

Broadcast a condition variable.

Broadcasting a condition variable releases all waiting threads.

Implements IArchMultithread.

Definition at line 294 of file CArch.cpp.

References IArchMultithread::broadcastCondVar().

void CArch::cancelThread ( CArchThread  thread  )  [virtual]

Force a thread to exit.

Causes thread to exit when it next calls a cancellation point. A thread avoids cancellation as long as it nevers calls a cancellation point. Once it begins the cancellation process it must always let cancellation go to completion but may take as long as necessary to clean up.

Implements IArchMultithread.

Definition at line 354 of file CArch.cpp.

References IArchMultithread::cancelThread().

bool CArch::canInstallDaemon ( const char *  name,
bool  allUsers 
) [virtual]

Check if user has permission to install the daemon.

Returns true iff the caller has permission to install or uninstall the daemon. Note that even if this method returns true it's possible that installing/uninstalling the service may still fail. This method ignores whether or not the service is already installed.

Implements IArchDaemon.

Definition at line 216 of file CArch.cpp.

References IArchDaemon::canInstallDaemon().

void CArch::closeConsole (  )  [virtual]

Close the console.

Close the console. Calling this method on an already closed console must have no effect.

Implements IArchConsole.

Definition at line 168 of file CArch.cpp.

References IArchConsole::closeConsole().

void CArch::closeLog (  )  [virtual]

Close the log.

Implements IArchLog.

Definition at line 258 of file CArch.cpp.

References IArchLog::closeLog().

void CArch::closeSocket ( CArchSocket  s  )  [virtual]

Release a socket reference.

Deletes the given socket object. This does not destroy the socket the object referred to until there are no remaining references for the socket.

Implements IArchNetwork.

Definition at line 426 of file CArch.cpp.

References IArchNetwork::closeSocket().

void CArch::closeSocketForRead ( CArchSocket  s  )  [virtual]

Close socket for further reads.

Calling this disallows future reads on socket s.

Implements IArchNetwork.

Definition at line 432 of file CArch.cpp.

References IArchNetwork::closeSocketForRead().

void CArch::closeSocketForWrite ( CArchSocket  s  )  [virtual]

Close socket for further writes.

Calling this disallows future writes on socket s.

Implements IArchNetwork.

Definition at line 438 of file CArch.cpp.

References IArchNetwork::closeSocketForWrite().

void CArch::closeThread ( CArchThread   )  [virtual]

Release a thread reference.

Deletes the given thread object. This does not destroy the thread the object referred to, even if there are no remaining references. Use cancelThread() and waitThread() to stop a thread and wait for it to exit.

Implements IArchMultithread.

Definition at line 348 of file CArch.cpp.

References IArchMultithread::closeThread().

std::string CArch::concatPath ( const std::string &  prefix,
const std::string &  suffix 
) [virtual]

Concatenate path components.

Concatenate pathname components with a directory separator between them. This should not check if the resulting path is longer than allowed by the system; we'll rely on the system calls to tell us that.

Implements IArchFile.

Definition at line 246 of file CArch.cpp.

References IArchFile::concatPath().

bool CArch::connectSocket ( CArchSocket  s,
CArchNetAddress  addr 
) [virtual]

Connect socket.

Connects the socket s to the remote address addr. Returns true if the connection succeed immediately, false if the connection is in progress, and throws if the connection failed immediately. If it returns false, pollSocket() can be used to wait on the socket for writing to detect when the connection finally succeeds or fails.

Implements IArchNetwork.

Definition at line 462 of file CArch.cpp.

References IArchNetwork::connectSocket().

CArchSocket CArch::copySocket ( CArchSocket  s  )  [virtual]

Copy a socket object.

Returns a reference to to socket referred to by s.

Implements IArchNetwork.

Definition at line 420 of file CArch.cpp.

References IArchNetwork::copySocket().

CArchThread CArch::copyThread ( CArchThread  thread  )  [virtual]

Copy a thread object.

Returns a reference to to thread referred to by thread.

Implements IArchMultithread.

Definition at line 342 of file CArch.cpp.

References IArchMultithread::copyThread().

int CArch::daemonize ( const char *  name,
DaemonFunc  func 
) [virtual]

Daemonize the process.

Daemonize. Throw XArchDaemonFailed on error. name is the name of the daemon. Once daemonized, func is invoked and daemonize returns when and what it does.

Exactly what happens when daemonizing depends on the platform.

  • unix: Detaches from terminal. func gets passed one argument, the name passed to daemonize().
  • win32: Becomes a service. Argument 0 is the name of the service and the rest are the arguments passed to StartService(). func is only called when the service is actually started. func must call CArchMiscWindows::runDaemon() to finally becoming a service. The runFunc function passed to runDaemon() must call CArchMiscWindows::daemonRunning(true) when it enters the main loop (i.e. after initialization) and CArchMiscWindows::daemonRunning(false) when it leaves the main loop. The stopFunc function passed to runDaemon() is called when the daemon must exit the main loop and it must cause runFunc to return. func should return what runDaemon() returns. func or runFunc can call CArchMiscWindows::daemonFailed() to indicate startup failure.

Implements IArchDaemon.

Definition at line 210 of file CArch.cpp.

References IArchDaemon::daemonize().

const char * CArch::getBasename ( const char *  pathname  )  [virtual]

Extract base name.

Find the base name in the given pathname.

Implements IArchFile.

Definition at line 228 of file CArch.cpp.

References IArchFile::getBasename().

IArchMultithread::ThreadID CArch::getIDOfThread ( CArchThread  thread  )  [virtual]

Returns an ID for a thread.

Returns some ID number for thread. This is for logging purposes. All thread objects referring to the same thread return the same ID. However, clients should us isSameThread() to compare thread objects instead of comparing IDs.

Implements IArchMultithread.

Definition at line 396 of file CArch.cpp.

References IArchMultithread::getIDOfThread().

CArch * CArch::getInstance (  )  [static]

Return the singleton instance.

The client must have instantiated exactly once CArch object before calling this function.

Definition at line 154 of file CArch.cpp.

const char * CArch::getNewlineForConsole (  )  [virtual]

Returns the newline sequence for the console.

Different consoles use different character sequences for newlines. This method returns the appropriate newline sequence for the console.

Implements IArchConsole.

Definition at line 186 of file CArch.cpp.

References IArchConsole::getNewlineForConsole().

std::string CArch::getOSName (  )  const [virtual]

Identify the OS.

Returns a string identifying the operating system.

Implements IArchSystem.

Definition at line 612 of file CArch.cpp.

References IArchSystem::getOSName().

std::string CArch::getPlatformName (  )  const [virtual]

Identify the platform.

Returns a string identifying the platform this OS is running on.

Implements IArchSystem.

Definition at line 618 of file CArch.cpp.

References IArchSystem::getPlatformName().

void * CArch::getResultOfThread ( CArchThread  thread  )  [virtual]

Returns the exit code of a thread.

Waits indefinitely for thread to exit (if it hasn't yet) then returns the thread's exit code.

(Cancellation point)

Implements IArchMultithread.

Definition at line 390 of file CArch.cpp.

References IArchMultithread::getResultOfThread().

std::string CArch::getSystemDirectory (  )  [virtual]

Get system directory.

Returns the ussystem configuration file directory.

Implements IArchFile.

Definition at line 240 of file CArch.cpp.

References IArchFile::getSystemDirectory().

std::string CArch::getUserDirectory (  )  [virtual]

Get user's home directory.

Returns the user's home directory. Returns the empty string if this cannot be determined.

Implements IArchFile.

Definition at line 234 of file CArch.cpp.

References IArchFile::getUserDirectory().

void CArch::installDaemon ( const char *  name,
const char *  description,
const char *  pathname,
const char *  commandLine,
const char *  dependencies,
bool  allUsers 
) [virtual]

Install daemon.

Install a daemon. name is the name of the daemon passed to the system and description is a short human readable description of the daemon. pathname is the path to the daemon executable. commandLine should not include the name of program as the first argument. If allUsers is true then the daemon will be installed to start at boot time, otherwise it will be installed to start when the current user logs in. If dependencies is not NULL then it's a concatenation of NUL terminated other daemon names followed by a NUL; the daemon will be configured to startup after the listed daemons. Throws an XArchDaemon exception on failure.

Implements IArchDaemon.

Definition at line 192 of file CArch.cpp.

References IArchDaemon::installDaemon().

bool CArch::isAnyAddr ( CArchNetAddress  addr  )  [virtual]

Test for the "any" address.

Returns true if addr is the "any" address. newAnyAddr() returns an "any" address.

Implements IArchNetwork.

Definition at line 570 of file CArch.cpp.

References IArchNetwork::isAnyAddr().

bool CArch::isDaemonInstalled ( const char *  name,
bool  allUsers 
) [virtual]

Check if the daemon is installed.

Returns true iff the daemon is installed.

Implements IArchDaemon.

Definition at line 222 of file CArch.cpp.

References IArchDaemon::isDaemonInstalled().

bool CArch::isExitedThread ( CArchThread  thread  )  [virtual]

Test if thread exited.

Returns true iff thread has exited.

Implements IArchMultithread.

Definition at line 384 of file CArch.cpp.

References IArchMultithread::isExitedThread().

bool CArch::isSameThread ( CArchThread  ,
CArchThread   
) [virtual]

Compare threads.

Returns true iff two thread objects refer to the same thread. Note that comparing thread objects directly is meaningless.

Implements IArchMultithread.

Definition at line 378 of file CArch.cpp.

References IArchMultithread::isSameThread().

void CArch::listenOnSocket ( CArchSocket  s  )  [virtual]

Listen for connections on socket.

Causes the socket s to begin listening for incoming connections.

Implements IArchNetwork.

Definition at line 450 of file CArch.cpp.

References IArchNetwork::listenOnSocket().

CArchCond CArch::newCondVar (  )  [virtual]

Create a condition variable.

The condition variable is an opaque data type.

Implements IArchMultithread.

Definition at line 276 of file CArch.cpp.

References IArchMultithread::newCondVar().

CArchThread CArch::newCurrentThread (  )  [virtual]

Get a reference to the calling thread.

Returns a thread representing the current (i.e. calling) thread.

Implements IArchMultithread.

Definition at line 336 of file CArch.cpp.

References IArchMultithread::newCurrentThread().

CArchMutex CArch::newMutex (  )  [virtual]

Create a recursive mutex.

Creates a recursive mutex. A thread may lock a recursive mutex when it already holds a lock on that mutex. The mutex is an opaque data type.

Implements IArchMultithread.

Definition at line 306 of file CArch.cpp.

References IArchMultithread::newMutex().

CArchSocket CArch::newSocket ( EAddressFamily  ,
ESocketType   
) [virtual]

Create a new socket.

The socket is an opaque data type.

Implements IArchNetwork.

Definition at line 414 of file CArch.cpp.

References IArchNetwork::newSocket().

CArchThread CArch::newThread ( ThreadFunc  func,
void *  userData 
) [virtual]

Start a new thread.

Creates and starts a new thread, using func as the entry point and passing it userData. The thread is an opaque data type.

Implements IArchMultithread.

Definition at line 330 of file CArch.cpp.

References IArchMultithread::newThread().

void CArch::openConsole ( const char *  title  )  [virtual]

Open the console.

Opens the console for writing. The console is opened automatically on the first write so calling this method is optional. Uses title for the console's title if appropriate for the architecture. Calling this method on an already open console must have no effect.

Implements IArchConsole.

Definition at line 162 of file CArch.cpp.

References IArchConsole::openConsole().

void CArch::openLog ( const char *  name  )  [virtual]

Open the log.

Opens the log for writing. The log must be opened before being written to.

Implements IArchLog.

Definition at line 252 of file CArch.cpp.

References IArchLog::openLog().

int CArch::pollSocket ( CPollEntry  [],
int  num,
double  timeout 
) [virtual]

Check socket state.

Tests the state of num sockets for readability and/or writability. Waits up to timeout seconds for some socket to become readable and/or writable (or indefinitely if timeout < 0). Returns the number of sockets that were readable (if readability was being queried) or writable (if writablility was being queried) and sets the m_revents members of the entries. kPOLLERR and kPOLLNVAL are set in m_revents as appropriate. If a socket indicates kPOLLERR then throwErrorOnSocket() can be used to determine the type of error. Returns 0 immediately regardless of the timeout if no valid sockets are selected for testing.

(Cancellation point)

Implements IArchNetwork.

Definition at line 468 of file CArch.cpp.

References IArchNetwork::pollSocket().

void CArch::raiseSignal ( ESignal  signal  )  [virtual]

Invoke the signal handler.

Invokes the signal handler for signal, if any. If no handler cancels the main thread for kINTERRUPT and kTERMINATE and ignores the call otherwise.

Implements IArchMultithread.

Definition at line 408 of file CArch.cpp.

References IArchMultithread::raiseSignal().

size_t CArch::readSocket ( CArchSocket  s,
void *  buf,
size_t  len 
) [virtual]

Read data from socket.

Read up to len bytes from socket s in buf and return the number of bytes read. The number of bytes can be less than len if not enough data is available. Returns 0 if the remote end has disconnected and/or there is no more queued received data.

Implements IArchNetwork.

Definition at line 480 of file CArch.cpp.

References IArchNetwork::readSocket().

void CArch::removeReceiver ( IArchTaskBarReceiver  )  [virtual]

Remove a receiver.

Remove a receiver object from the task bar. This removes the icon from the task bar.

Implements IArchTaskBar.

Definition at line 630 of file CArch.cpp.

References IArchTaskBar::removeReceiver().

bool CArch::setNoDelayOnSocket ( CArchSocket  ,
bool  noDelay 
) [virtual]

Turn Nagle algorithm on or off on socket.

Set socket to send messages immediately (true) or to collect small messages into one packet (false). Returns the previous state.

Implements IArchNetwork.

Definition at line 498 of file CArch.cpp.

References IArchNetwork::setNoDelayOnSocket().

void CArch::setPriorityOfThread ( CArchThread  ,
int  n 
) [virtual]

Change thread priority.

Changes the priority of thread by n. If n is positive the thread has a lower priority and if negative a higher priority. Some architectures may not support either or both directions.

Implements IArchMultithread.

Definition at line 360 of file CArch.cpp.

References IArchMultithread::setPriorityOfThread().

bool CArch::setReuseAddrOnSocket ( CArchSocket  ,
bool  reuse 
) [virtual]

Turn address reuse on or off on socket.

Allows the address this socket is bound to to be reused while in the TIME_WAIT state. Returns the previous state.

Implements IArchNetwork.

Definition at line 504 of file CArch.cpp.

References IArchNetwork::setReuseAddrOnSocket().

void CArch::setSignalHandler ( ESignal  ,
SignalFunc  func,
void *  userData 
) [virtual]

Set the interrupt handler.

Sets the function to call on receipt of an external interrupt. By default and when func is NULL, the main thread is cancelled.

Implements IArchMultithread.

Definition at line 402 of file CArch.cpp.

References IArchMultithread::setSignalHandler().

void CArch::showConsole ( bool  showIfEmpty  )  [virtual]

Show the console.

Causes the console to become visible. This generally only makes sense for a console in a graphical user interface. Other implementations will do nothing. Iff showIfEmpty is false then the implementation may optionally only show the console if it's not empty.

Implements IArchConsole.

Definition at line 174 of file CArch.cpp.

References IArchConsole::showConsole().

void CArch::showLog ( bool  showIfEmpty  )  [virtual]

Show the log.

Causes the log to become visible. This generally only makes sense for a log in a graphical user interface. Other implementations will do nothing. Iff showIfEmpty is false then the implementation may optionally only show the log if it's not empty.

Implements IArchLog.

Definition at line 264 of file CArch.cpp.

References IArchLog::showLog().

void CArch::signalCondVar ( CArchCond   )  [virtual]

Signal a condition variable.

Signalling a condition variable releases one waiting thread.

Implements IArchMultithread.

Definition at line 288 of file CArch.cpp.

References IArchMultithread::signalCondVar().

void CArch::sleep ( double  timeout  )  [virtual]

Sleep.

Blocks the calling thread for timeout seconds. If timeout < 0.0 then the call returns immediately. If timeout == 0.0 then the calling thread yields the CPU.

(cancellation point)

Implements IArchSleep.

Definition at line 582 of file CArch.cpp.

References IArchSleep::sleep().

void CArch::testCancelThread (  )  [virtual]

Cancellation point.

This method does nothing but is a cancellation point. Clients can make their own functions cancellation points by calling this method at appropriate times.

(Cancellation point)

Implements IArchMultithread.

Definition at line 366 of file CArch.cpp.

References IArchMultithread::testCancelThread().

void CArch::throwErrorOnSocket ( CArchSocket  s  )  [virtual]

Check error on socket.

If the socket s is in an error state then throws an appropriate XArchNetwork exception.

Implements IArchNetwork.

Definition at line 492 of file CArch.cpp.

References IArchNetwork::throwErrorOnSocket().

double CArch::time (  )  [virtual]

Get the current time.

Returns the number of seconds since some arbitrary starting time. This should return as high a precision as reasonable.

Implements IArchTime.

Definition at line 642 of file CArch.cpp.

References IArchTime::time().

void CArch::unblockPollSocket ( CArchThread  thread  )  [virtual]

Unblock thread in pollSocket().

Cause a thread that's in a pollSocket() call to return. This call may return before the thread is unblocked. If the thread is not in a pollSocket() call this call has no effect.

Implements IArchNetwork.

Definition at line 474 of file CArch.cpp.

References IArchNetwork::unblockPollSocket().

void CArch::uninstallDaemon ( const char *  name,
bool  allUsers 
) [virtual]

Uninstall daemon.

Uninstall a daemon. Throws an XArchDaemon on failure.

Implements IArchDaemon.

Definition at line 204 of file CArch.cpp.

References IArchDaemon::uninstallDaemon().

void CArch::updateReceiver ( IArchTaskBarReceiver  )  [virtual]

Update a receiver.

Updates the display of the receiver on the task bar. This should be called when the receiver appearance may have changed (e.g. it's icon or tool tip has changed).

Implements IArchTaskBar.

Definition at line 636 of file CArch.cpp.

References IArchTaskBar::updateReceiver().

int CArch::vsnprintf ( char *  str,
int  size,
const char *  fmt,
va_list  ap 
) [virtual]

printf() to limited size buffer with va_list

This method is equivalent to vsprintf() except it will not write more than n bytes to the buffer, returning -1 if the output was truncated and the number of bytes written not including the trailing NUL otherwise.

Implements IArchString.

Definition at line 588 of file CArch.cpp.

References IArchString::vsnprintf().

bool CArch::wait ( CArchThread  thread,
double  timeout 
) [virtual]

Wait for a thread to exit.

Waits for up to timeout seconds for thread to exit (normally or by cancellation). Waits forever if timeout < 0. Returns true if the thread exited, false otherwise. Waiting on the current thread returns immediately with false.

(Cancellation point)

Implements IArchMultithread.

Definition at line 372 of file CArch.cpp.

References IArchMultithread::wait().

bool CArch::waitCondVar ( CArchCond  ,
CArchMutex  ,
double  timeout 
) [virtual]

Wait on a condition variable.

Wait on a conditation variable for up to timeout seconds. If timeout is < 0 then there is no timeout. The mutex must be locked when this method is called. The mutex is unlocked during the wait and locked again before returning. Returns true if the condition variable was signalled and false on timeout.

(Cancellation point)

Implements IArchMultithread.

Definition at line 300 of file CArch.cpp.

References IArchMultithread::waitCondVar().

void CArch::writeConsole ( const char *   )  [virtual]

Write to the console.

Writes the given string to the console, opening it if necessary.

Implements IArchConsole.

Definition at line 180 of file CArch.cpp.

References IArchConsole::writeConsole().

void CArch::writeLog ( ELevel  ,
const char *   
) [virtual]

Write to the log.

Writes the given string to the log with the given level.

Implements IArchLog.

Definition at line 270 of file CArch.cpp.

References IArchLog::writeLog().

size_t CArch::writeSocket ( CArchSocket  s,
const void *  buf,
size_t  len 
) [virtual]

Write data from socket.

Write up to len bytes to socket s from buf and return the number of bytes written. The number of bytes can be less than len if the remote end disconnected or the internal buffers fill up.

Implements IArchNetwork.

Definition at line 486 of file CArch.cpp.

References IArchNetwork::writeSocket().


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

Generated on 12 Nov 2010 for synergy-plus by  doxygen 1.6.1